7

I have a .Net 2.0 WinForms app that I'm trying to use as a logon screensaver (64-bit Win7Pro). It runs just fine from the command line when I'm logged in and as my screensaver. However, it exits immediately when run as a logon screensaver.

I know it's getting a CLR exception because its exit code is 0xE0434F4D, but I can't figure out how to debug it.

Is there any way to debug a logon screensaver in Win7?

Gabe
  • 84,912
  • 12
  • 139
  • 238
  • Did you try getting a [WER localdump](http://msdn.microsoft.com/en-us/library/windows/desktop/bb787181%28v=vs.85%29.aspx)? Use DumpType=2 for .NET. – Thomas Weller May 14 '14 at 20:55
  • @ThomasW.: I was looking for a way to do interactive debugging, not post-mortem. – Gabe May 15 '14 at 02:47

2 Answers2

0

You may be able to debug by attaching to the process from a remote computer through Visual Studio.

However, there may be a simpler solution. WinForms applications have a Program class. If you put a Try--Catch phrase around the code in the Program class that starts your Form, then when the application crashes you can log the Exception with full stacktrace. From there you should be able to more readily determine the problem (which my guess would be privilege related) and correct it.

Russ
  • 4,091
  • 21
  • 32
  • How do you attach to a remote computer through VS? Doesn't VS have to run on the machine running the screensaver? If so, how do you get VS running without logging in? – Gabe Dec 13 '11 at 19:22
  • Be sure "The Microsoft Visual Studio Remote Debugging Monitor" is installed and running on the remote pc you need to debug (see http://msdn.microsoft.com/en-us/library/xf8k2h6a.aspx for details). Under Debug of Visual Studio, select "Attach to process...". Set your Transport to "Remote (Native only with no authentication)" and set "Qualifier" to the name of the pc you need to debug. The problem is that your screensaver appears to exit immediately. By the time you got your debugging session set up to attach to the screensaver process, it will be long gone. Logging may be your only option. – Russ Dec 14 '11 at 20:15
0

If you want to debug the logon screen, you'll need a kernel debugger attached.

msvsmon and the rest won't run from the logon screen as there's no user session (since you haven't logged in yet).

Debugging CLR from the kernel debugger will be interesting; it's possible to get some basic CLR debugging going from windbg, but it won't be simple.

You might just create a log file (or use Event Tracing for Windows, which avoids a ton of security issues) to track down the failure.

Eric Brown
  • 13,774
  • 7
  • 30
  • 71