Debugging an exe that crashes without raising AppDomain.UnhandledException

1

I have an exe that works properly in Visual Studio. When I deploy it to Windows Server, it crashes -- even though I am trying to catch its unhandled exceptions, as shown in the code below. The code DOES catch unhandled exceptions as expected in VS (i.e. it displays the exception object in a msg box). When the code crashes on the server, it offers me the chance to 'debug' the code in Visual Studio, providing the readout shown below.

  1. Why is my exception handler not displaying a msg box?
  2. How do I interpret this crash readout?
Sub Main(ByVal args() As String)

    AddHandler AppDomain.CurrentDomain.UnhandledException, AddressOf errorReporter

    Dim myProcess As AutomatedProcessVB = New AutomatedProcessVB("Laphie")

    myProcess.run()

End Sub

Private Sub errorReporter(sender As Object, e As System.UnhandledExceptionEventArgs)
    MsgBox(e.ExceptionObject.ToString)
    Environment.Exit(3)
End Sub

Here is the output when the program crashes:

'AutoMatcher.exe': Loaded 'D:\Executables\AutoMatcher.exe', No native symbols in symbol file.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\ntdll.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\kernel32.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\sysfer.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\mscoree.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\advapi32.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\rpcrt4.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscoreei.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\shlwapi.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\gdi32.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\user32.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\msvcrt.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\imm32.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\msctf.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\lpk.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\usp10.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.6002.18305_none_5cb72f2a088b0ed3\comctl32.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\msvcr100_clr0400.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\16126cae96ea2422253ae06eeb672abc\mscorlib.ni.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\ole32.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Culture.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\nlssorting.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\clrjit.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\rsaenh.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\System\811a7bc79f8f0a5be8065292a320819e\System.ni.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Core\752225ca2585aa8f1c46b489e172e920\System.Core.ni.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Data.Linq\df6307904c34b42871857eb60ceb338f\System.Data.Linq.ni.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\Microsoft.VisualBas#\da70ab23582f4ebf61a2d551a390afcf\Microsoft.VisualBasic.ni.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Drawing\9422d0c052186760a4645e10995487f5\System.Drawing.ni.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Windows.Forms\caffbced23ee85b40b919ad4a122b7aa\System.Windows.Forms.ni.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.6002.18305_none_88f3a38569c2c436\comctl32.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Configuration\ed886fb71addf400705481dcf8de12da\System.Configuration.ni.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Xml\cb0c00757e89f0b1fe282913ed667212\System.Xml.ni.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\urlmon.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\oleaut32.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\iertutil.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\ntmarta.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\Wldap32.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\ws2_32.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\nsi.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\psapi.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\samlib.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\version.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\secur32.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\shell32.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\shfolder.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Data\90f1acbd79e2a5fabfb8c516d6be36a3\System.Data.ni.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\Microsoft.NET\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\crypt32.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\msasn1.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\userenv.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Transactions\102cfe160aeb1e16a35890004a421ec9\System.Transactions.ni.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\Microsoft.NET\assembly\GAC_32\System.Transactions\v4.0_4.0.0.0__b77a5c561934e089\System.Transactions.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\System.EnterpriseSe#\6fc86a3e1d07ea824cd49b0c0b19d2f5\System.EnterpriseServices.ni.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\assembly\NativeImages_v4.0.30319_32\System.EnterpriseSe#\6fc86a3e1d07ea824cd49b0c0b19d2f5\System.EnterpriseServices.Wrapper.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\Microsoft.NET\assembly\GAC_32\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.Wrapper.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\security.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\credssp.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\schannel.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\netapi32.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\PwdSSP.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\kerberos.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\cryptdll.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\msv1_0.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\ntdsapi.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\dnsapi.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\mswsock.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\WSHTCPIP.DLL', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\wship6.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\nlaapi.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\IPHLPAPI.DLL', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\dhcpcsvc.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\winnsi.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\dhcpcsvc6.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\NapiNSP.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\winrnr.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\rasadhlp.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\dssenh.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\ncrypt.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\bcrypt.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\diasymreader.dll', No symbols loaded.
'AutoMatcher.exe': Loaded 'C:\Windows\System32\apphelp.dll', No symbols loaded.
The thread 'Win32 Thread' (0x2d70) has exited with code 0 (0x0).
Unhandled exception at 0x7719fc56 in AutoMatcher.exe: 0xE0434352: 0xe0434352.
The thread 'Win32 Thread' (0x808) has exited with code -2146233082 (0x80131506).
The thread 'Win32 Thread' (0x2a94) has exited with code -2146233082 (0x80131506).
The thread 'Win32 Thread' (0x1d14) has exited with code -2146233082 (0x80131506).
The thread 'Win32 Thread' (0x1ea4) has exited with code -2146233082 (0x80131506).
The thread 'Win32 Thread' (0x221c) has exited with code -2146233082 (0x80131506).
The program '[9572] AutoMatcher.exe: Native' has exited with code -2146233082 (0x80131506).
.net
windows
asked on Stack Overflow Dec 11, 2012 by bernie2436 • edited Oct 5, 2016 by Mark Hurd

1 Answer

1

a try-catch block encircling the whole program catches all errors and writes them to a file

That is a troubling choice. If the program has any problem creating the file then surely it will also have trouble creating the log file to report the error. So you don't see the error either. At least use Console.WriteLine() as well.

A typical cause of a problem like this is that you created the file without specifying the full path name of the file. So you'll critically depend on the program's default directory being set correctly. Which won't be the same when launched from the desktop vs started from a command line prompt. And do beware that there are few places you can write to without UAC elevation. Always specify the full pathname of the file, use Environment.GetFolderPath() to find a writable directory.

answered on Stack Overflow Dec 11, 2012 by Hans Passant

User contributions licensed under CC BY-SA 3.0