Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?
like image 344
Sam Avatar asked Jul 26 '16 23:07

Sam


People also ask

How do I fix my code warning?

To enable or disable Just My Code in Visual Studio, under Tools > Options (or Debug > Options) > Debugging > General, select or deselect Enable Just My Code.

How do I run a release in Visual Studio?

If we build the project in “Release” mode, the GC. Collect method causes the Timer t to be collected because no variable referring to the Timer t. However, when we start the exe by clicking the “F5” button ("Release" mode), Visual Studio debugger will attach the exe process.


2 Answers

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

like image 134
Jack Zhai-MSFT Avatar answered Sep 29 '22 20:09

Jack Zhai-MSFT


"Optimize code" option is there on visual studio project level. Remove that for debug mode.

like image 41
Mahesh Malpani Avatar answered Sep 29 '22 21:09

Mahesh Malpani