Windows 10 Crash Using AddHandler 64bit app

I have an app which runs great on windows as a 32bit app but I cannot stop it crashing on 64bit compiles with Xojo 2018r1.1 and 2017r2.1.
The problem is relating to event handling of my own classes. If I subclass and add an event handler using the ide there is no crash.
If I use:

AddHandler pWorkingWithImages.clicked, WeakAddressOf Handler_ClickedMode

or

AddHandler pWorkingWithImages.clicked, AddressOf Handler_ClickedMode

it will crash out after exiting the function Handler_ClickedMode().

Running through the IDE shows no stack trace in MainThread other than Handler_ClickedMode, which is probably why it crashes out on the exit of the function.

Looking at event viewer the 2018r1.1 compile crash shows this in the report

Faulting application name: ProSelectGui2.exe, version: 1.0.0.0, time stamp: 0x00000000 Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000 Exception code: 0xc0000005 Fault offset: 0x0000000000000011 Faulting process id: 0x252c Faulting application start time: 0x01d41e33292d17f9 Faulting application path: C:\\Users\\Graham Busch\\Desktop\\ProSelectGui 2017\\ProSelectGui2.exe Faulting module path: unknown Report Id: 38715054-3f6f-4a78-a3b6-77c9372d6904 Faulting package full name: Faulting package-relative application ID:

While Xojo 2017r2.1 compile shows this

Faulting application name: ProSelectGui2.exe, version: 1.0.0.0, time stamp: 0x00000000 Faulting module name: ntdll.dll, version: 10.0.17134.165, time stamp: 0xf4df6dc2 Exception code: 0xc0000005 Fault offset: 0x00000000000068fc Faulting process id: 0x758 Faulting application start time: 0x01d41ecb2ac27579 Faulting application path: C:\\Users\\Graham Busch\\Desktop\\ProSelectGui 2017\\ProSelectGui2.exe Faulting module path: C:\\WINDOWS\\SYSTEM32\ tdll.dll Report Id: d09bfc86-6275-4d57-8245-89a2960a8c6c Faulting package full name: Faulting package-relative application ID:

The 2018r1.1 IDE crashes on every second or third debug compile with this report.

Faulting application name: Xojo.EXE, version: 18.1.1.40774, time stamp: 0x00000000 Faulting module name: XojoGUIFramework64.dll, version: 18.1.1.40762, time stamp: 0x5ada0c28 Exception code: 0xc0000005 Fault offset: 0x00000000000e9dfd Faulting process id: 0x205c Faulting application start time: 0x01d41ec53c643ba7 Faulting application path: C:\\Program Files\\Xojo\\Xojo 2018r1.1\\Xojo.EXE Faulting module path: C:\\Program Files\\Xojo\\Xojo 2018r1.1\\XojoGUIFramework64.dll Report Id: e192b482-42e6-45df-8afa-b72076c893ad Faulting package full name: Faulting package-relative application ID:

Is Windows 64bit ready yet or should I be holding off for future releases?

I think we need more information. I can tell you that we use AddHandler all over the place without issue.

Not sure how to explain it.
I have a subclassed canvas which I ask a class to fire off a “clicked” event on mouse up.
Another class has pointers to multiple classes which consume the clicked events, so instead of subclassing each one I add the handler to the event when I create those classes. If I put a breakpoint on the mouse up event in the canvas and step through the IDE or app will crash somewhere through the stack track. If I put a breakpoint in the method handling the click event then as soon as it goes out of that function (returns a result or calls a classes method) it will crash.

If I update the class consuming the click event to use a delegate I no longer have the crashing problems.

I cannot replicate in a test app, there must be something else going on to cause the crash but this is how I can trigger it.

I have had no problems with this on the macOS version, just windows 64 bit.

I suspect not but do you have any structures or use windows declares anywhere?

Do you have any code that comes in/out for Windows 64bit only?

What type of machine are you testing the 64bit version on? A physical machine or a VM?

No windows declares, no win64 conditional compiles.
Testing on Surface Pro 4

I do have a couple of simple structures.

Give this a try, I don’t know if it will do anything as I don’t really know the route cause of the problem at the moment.

Before you first use a structure put this on the line before:

Dim mb As New MemoryBlock(64)

where 64 is the size of the structure (remember to use the 64bit size), and see if that alleviates the crashes.

It might work, it might not, but personally I wouldn’t be using 64bit at the moment in Windows.

<https://xojo.com/issue/52211>
<https://xojo.com/issue/51124>