ASP.NET Web API project stopped running - c#

My current ASP.NET Web API project simply quit running a couple days ago. No code, not even the code in Global.asax.cs, is executing. Some clues:
The project stopped working after I hopped over to a subcontractor's Git branch. When I hopped back to the master branch, it didn't work.
The issue is associated with my primary development computer (Windows 10 running in a Parallels environment on OS X). It runs fine on my secondary development machine.
If I attempt to establish a breakpoint on any line of code after
starting debug, I get the following error: “The breakpoint will not
currently be hit. No symbols have been loaded for this document.” I
have followed every thread on the following stackoverflow
breakpoint not hit posting, but have been unable to get it to work.
In addition to implementing the the threads on the stackoverflow
breakpoint not hit posting, I've tried the following.
Verified that debug configuration and full debug info are set on all assemblies.
Manually deleted all bin and obj folders. Cleaned and rebuilt the
project.
Rebooted numerous times.

Maybe you have some files leftover from the subcontractor's branch that you don't want? Have you tried discarding all of your changes and then pulling on your good master branch?
Also, I usually find myself receiving the "no symbols loaded" error if my files have changed from the binaries expectation of those files creating a mismatch between what's running and what's displayed in visual studio. Again, making sure you clean the solution and rebuild it or restarting visual studio usually gets me out of trouble.

Related

Code runs, but reports that I am debugging in release build

I have an application where I can start it out in debug mode, and everything will run fine for several minutes until it will randomly pop up a box saying "You are debugg in a Release build of ***. Using Just My Code with Release builds using compiler optimizations results in a degraded debugging experiance...
I am running multiple projects at a time (they all depend on each other)
The project that it is erroring on is a class library that is referenced by both console applications and Web Api applications and is housing my data layer.
I have checked in the configuration manager and everything under debug is set to debug.
When I mention random above, at times it will error when I am trying to use the application, while other times it will error when sitting idle.
I have attempted to do a repair on Visual Studio and am using Visual Studio 2015.
I have also had other errors such as IIS Express just quit working out of nowhere, and I am using a machine with very good performance.
Does anyone have a suggestion on what I can troubleshoot next? I just wouldn't think that it would be the code if the code is being executed before the error just fine.
I finally figured out the "fix", which is very strange. I went in and enabled Suppress JIT optimization and everything went to working. I then disabled it to ensure that was the issue, but it has continued to work. I am not sure how this fixed this issue, but all appears to be working now.
Also, I am running Update 3 as asked above.

Visual Studio 15.9.3 breaks web forms?

I have a 15 year old web forms app targeting .NET 4.6.1 that I'm maintaining, and I recently upgraded my laptop to VS 15.9.3. A release build of this app with 15.9.3 no longer fires the Application_Start event on production servers (running .NET 4.7.2). It runs locally just fine and I frequently deployed production builds from this laptop prior to the upgrade.
My desktop computer is still running VS 15.8, and a production build there works fine. The source code is the same between these machines, only the VS versions differ.
Symptoms and attempts at remedies:
I cleaned out all old files from production and tried setting it up from scratch. No dice.
Setup new application under IIS using the same build, but the outcome is the same.
Nothing in the event logs about any errors, except for the error that gets raised when some pages try to access state that's initialized in Application_Start.
I try to log some messages and even raise an exception right at the start of Application_Start, and I don't see anything, so Application_Start is definitely not running.
What can I do to further diagnose the problem? I haven't been able to find anything about this online, or why the newest VS release suddenly doesn't work.
Barring any remedies, any suggestions for downgrading VS instead of completely uninstalling and reinstalling the older VS?
Edit: now even reverting my laptop to VS 15.8.9 did not roll back the problem, so I've disassembled a build from both machines. There are few differences, basically the build number of a dependent assembly, the module version identifier, the comment designating the "image base":
Not working build:
// Image base: 0x055E0000
Working build:
// Image base: 0x052D0000
As far as I understand, none of these differences should have any observable effect. I then disassembled the dependent assembly that's built alongside the ASP.NET app, and it has the above differences and a few more related to the offsets for static field initializers. So I still have no idea why this might be happening.
Edit 2: it seems the issue is in the final aspnet_merge step while trying to merge the precompiled web forms. The merge fails in finding any assemblies to merge, suggesting that precompilation may have failed.

Visual studio 2017 professional attach to process not working correcly

