For some reason, the Debug
class suddenly stopped working for me.
public void WhyDebugIsNotWorking()
{
Debug.Write("Why am I not workin开发者_如何转开发g !!!!!!");
}
On the above line, Debug.Write
gets dim (I think Resharper is dimming it) and when I put the cursor on it, it says:
Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is a partial method without implementation.
None of the above conditions are true in my case. As you can see it's a very simple case. I'm not able to use Debug class at all. Please help!
You did not set the DEBUG variable in your build configuration. (there is a checkbox to set "Define DEBUG constant")
My guess is that you've changed the build configuration to "Release". That means the DEBUG preprocessor symbol won't be defined, so all calls to members of the Debug class (which are all conditionalized on the DEBUG preprocessor symbol) will be omitted.
Are you compiling for debug or release?
See .NET Compiler -- DEBUG vs. RELEASE
I had the same problem when the project was set to build in DEBUG. The solution was to check Project Properties\Build\Define Debug Constant check box.
You have not defined the DEBUG symbol. Look into your project settings to change that. If you are building on Release configuration, DEBUG is usually not defined. For the Build configuration Debug, it is by default defined.
精彩评论