Uncaught Exception C++ hostfxr Handling
Hi I have a C++ dll that I am using to host some dotnet assembly and normally things work but when something bad happens, like a missing reference assembly, it fails with an uncaught exception. Now I know the code I have is wrong but what I am hoping to figure out is how to get the exception details. I can use dotnet-dump to dump the process, then dotnet-analyse to then select the proper thread and then
I've tried to wrap the function ptr in a try/catch with various exception types as well as just
But no matter what I try to catch it with, the debugger always displays uncaught exception without any way to get those exception details, e.g.
I've then tried to hook up my own handler for
I've tried to wrap the C# code it's calling in just a generic
Does anyone have any suggestions or hints as to what I could potentially try.
pe -lines to get the exception information but I am hoping to just get that as part of the hosting code and log that somewhere in a file.I've tried to wrap the function ptr in a try/catch with various exception types as well as just
But no matter what I try to catch it with, the debugger always displays uncaught exception without any way to get those exception details, e.g.
Exception has occurred: W32/0xE0434352
Unhandled exception at 0x00007FF8EC62FF6C (KernelBase.dll) in notepad.exe: 0xE0434352 (parameters: 0xFFFFFFFF80070002, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x00007FF8A1AF0000).
I've then tried to hook up my own handler for
hostfxr_set_error_writer that calls a simple function like the below but it is never calledI've tried to wrap the C# code it's calling in just a generic
try { } catch {} as well as AppDomain.CurrentDomain.UnhandledException to try and see if I can just catch the exception to handle accordingly but none of it works.Does anyone have any suggestions or hints as to what I could potentially try.