I have one solution in VS 2017 pro, where i am unable to attach process and debug properly.
For start, even though my application is loading/running properly, visual studio attach to process screen always shows 0 Sessions against that app-pool/application.
If i then select it, it never hits any of the C# code (weird).
I manage to hit some razor view cshtml files to be debugged, but never the c# code
any ideas?
My first question if you have started process/service. Then build code do you get error message that exe is already in use?
If not then you are not sure about the correct code.
If then aleast run against your code alomst for sure.
If that not solve your problem. We need to see where you have installed and how to service. Also what the code for the service looks like. It help see where you have your first breakpoint in the code.
Usually if it not reaching the breakpoint or the code is grayed out. It is because the binary is not found or it does not match the code. T
The service you are trying to debug are it installed in your building directory so you are sure is lastes version?

change output path of MVC x64 project

Ever since I've changed my MVC 4 project output path,
any changes I make to my Controller are not reflected.
When I try to debug my Controller with a breakpoint, it doesn't hit and I get
The breakpoint will not currently be hit. The source code is different from the original version.
I'm using Visual Studio 2015
UPDATE
So I've deleted the old bin folder and re-run the application. I've got the following error
I've followed the solution suggested in this post and now I get
Any ideas?
Whenever I encounter issues like this, I do the following:
close Visual Studio
stop the IIS webapp/website (if not running on IIS Express)
delete bin and obj folders
start Visual Studio
rebuild
This usually helps with all kinds of issues that sometimes occur.
It seems that there's two different version of binaries at your project. By deleting the binaries, you might find out what the real issue is.

Pressing F5 in Visual Studio 2010 Builds but does not Launch Application

I have a Click Once application (WPF) in C#. Initially when I would hit F5 to debug/launch the application it worked smoothly. Eventually, F5 only would build the solution and not launch the application (therefore I could not step through my code). For a short while I switched from Debug to Release mode and for some reason that allowed the application to launch after using F5 and I could step through my code again. But now that no longer works either. Long story short, I cannot get the application to run in a manner that allows me to step through the code. I can only do a Start without Debugging (Ctrl + F5). Obviously this doesn't do much for me other than tell me if the application works or not.
The thing that worked for me today was to open Task Manager and look for any debug programs that didn't terminate properly.
Task Manager > Processes > kill all programs "*.vshost.exe *32"
You probably have lost your start up project in the solution, or the start up project is messed up, and no correct "item" is defined for the startup.
Right click on one of your projects, and select : define as startup project.
Then retry that should do the trick. If not, check in that projects properties to see if a form or something is defined as the startup object for that project.
Edit : Obviously dont define a class library project as startup project, but choose your UI :).
I had this same issue today and came here looking for help. I tried all the suggestions here and nothing helped.
Seeing as my solution was a simple console application I recreated it from scratch. The new solution didn't exhibit the problems, so I started comparing the two.
I reset the solution and project files so that they were identical (apart from Project GUID, name and root namespace) but the first solution still didn't run.
I then tried deleting the suo files, and the bin and obj folders. Still the first solution wouldn't run.
Finally, I noticed the vshost.exe process was still running for the project. When I killed that and reloaded, it all started working correctly.
I just had this problem today. The solution turned out to be a slight twist on the issue with *.vshost.exe mentioned previously.
I could build the application just fine but msvs refused to launch it. I could manually launch the application and the time stamp on the file indicated that it was in fact a fresh build as well. *.vshost.exe wasn't showing up in the task manager, so I couldn't end the process as suggested.
When all else failed, I tried deleting the .exe's and found that *.vshost.exe would not delete because it was in use. The error message indicated that it was actually the steam client (third party software) that had somehow grabbed my *.vshost.exe file and was "using" it. Not sure how or why. At any rate, I completely shut down steam, then it let me delete *.vshost.exe. After that, building and running from msvc worked normally.
Had the same issue, eventually tried deleting all breakpoints and the debug started working again. Yet to figure out why, but at least it works.
As well as the ghost *.vshost.exe. It could also be that you have the same Solution/Project open in another version of VS. I had the same Solution open in both VS2010 and VS2015 and when running in VS2010 it compiled but failed to start. Closing the VS2015 Solution and it ran as expected.
After years of using VS 2008, I suddenly had the F5 problem not launching the application. There must be a dozen different suggestions out there - I tried a few. Someone suggested a virus. My Microsoft Security Essentials was not automatically updating (a common problem it seems), so I manually updated it. It found a virus, removed it, and the F5 problem went away !
Had this problem and tried to delete everything in bin/debug folder but could not delete vshost.exe file - kept requesting admin permission and then still could not remove it even though running from admin account. Restarted and file was gone and f5 worked again

Categories

Resources