Error: You are debugging a Release build of X.dll

Sam picture Sam · Jul 27, 2016 · Viewed 40.1k times · Source

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:

You are debugging a Release build of NPoco.dll. Using Just My Code with Release builds using compiler optimizations results in a degraded debugging experience (e.g. breakpoints will not be hit).

If I press Continue Debugging, everything seems to still work as usual, including breakpoints.

This problem only started happening recently.

Question

  1. Anyone know what caused the above error?
  2. Do I have something misconfigured?

Answer

Jack Zhai-MSFT picture Jack Zhai-MSFT · Jul 27, 2016

Disable this option under Debug->Options->Suppress JIT optimization on module load (Managed only).

A connect report submitted before:

https://connect.microsoft.com/VisualStudio/feedback/details/2116788/flag-optimize-is-passed-to-the-debugger-even-while-the-build-settings-optimize-code-is-not-enabled-on-mvc-c-web-projects-when-using-just-my-code.

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