John T
John T

Reputation: 2677

VS 2015 Update 1 - Claiming I am debugging a release build

After updating to VS 2015 update 1, if I run a web project (MVC), stop the application, then try to run it again, VS stops and pops up a dialog claiming

You are debugging a Release build of <myproject.dll>.

Using Just My Code with release builds using compiler optimizations results in a degraded debugging experience (e.g. breakpoints won't be hit).

The problem is I'm not running a release build. I'm clearly running the (same) debug build I just ran! Why does VS think I'm running a release build?

Cleaning the solution and re-running clears the error message, so something is hosed somewhere.

Upvotes: 98

Views: 45622

Answers (18)

CodingYoshi
CodingYoshi

Reputation: 27039

Here is what worked for me.

If a web project, Go to the project properties of the web project and

  1. If Local IIS is selected, restart your IIS server.
  2. If IIS Express is selected, exit IIS express from the task tray icon.

It seems some dll's get cached so the above steps will invalidate the cache.

Upvotes: 0

cesar-moya
cesar-moya

Reputation: 601

I noticed the answers here are incomplete, I was having the same issue and it was solved by opening the project properties and under the build tab and debug configuration unchecking "optimize code". You also should check the configuration manager as mentioned above to make sure that is also sound. The answer came from this post and they should get the credit: VS2015 Project no longer runs in debug mode

Thanks,

Upvotes: 26

Randy Richardson
Randy Richardson

Reputation: 11

In my case, the error message was correct. I was running an application that loaded the released version. So I corrected it by having the application load the debug version instead.

Elementary, I know, and I realize I make myself look like an idiot. But sometimes the problem is exactly what is reported.

Upvotes: 1

TomDane
TomDane

Reputation: 1076

Restart Visual Studio. This fixed the issue for me in 2017 Professional.

Upvotes: 0

Nate Cook
Nate Cook

Reputation: 8585

As mentioned by @romanoza, Microsoft updated the (now missing) Microsoft Connect bug report, (previously located here, in case you are able to find an archive somewhere) with the following information:

Uncheck the setting Debug -> Options -> Suppress JIT optimization on module load (Managed only)

This is the workaround. They go on to say later:

We recommend folks leaving it unchecked as having it unchecked will improve both performance and the behavior of just my code in specific scenarios.

Lastly, the acknowledgement:

It is a bug that it doesn't work with that setting enabled and we're working on a fix for that situation in case some customers still want to debug with that setting turned on.

Update: Based on the comments, it appears that the box is now unchecked by default for some developers, and that checking it can fix the exact same problem in some cases. Very strange.

Upvotes: 47

JohnZ
JohnZ

Reputation: 14

I have tried all the answers, and the one worked for me is remove some NuGet package, not just the reference, but remove the package, in my case PostSharp. At first I tried to remove the reference from all the projects, and it doesn't work, then I just removed the packages from the manager. I don't what exactly the reason, but that's what solved my problems, hope it could help someone out there.

Upvotes: 0

Mak R
Mak R

Reputation: 56

In my case, I had changed the "Active solution platform" for the whole solution at "Configuration Manager" from x86 to Any CPU, fixed the problem

Upvotes: 3

Ian_G
Ian_G

Reputation: 1

For me, I found 3 \Release\ folder refs in this FileListAbsolute.txt file:

C:\Projects\MyWebApp.Web\obj\Release\MyChildWebApp.Web.csproj.FileListAbsolute.txt

They were like this:

C:\Projects\MyWebApp.Web\obj\Release\MyChildWebApp.Web.csprojResolveAssemblyReference.cache

C:\Projects\MyWebApp.Web\obj\Release\MyChildWebApp.Web.dll

C:\Projects\MyWebApp.Web\obj\Release\MyChildWebApp.Web.pdb

And simply removing those 3 lines outside of VS then re-opening the solution solved the problem. Hope that helps.

Upvotes: 0

Crowcoder
Crowcoder

Reputation: 11514

There seem to be as many solutions as there are people having the problem, but in my case I had to remove and re-add a project reference. The project reference was in a unit test project in the same solution.

Upvotes: 1

Andy Twiss
Andy Twiss

Reputation: 21

Check that the IIS Project URL actually points where you think it does. If in doubt, click the 'Create Virtual Directory' button.

I had this issue recently where I had been running a temporary version of a production codebase and had repointed the folder in IIS to the temporary version, which was, indeed, running a production build, not the debug version I was trying to debug.

Upvotes: 0

Jerad Rose
Jerad Rose

Reputation: 15513

Pretty sure this has been fixed in Visual Studio 2015 Update 2.

I used to see this all the time (multiple times per day), and have not seen it once since updating to Update 2.

Upvotes: -1

fabriciorissetto
fabriciorissetto

Reputation: 10083

I solved the problem setting the configuration to Debug in the Configuration Manger window as suggested in this answer.

enter image description here

Upvotes: 13

Alex
Alex

Reputation: 5646

I noticed that Visual Studio wasn't killing the iisexpress process after I stopped the debugger. Manually killing the process seemed to fix it for me.

This appears to have now been fixed in Update 2.

Upvotes: 1

romanoza
romanoza

Reputation: 4862

Cleaning (and rebuilding) the solution works for me as a temporary workaround. Also you can select Debug > Options and unselect the Suppress JIT optimization checkbox.

Upvotes: 11

John T
John T

Reputation: 2677

The word from Microsoft is that this is a known issue (it originally went to the Debugger team, but was determined it was a build issue, and is now in the Project system team's hands. There are other bugs open on this issue, and it's rated Priority 1, so should be on track for the next update. Though as would be expected, no promises can be made as to when it will be released (or what is actually in the update).

So. It's known and is being worked on. At least turning off the “Enable Just My Code” in the Debugging General Options seems to be a work around for now.

Upvotes: 58

Jon
Jon

Reputation: 61

I've been having the same issue since updating to VS2015 Update 1.

Found a similar report on Microsoft's Visual Studio Forums which points to a bug report that's been raised with them here

There are various workarounds but I think the underlying issue is that IIS Express is not shutting down when debugging is ended - and its not because of the edit and continue option being unchecked. Quickest workaround I can find until the bug is fixed:

  • Right click on IIS Express icon in tray and exit it after debugging (Credit to David Totzke who supplied workaround on bug report)

Not great, but I don't think a proper solution is available at the moment.

Upvotes: 6

Bps
Bps

Reputation: 121

I encountered the same problem. I resolved the problem by manually deleting all the files from the 'bin' folder and then rebuild the solution. I don't get this dialog anymore.

Upvotes: 3

user5632285
user5632285

Reputation: 11

Check your solution's Configuration Properties. I ran into the same problem and discovered that my debug configuration was actually building some projects with a release configuration.

Upvotes: 1

Related Questions