2

I have window background service to read Message queue using NServiceBus.

I want to debug this windowservice to trace the flow so have added Debugger.Launch() inside Service class when i run service its launching service in debuggermode.

But

Now i want to keep debugger at RequestDataMessageHandler.cs class which initiated when a message reaches queue.

I want to debug this class so kept Debugger.Launch() inside this class. But debugger in not launching. Handler class reads message from queue.

What will be the cause?

keaukraine
  • 5,315
  • 29
  • 54
PramodChoudhari
  • 2,503
  • 12
  • 33
  • 46
  • Have you tried a logging framework, like NLog or Log4net? They help alot when it comes to debugging servicers, and have a multiple targets to write to. IE, file, event log, database, UDP, TCP/Ip. – Jethro Jun 30 '11 at 11:29
  • On StackOverflow: [Easier way to start debugging a windows service in C#](http://stackoverflow.com/questions/125964/easier-way-to-start-debugging-a-windows-service-in-c) – sll Jun 30 '11 at 11:43
  • 1
    Well, it probably *did* work since you didn't get an exception. Problem is that it is displaying the just-in-time debugger selection dialog on the session 0 desktop. The one that the user can never get to. There's no workaround for it, you have to attach a debugger yourself from your own desktop. – Hans Passant Jun 30 '11 at 11:45

1 Answers1

0

Seems that debugger is already attached, in case of debugger is already attached Debugger.Launch() does not work. Try using Debugger.Break(), it will break if debugger is already attached or not.

crypted
  • 10,118
  • 3
  • 39
  • 52