How do you handle RuntimeException in Windows x64 builds?

Everything works as expected on macOS and with 32bit builds on Windows, but with 64bit builds for Windows the error.Stack elements look like nothing and are of no use.

Take the following example:

  1. Create a new project
  2. Add “UnhandledException” event handler in App with this content
Function UnhandledException(error As RuntimeException) Handles UnhandledException as Boolean
  Dim s,type As String
  
  If error <> Nil Then
    s= Introspection.GetType(error).Name
    type=Join(error.Stack, EndOfLine)
  End If
  
  msgbox("App UnhandledException :"+s+EndOfLine+EndOfLine+type)
  Return True
End Function
  1. Add a DesktopButton on Window1
  2. Add “Pressed” event handler in Button1 with this content to generate a NOE
Sub Pressed() Handles Pressed
  var dic As Dictionary
  dic.Value("test")=0
End Sub
  1. Build for Windows in x86 32-bit and x86 64-bit and try to press the Button1

The 32bit version displays the exception correctly
Win32

while the 64bit version is useless.

Xojo 2022R4.1

I must have missed something, but what?
How can I trace the origin of an unhandled exception with x64 builds for Windows?

Thanks and Happy Holidays to all

3 Likes

I am struggling with this issue as well.

Hopefully we find a good solution.

Thanks for the tip about 32 bit builds though.

Does it look like that in the debugger. I don’t recall an issue in there tracing the location in there.

Well that explains why so many of my exception reports are completely useless.

4 Likes

Not to mention any exception occurring in a modal dialog. The stack trace ends with the ShowModal call. All platforms, starting a few releases ago. Most annoying.

1 Like

function names are included for 64-bit build?

Yes, the “Include Function names” option is active, if you deactivate it the result is however the same.

1 Like

You are right Ian, I just did a test on Windows11 (I normally work on Mac for builds) and in Debug mode the information is correct.

There doesn’t seem to be a workaround.
I created a new issue for this problem 71308

64Bit Build

64Bit Debug

2 Likes

Thanks for creating the issue.

The issue was solved by William Yu:

Perhaps a workaround for now is to enable PDB. You don’t need to include the PDB file in your final build either.

Screen_Shot_2023-01-11_at_4.12.25_PM

That is sadly not the solution.
That is just a workaround.
So I would appreciate if you could open the issue again.

We need the function names to be included independently of the PDB file.

2 Likes

ok, done