473,399 Members | 3,302 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Debug.Listeners: Listener can't hear anything

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 TextWriterTraceListener(ts))
Class Tracestream is a class inherited from IO.Stream:

Public Class TraceStream
Inherits IO.Stream

Public Overrides ReadOnly Property CanRead() As Boolean
Get
Return False
End Get
End Property

Public Overrides ReadOnly Property CanWrite() As Boolean
Get
Return True
End Get
End Property

'....other overrides

Public Overrides Sub Write( _
ByVal buffer() As Byte, ByVal offset As Integer, _
ByVal count As Integer)
'...
End Sub
End Class

I expect method Write to be called whenever Debug.Writeline is called, but
this doesn't happen. CanRead and CanWrite do get called.

Do I have a problem in understanding the Listeners concept?
Armin

Jan 26 '07 #1
1 1533
"Armin Zingler" <az*******@freenet.deschrieb
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 TextWriterTraceListener(ts))

Problem solved: The Streamwriter created internally writes to a buffer
before writing to the Stream. Solution:

Dim ts As New TraceStream
Dim sw As New IO.StreamWriter(ts)

sw.AutoFlush = True
Debug.Listeners.Add(New TextWriterTraceListener(sw))

Armin

Jan 26 '07 #2

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

Similar topics

4
by: Hal Vaughan | last post by:
I've said here before that I'm self taught. I have 4 reference books, and they mention listeners and give partial examples, but not one gives me a good, clear example of setting up a listener,...
3
by: Rich Wahl | last post by:
I am writing a personal application that uses windowListeners, ActionListeners and possible ItemListeners (combo boxes). I have one of the Buttons (ActionListeners) set to have a popup...
3
by: Bill | last post by:
When vb6 Winsock.RemoteHost is set to "127.0.0.1", c# socket listener cannot hear connect request (my old vb6 winsock listener could hear it...). Why doesn't this work, and is there a work...
2
by: Andy Fish | last post by:
Hi, I am wanting to put some simple logging into my .net app. The basic features will be that errors get logged to a file and that there will be a configuration flag to enable more detailed...
1
by: Fred Mellender | last post by:
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...
0
by: martin | last post by:
Hi, I have created an asp.net application as a project, and also another project that is just a class library. My asp.net application calls a function in the class library. I am attempting to...
3
by: Richard Lewis Haggard | last post by:
I'm modifying an existing piece of code that involves a custom trace listener assembly but I simply don't understand the flow of control. How do the bits and pieces fit together that implement and...
3
by: Absolon | last post by:
Hi, Can anyone tell the advantages/dis-advantages of adding a listener to the listeners collection? In MSDN it says that listeners not in the collection do not recieve all trace output. What...
9
by: Mike | last post by:
Are there key listeners for Python? Either built in or third party?
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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...

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.