Debug.Assert Appears in Release Mode
We all know that Debug.Assert
will not be compiled into the dlls when compiled in release mode. But for some reason Debug.Assert
did appear in the release version of a component I wrote. I suspect that I might have mess up my csproject setting.
Any idea why Debug.Assert
appears in release mode?
P/S: I have double checked to make sure that I was really compiling in release mode before asking this question.
Note 2: I've double checked my csproject, and I found that in the Release config, the Define DEBUG constant is not ticked, indicating that for this part my setting is correct.
Check the DefineConstants
property in your project file, it should be :
<DefineConstants>DEBUG;TRACE</DefineConstants>
for Debug configuration <DefineConstants>TRACE</DefineConstants>
for Release configuration Check that you haven't any #define DEBUG
in your code.
I found out the answer; it's because there is a #define DEBUG
preprocessor defined at the start of a cs file inside the project. Removing it solves the problem
Remember that "Release mode" is just a build configuration with a name of "Release". That doesn't necessarily imply anything about the compilation settings being used: it's perfectly possible to create a configuration called "Release" that actually compiles everything with debug settings. Or, in fact, doesn't compile anything at all!
The other answers suggest a few of the places to look - but basically it sounds like either your project or solution settings have reconfigured "Release" builds to include debug information.
On possibility not mentioned yet: in VS, if you drop down the build configuration combobox (where you normally select "Debug" or "Release") and select "Configuration Manager," you can see what each solution build configuration means for each of your projects. You'll note that you can, for example, configure a "Release" build on the solution to still build some components in Debug mode if you wanted to.
链接地址: http://www.djcxy.com/p/4800.html上一篇: 我如何允许在VS2010中打破'System.NullReferenceException'?
下一篇: Debug.Assert在发布模式下出现