clr20r3 error

Ran into this error recently on the system that I moved. My problem was that the program was running under a different user account which didn’t have the needed Adobe InDesign PDF export presets loaded. When my app tried to export a PDF (with no error handling) the system threw an UnhandledException and crashed to desktop with nothing but crap in the event log. To help diagnose the problem I added an UnhandledException handler (sounds weird, I know) that gave me a nice stack trace. I ran it with the debug version so I got line numbers, too. You can add an UnhandledException handler like so:

    Sub UnhandledException(ByVal sender As Object, ByVal e As UnhandledExceptionEventArgs)
        If e.IsTerminating Then
            Dim o As Object = e.ExceptionObject
        End If
    End Sub
    Public Sub New()
        AddHandler AppDomain.CurrentDomain.UnhandledException, AddressOf UnhandledException
    End Sub