Error: You are debugging a Release build of X.dll
Solution 1
Disable this option under Debug->Options->Suppress JIT optimization on module load (Managed only).
A connect report submitted before:
Please also make sure that all projects are in debug mode, Optimize code was unchecked like this case:
VS2015 Project no longer runs in debug mode
Solution 2
"Optimize code" option is there on visual studio project level. Remove that for debug mode.
Solution 3
I also encountered the similar problem in Visual Studio 2019 Following Steps solved my issue Debug-> Options->Uncheck Enable Just my code option
Solution 4
Just had a similar issue that I was able to fix by Cleaning my solution 3 times and rebuilding. Hope this helps other people too.
Solution 5
Right click on your solution and select Properties.
Then, go to Configuration Properties on the left and select Configuration under it. Make sure that the Configuration of the project you are running is in 'Debug' and not in 'Release'.
If the Configuration is in 'Release' you would get this error.
Sam
Updated on July 05, 2022Comments
-
Sam almost 2 years
Background
I have an ASP.NET MVC application project, along with various other projects within a Visual Studio solution. The different projects use various versions of the NPoco library as follows:
- The MVC project includes a version of NPoco through NuGet.
- Some other projects include a (probably different) version of NPoco through a reference to a DLL (not the DLL provided through NuGet).
- One of the projects is the source code of a version of NPoco with some alterations made.
I'm using Visual Studio 2015 Update 3 14.0.25422.01.
Error
For some reason, when I launch this application in the debugger using the normal Start Debugging command in Visual Studio, it launches, but it also produces the following warning:
If I press Continue Debugging, everything seems to still work as usual, including breakpoints.
This problem only started happening recently.
Question
- Anyone know what caused the above error?
- Do I have something misconfigured?
-
Sam almost 8 yearsThanks. The Suppress JIT optimization on module load setting was disabled, but the problem stopped happening when I enabled it.
-
Jack Zhai-MSFT almost 8 yearsYou are welcome, at least, we know that it is really related to this debugging option.
-
Matt almost 7 yearsThank you - The solution you suggested worked! Note: The Microsoft feedback link is not reachable, it shows: "Page Not Found - The content that you requested cannot be found or you do not have permission to view it."
-
puddleglum almost 7 yearssame here... started right after adding a nuget package.. At first the re-referencing fix had no affect; even after rebuilding. I had to restart VS. Then it cleared up. @TrtlBoy, thanks for your help.
-
Reid almost 7 yearsA simple rebuild fixed mine. Thanks @puddleglum.
-
NibblyPig about 6 yearsTo add to this, if you uninstall a nuget package from your project and add a reference directly to the project, make sure nothing else in the solution is using the nuget package. In my case there was another csproj that was still using the nuget package, and it produced this message. I uninstalled the nuget package from all projects and re-added the references manually.
-
MistaGoustan over 5 yearsBut what is this checkbox? Does "Continue Debugging (don't ask me again)" just check it for you? what are you losing from checking this box?
-
Nick Westgate over 4 yearsI think you mean "enable this option". That worked for me, but looking at the problem project it had Build -> Optimize code enabled, and disabling that worked as suggested below by Mahesh Malpani.
-
Adam Plocher over 4 yearsI'm glad that helped. I should mention that I later found out that this particular project was decompiled from a "Release" build of a project that my company lost the source code for! So it's probably a common thing to find in any "Release" assembly that gets decompiled.
-
Khareem over 4 years@sam What you explained here works for me too Thanks A lot
-
Nick Turner almost 4 yearsGreat Answer! When in a solution testing, reference the project directly, not the nuget. No need to restart VS. You may get issues if you have multiple projects referencing this. But you don't need more than a test project included anyways
-
Shammie over 3 yearsJIT optimization default setting was disabled, but the problem solved after I enabled it, anyways, Thanks a lot, <3
-
Veverke over 3 yearsI went with Sam's suggestion, but after reading the docs here decided to try again. I spotted a build warning stating that some modules were optimized but I had
Enable Just My Code
set. I then revertedSuprress JIT Optimization on module load
to its original value (selected) but de-selected Enable Just My Code. I am able to debug now. -
joegreentea over 3 yearsThis is it, Thanks!
-
Badr Bellaj about 3 yearsChange from debug to release in MV sol configuration dropdown list
-
Sayed Mahmoud over 2 yearsNice, it works as a charm, Thanks...
-
Honza P. about 2 yearsthis was the case for me in VS2022 old project, thx.
-
Carter about 2 yearsVery nice, this happens in VS 2022 as a new thing on my project. Thanks for the tip wish it was in the dialog that comes up.
-
Waragi about 2 yearsThis was the solution for me on Visual Studio 2022 after several hours of working on this issue.
-
ramya almost 2 yearsWorked perfect for me in VS2019 for ASP.NET Core project. thanks.