Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
478 views
in Technique[技术] by (71.8m points)

c# - Debug.Writeline is Not printing anything

VS 2010 Pro, C#, WinForms: at the very beginning of my method I am saying Debug.Writeline("entering method blah"); then somewhere inside this method I am putting some breakpoints and run the program. so I see that execution is stopped at those break points, so it is here! but if I search the Output->Debug combobox mode and also Immediate window I cannot find the message I has written for Debug.Writeline anywhere.

I also tried that heck box setting in Debug options that says "Redirect all output to Immediate window"....did not help either.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Discussed already in the comments, but I wasn't sure until discussing it there. However:

  • calls to Debug.Whatever(...) are typically marked with [Conditional("DEBUG")], meaning they require the DEBUG symbol to be defined, otherwise those calls are not compiled
  • a default project has DEBUG and TRACE defined for the "Debug" profile, and TRACE for the "Release" profile
  • however, you can disable the DEBUG symbol via a checkbox in "project properties"

So; go to project-properties, and ensure the DEBUG symbol is defined (or not) as appropriate for your needs (for any-and-all profiles that exist in your project).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...