Closed bartico6 closed 4 years ago
It would seem I have accidentally modified the wrapper, or had some wrong dependencies running as the issue seems to have resolved itself after a full rollback of the project data to start. No idea why. Sorry for bothering you.
App information:
Expected behaviour: InputText() w/ flag "CallbackXXX" fires the callback w/o errors
Actual behaviour: InputText() w/ any "CallbackXXX" flag fires the callback a random number of times correctly, then an AccessViolationException occurs in the CLR, killing the application w/o any exceptions in the console. Debugging the entire stack at once reveals the culprit:
This error occurs in the stock Demo App (XNA) too, albeit after a much longer time, and also seemingly at random. Comparing the two environments it would seem it may have something to do with GC's actions, as Terraria is relatively reckless with allocations, but I've been unsuccessful determining what it could be exactly.
The ImGui UI code causing the error:
The console log of the client
This is followed by an exception being thrown. If we
Continue
through it, the application closes without any console errors.There is no exception in the console. The app exits with a negative exit code.
There is no issue with the memory persistence of the referenced callback. It's a method inside a class instance that's kept in memory (referenced in the client singleton that's in active use) throughout the app's entire lifetime, so it isn't being disposed or otherwise removed from memory.
It is worth noting that VS hints at marshaling errors or P/Invoke errors if we step through the first exception:
Any and all help is appreciated. I'm not too good with low-level debugging so I struggle to see what could be wrong here. I think it could be some of the parameters being relocated mid-execution (after all, it fails after a random number of invocations, so it must be a desynchronised factor causing it) due to insufficient pinning through the
fixed
statement.