Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.Diagnostics Debug Class Missing? [closed]

I'm trying to write some debug output to the output window using System.Diagnostics.Debug.WriteLine(). AFAIK, the only requirement to be able to use the System.Diagnostics class is to add the System namespace (which is there by default). I have one project where I can use the Debug class, as shown below:

With Debug

But my current project doesn't show the debug class and I'm confused:

Debug Missing

Suggestions?

EDIT: This was the problem - I initially added my external class file as a 'Solution Item' and it placed it to the top of the solution in a folder. When the program didn't compile because my reference on Form1 to the namespace failed, I simply dragged the class file from the solution folder to the program folder (for lack of a better description). It was this duplication and versioning mismatch that was my problem. As soon as I removed the reference to the 'Solution Item', my breakpoints were working again and the System.Diagnostics.Debug class was available in my class file.

Debug Class Issue Fixed

like image 535
spickles Avatar asked Oct 31 '25 14:10

spickles


1 Answers

The Debug class is supported in all profiles and version of the .Net framework. The most likely cause of this not showing up in Intellisense are ...

  1. Missing reference to System.dll where Debug lives
  2. Intellisense bug (possible, but unlikely here)

The most likely cause is #1. Can you make sure you have the appropriate reference?

like image 136
JaredPar Avatar answered Nov 02 '25 05:11

JaredPar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!