"You are debugging a release build" when debug is selected

Viewed 5937

I am attempting to debug my solution, which is set to start a few different projects. One of these projects is giving me an error when it is hit saying that it is running in release mode. This same solution has been running fine on Windows 7, but I just switched to a new machine running Windows 10 and am now getting this error message. I have attempted cleaning the solution and doing a rebuild with Debug and Any CPU selected to no avail. The code that is failing is within a class library that is referenced by a Web Api project. I am able to send a request to the Web Api that does not require the use of the class library and that works as intended.

Visual Studio Error Message

6 Answers

Try opening configuration manager in visual studio and ensure that all of the projects are set to debug, I assume that some are release.

enter image description here

As an alternative, after reading the docs here, I rebuilt once again and spotted a warning stating that some modules were optimized but that I had Enable Just My Code set. I then reverted Supress JIT Optimization on module load to its original value (selected) but de-selected Enable Just My Code. I am able to debug now

Go to Project->Properties->Build

then Uncheck Optimize Code

It happens to me another day that I had one solution with several projects. Using "Add existing project" i had one library project - which is a Nuget. I wanted to debug this Nuget. In the WebApi project that used the Nuget, I remove the reference to the Nuget and make a reference to the Class Library.
I was getting this message all the time. I did all the advices : Mark "Define Debug Constant". Check Solution Configuration Props and check if projects are all in Debug etc...

It turns out that the Nuget was been referenced in all the other projects besides WebAPI. And I just remove it in one of my projects. This was the only and single problem :/

It happened to me as well. For me everything was in debug and still getting the error. I observed that it happened to me because, I had installed the executable on the same machine for which I was setting up the Dev environment. Uninstalling it solved the problem.

I have tried all solution above and didn't work. and I found this solution work :

Debug > Options > Debugging > General > (check) Surpress JIT optimization on module load (Managed only)

Related