473,511 Members | 14,393 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Bug in Debug.Listeners?

When I code:
Debug.Assert(false, "this is a message");
it works fine, and out comes the dialog box.

When I code
Trace.Listeners.Clear();
Debug.Assert(false, "this is a message");

No message is output.
In the debugger I see that clearing the Trace Listeners clears the Debug
Listeners. This is a problem since I am using the Trace Listeners for
logging and the debug listeners for debugging. Is this a bug? I am using
C# standard, MDE 2002.
Nov 15 '05 #1
1 1845
Fred Mellender wrote:
When I code:
Debug.Assert(false, "this is a message");
it works fine, and out comes the dialog box.

When I code
Trace.Listeners.Clear();
Debug.Assert(false, "this is a message");

No message is output.
In the debugger I see that clearing the Trace Listeners clears the Debug
Listeners. This is a problem since I am using the Trace Listeners for
logging and the debug listeners for debugging. Is this a bug? I am using
C# standard, MDE 2002.


I don't think MS considers this a bug - the Debug and Trace classes
share the same set of listeners. I agree with you that this should not
be the case. It's a total break of OO encapsulation.

You might want to look into the log4net logging framework.

--
mikeb

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3007
by: chris | last post by:
Hello all - Preface: This isn't a C# Builder question but if you happen to have the answer to my primary problem, please feel free to chime in ;-) I'm using Borland's C# Builder (Personal)...
0
1406
by: Pete W | last post by:
I have a console application for which I have atttemped to use TextWriterTraceListener. The app uses System.Diagnostic I want to trace or debug to Console and also to file. code in Main()...
3
7168
by: Brett | last post by:
I use the following to output to the console during debugging: catch(Exception ex) { Debug.WriteLine("Error: " + ex.Message); } Many of the times on the console, the above is appended on the...
3
21057
by: Frank Rizzo | last post by:
Is there anyway to transparently redirect the output of the Debug.WriteLine statement from the Debug window to something else such as a console or a file? Thanks
4
718
by: A.M | last post by:
Hi, If I use System.Diagnostics.Debug.WriteLine in a asp.net application, where does the output go? Is there any trace monitor application thar shows me the trace output? Thanks, Allan
7
18778
by: Thomas Pecha | last post by:
Sorry for all who think this is easy, I was not able to handle this Coming from VB6 where with simple debug.print strAString you could write to debug window, I am totalling failing in vb.net...
1
1160
by: Brian Henry | last post by:
Is there an easy way to make a copy of all the debug.writeline stuff go to a log file also? thanks!
5
3373
by: Billy | last post by:
Hi! How can I override "Debug.Writeline("Message")" so that will not show that msg in Debug window, but wrote it to a file. I already have a code to write to a file but I would like to use just...
1
1539
by: Armin Zingler | last post by:
Hi, I add a TraceListener to Debug.Listeners. After that I use Debug.writeline. Problem: Nothing arrives at the listener. Code: Dim ts As New TraceStream Debug.Listeners.Add(New...
0
7148
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7430
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7089
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5072
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3217
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
790
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
451
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.