I have a strange issue with my C# UWP-Win10 app. When I re-size the window often or clicking a random button often (>3 times), I'm getting the error:
An unhandled win32 exception occurred in bla.exe [bla-id]
After closing this window the app crashes and in the output-window I get:
The program '[bla-id] bla.exe' has exited with code -1073741811 (0xc000000d).
No more information from Visual Studio. I'm using the serial-port in this app and I've noticed that this error occurs only when I'm connected to the device. But: I've added an empty button (without a Click-handler) and the same error occurs on this button.
Additionally I've looked in the eventviewer and saw the crashed-module:
ntdll.dll (offset 0x00000000000f5670)
How can I trace down the issue? I'm not using external APIs or something else.
After a while (two weeks) of testing and debugging I've found the issue: The garbage collector is closing the serialport inputstream and thus the DataReader (which is reading the serialport) dies instantly and throws this unspecified exception. Basically this was an issue with the datareaader not disposing correctly in code. "Mystery" solved.
I know this post is three years old, but I found it when I was searching for a solution to this exact same problem, and maybe my experience can help the next person who stumbles upon it.
After reading the OP's response to his own question, I started investigating garbage collection, object disposal, and etc. I found that if my DataReader and DataWriter objects were global in scope, then they were at risk of being garbage collected mid-use. What worked for me was to locally scope those objects every time I needed them, with a using(DataWriter dw = new DataWriter(EventHandlerForDevice.Current.Device.OutputStream)) { ... }
block, or similar for the DataReader object. Since implementing them like this, I haven't had any of the win32 exceptions whatsoever. Hope this helps!