RE: Calling System.Diagnostics.Trace.WriteLine from a Windows Serv

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Dale,

Thanks for taking the time to respond. It is not extensibility to Visual
Studio that I am looking for. There is a program (downloadable from
Microsoft) called DebugView that was written by Systernals (I think). It is a
registered Trace Listener and it listens quite well I might add, to
System.Diagnostic.Trace.WriteLine. When I send messages to the Trace Listen
from within a Release build of my GUI application I see the messages in the
DebugView application. When I send the messages from an exe that is running
as a Windows Service, I do not. As I mentioned before, I know the code to
write to System.Diagnostic.Trace.WriteLine is getting executed because I also
write to the Event Log from the service just prior to the call to
System.Diagnostic.Trace.WriteLine.

My question is: Is it possible to write to the Trace Listener from
within a Windows Service application? And, if it is - what am doing wrong, or
not at leaset not doing right.

Again, thanks,
Mike

"Dale" wrote:

Trace.WriteLine writes to registered Trace.Listeners - to all registered
Trace.Listeners, in fact, but not to the IDE as the old VB6 and before
Trace.Write command whose functionality you may be looking for.

What you need is a Trace.Listener that will write to the currently debugging
Visual Studio instance. If one exists for download, etc., I am not aware of
it but you could probably write one that will do it by automating Visual
Studio.

Writing trace listeners is covered pretty well in the framework
documentation. There's a newsgroup for Visual Studio extensibility where you
can find some links to pretty good extensibility sites. Here's one I found
there recently that was a great starting off point on extensibility for me:

http://mztools.com/resources_vsnet_addins.htm

HTH

Dale
--
Dale Preston
MCAD C#
MCSE, MCDBA


"Michael Evenson" wrote:

I need to send meesages to DebugView from within an application that is
written as a Windows Services. I put the calls to
System.Diagnostics.Trace.WriteLine () in my code, and I know I'm executing
the line because at the same time I am also writing the message to the Event
Log and I see the messages there. They do not however show up in the
DebugView window.

Can this even be done or am I just smokin' crack?

Mike

.