If you Google "Attach to Process is greyed out" as I have, all the responses will tell you to make sure you check the boxes "Show processs from all users" and "Show processs in all sessions".
What if you do that and it's still greyed out?
Answer: Use a different approach. Add the line
System.Diagnostics.Debugger.Launch();
to your code and it will launch the dialog box which allows you to connect to a new Visual Studio session or an existing one.
Once you do so, the debugger will stop at the line you just added and allow you to step through the code.
Tip: If you are using a timer in your windows service then disable the timer before you call the debugger. That way you stop the timer from kicking you back to the start every time it fires.
For example:
timer1.Dispose();
System.Diagnostics.Debugger.Launch();
No comments:
Post a Comment