ASP.NET Website Server error '/' being thrown - asp.net

I am currently working with SQL queries on an ASP.NET empty website (Visual Studio). The first time I ran the build, everything worked fine. It displayed all required records with no problem.
However, after changing the SQL command, it now throws an error at build-time, and I cannot figure out why:
To be clear, I first configured the data source:
And then added a WHERE clause:
and now I am left with this error each time:
Any idea what is going on here?

remove OnSelecting="SQlPracticeSource_Selecting" from your aspx page and run again

Related

StackOverflow error when calling DataContext.SubmitChanges()

In a hybrid asp.net web application, framework 4.5.1, using LINQ to SQL (not Entity Framework) I'm getting the exception
"An unhandled exception of type 'System.StackOverflowException' occurred in System.Data.Linq.dll"
on any call to DataContext.SubmitChanges().
Every call to SubmitChanges() causes the error, it does not matter what specific entity is being altered. The error is thrown immediately (unlike most StackOverflow exceptions, which normally take a few seconds to occur while the errant code overflows the stack).
The asp.net web application is running on my local host in IIS express using Visual Studio 2013. The database is SQL Server 2005.
My question is, how does one debug a StackOverflow exception in this environment? Right now the above error message is all I get.
The Event Viewer notes that the browser crashed (it happens in both IE 11 and Chrome) but nothing about the LINQ to SQL exception.
The SQL Server process monitor does not register any database call.
I have a log hooked up to my DataContext but it records nothing.
It appears the stack overflow is happening inside System.Data.dll before any database call occurs and before anything can be logged.
This suddenly started happening several hours ago, after a windows update ran and the machine rebooted. That might be a coincidence.
Something else extremely odd: we have four developers in our shop, all using Visual Studio 2013. Two of us suddenly began having this problem, and two of us never had it. We're all running identical code and hitting the same database. The two of us having the problem rebooted, and the problem disappeared on one machine, but is still occurring on my machine.
In addition to rebooting, I've deleted the project from machine and pulled it down from source control so that it is identical to what my 3 co-workers have, deleted all temporary internet files on my machine, and deleted all of my AppData\Local\temp files for my login.
Is there any way to debug this issue?
Clip of call stack when exception occurs (the calls to VisitExpression and etc repeat many dozens of times until it ends).
The unsatisfying "answer" in this case was to delete the *.dbml file and re-create it. That fixed the stack overflow error.
My comment in reply to #GertArnold above was not accurate. Only one DataContext was throwing the stack overflow exception. It was doing it for every entity in the DataContext, but other DataContexts in the application were working properly.
This particular *.dbml file has been growing over the years to gargantuan size. While re-creating I was careful to only add database objects that are being referenced, which resulted in a much smaller *.dbml file, which might itself have fixed the problem.
Thanks a lot Tom for the info!
Just in case other people may hit the same problem, here is extra info from my case. I have got a very similar issue after my PC got a batch of Windows updates yesterday, the updates including windows10 OS, VS2013/VS2015 and etc. I primarily use VS2013, some differences with Tom's case are,
it only pops up when update one entity, other entities in the same DataContext work fine
only affects my ASP.NET Web API project, console applications are fine, even all app projects ref to the same unitofwork data layer project (in where the dbml file sits)
replacing the dbml file didn't work for me, I finally solved it by opening the solution in VS2015 >> debugging >> closing VS2015 >> opening the solution in VS2013, the problem just disappeared

"Sequence contains no matching element" Error. Is there some limits with SQL Server Express and EF in ASP.Net MVC?

I am building a substantial ASP.Net MVC app using the latest EF and MVC. Suddenly nothing works, every one of my index views now produces the following error when its generates the data to send to the index view:
System.InvalidOperationException {"Sequence contains no matching element"}
This is happening in code that was generated when I added a controller with views. It now effects ALL my index views and there are about 40 of them which all worked previously and now none of them work. The only thing I can think of is that I hit some limit as I am just adding very similar controllers.
I have found the cause of my problem. None of my previous work on this machine will work anymore. They haven't been changed and they were all working. The problem is that anything I run in Visual Studio (VWD 2013 and VS Community 2015) will NOT talk to SQL Express.
I became suspicious and removed the connection string from the problem App and got exactly the same message. I then thought I would try it with Apps that I know worked, but I ran them first before I made any changes and they (five different apps) all produced the same error.
Yet If I look at Server Explorer it still works and it is using the same Web.Config connection string, because when I remark it Server Explorer will not access the database.
As I said from the start this is some internal problem as all the code was generated by Visual Studio and then it all failed, and all my other working Apps fail as well.
I will now test it on a different machine.
I manually rebuilt it all and the problem appeared again when I added the last few Models. So that was not the solution. I got assisatnce on the ASP.Net forum from Krunal who provided a solution that worked and fixed both versions which had the problem.
I was working with Code First from the database. Krunal thought I was using Database first with Designer and suggested I use the Model Browser to refresh my model. You don't get a Model Browser if you used Code First so I added a Database First Design Model which created a EDMX file, I then right clicked on that and opened the Model Browser.
I then rebuilt it and it all worked. I then went back to the original version added an EDMX opened the Model Browser and it all worked fine. As I said from the start it was not a code issue it was an Internal problem with Visual Studio and SQL Express. No code was changed.

