Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debug.Write not working

Tags:

For some reason, the Debug class suddenly stopped working for me.

public void WhyDebugIsNotWorking() {      Debug.Write("Why am I not working !!!!!!"); } 

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!

like image 984
Sheraz Avatar asked Dec 03 '10 14:12

Sheraz


People also ask

Where does Debug write go?

Debug. WriteLine will display in the output window ( Ctrl + Alt + O ), you can also add a TraceListener to the Debug.

What is Debug WriteLine in C#?

WriteLine(String)Writes a message followed by a line terminator to the trace listeners in the Listeners collection. public: static void WriteLine(System::String ^ message); C# Copy. [System.Diagnostics.Conditional("DEBUG")] public static void WriteLine (string message); C# Copy.

How do I activate just my code?

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 view console WriteLine output in Visual Studio 2022?

In Visual Studio uppermost menu choose Debug > Windows > Output. It shows all Console. WriteLine("Debug MyVariable: " + MyVariable) when you get to them.


1 Answers

You did not set the DEBUG variable in your build configuration. (there is a checkbox to set "Define DEBUG constant")

like image 194
Stefan Steinegger Avatar answered Sep 22 '22 19:09

Stefan Steinegger