asp.net compile time error - object reference not set to an instance of an object

I am getting the following error in the error list of an ASP.NET web site opened in visual studio 2012.
And in the Error window there is no line number/file name and clicking on the error does not take me to a line of code.
This is a compile time, not runtime error. The code runs fine on the web server and used to work in VS2005 (on another computer until the drive failed). I just can't get it working in 2012.
Your help is greatly appreciated.
I've had this in the past and it turned out Visual Studio was reporting an aspnet_compiler error as a "warning". Go to the Error List pane, and at the top there are toggle buttons for Error and Warning. Hit the Warning button till it shows you all the warnings, and you may well find the answer there.
It's also sometimes useful to run aspnet_compiler.exe from the command prompt, to see the output independently from the Visual Studio build.

crystal reports error when hosting on server

I have a web application which I developed which uses crystal reports for VS 2010. The reports work fine on my machine, but when I publish the web application, I get the following error when loading the report:
Error
This group section cannot be printed because its condition field is nonexistent or invalid. Format the section to choose another condition field. Error in File temp_9b46c401-8cdb-45a6-bade-4d3e37dda1fb {572D2B99-425A-4EC5-A758-6497001368A3}.rpt: Invalid group condition.
I've searched for this and from what I can understand it's a connection issue. But I've checked and the database connection string is fine. Other parts of web application work fine with it. Is there anything else I should be checking for?
I've resolved the issue. It was very frustrating and so I thought I should put this here in case anyone runs into this:
Make sure you have the same version of Crystal Reports Runtime installed on your server as on your development machine. I had 13.0.3 on my development machine and 13.0.1. on my server. Of course crystal reports gave an obscure error which makes it very difficult to know where to look.
After I did this, I kept getting a blank page. This linked help me resolve this issue: http://www.codeproject.com/Questions/287543/Crystal-Reports-not-rendering-when-webpage-is-serv. Apparently visual studio doesn't copy all the necessary files for it to render the reports.
Thanks.
I'm not so sure that the error is because of a database connection issue. If I were you I would look into a few things first:
Make sure that the database fields haven't changed. Is the application accessing the same database when deployed as it does in the development environment?
What about Null values? Have you checked the "Convert Database Null Values" in the Report Options?
What about the groups? Are there any formulas in them or are any of them based on groups? Browse the data to see if you get any errors.
Just because it runs on your development machine doesn't mean the problem isn't in the datasource. Maybe one of your report's formulas is expecting a field to be non-null, and there is a single null entry. Or a date somehow got entered as #01/01/9999# and a formula in the report is expecting a realistic date.
That should get you started and maybe even solve your issue. Give us some more info about the report and the datasource if you can.

Visual Studio 2010 giving error "External Component has thrown an exception"

I am running Visual Studio Ultimate on Windows 7. Here is the description of my problem:
My VS 2010 had been running absolutely fine until today when it started giving error "External Component has thrown an exception" when I try to open a new website. Creating a new web application works fine though but I am unable to run any of them.
While trying to run the previously created websites/webapps, its giving error as "Unable to launch ASP.NET development server".
And when I try to debug the website/web app, I am getting error: "Unable to launch ASP.NET development server. An attempt was made to perform an initialization operation when initialization has already been completed".
Similar errors are coming when I try to open Windows Form Applications and other projects.
No errors are getting logged on event viewer and I cannot see any other error information apart from what is mentioned above.
I searched all over internet but no help. I have already trying un-installing VS2010 using the script at this link (provided by MS). But when I re-install VS2010, it still shows me same error. To my surprise, after re-installing VS still shows the previous project list in "Recent Projects". I really doubt if VS is getting uninstalled.
I am totally clueless and any help would be highly appreciated. I am left with no other option but to format my OS if I don't find a solution here :( Please do let me know if any other details are required...
It might be caused by an adding or extension that you've installed, maybe without being aware of.
there are several ways to deal with that - one is to get inside add in manager and remove/ deactivate them.
if VS can't load there is a flag that should do the trick.
check this link for instructions on devenv flags.
you can use: /ResetAddin or /SafeMode

Resources