Replies: 2 comments 8 replies
-
Hosting .NET Framework and .NET Core in the same process is not fully supported. Some scenarios (in particular diagnostics, like debugging) are known to be broken.
My guess is that .NET Framework exception handling takes over and does not propagate the unhandled exception to allow .NET Core to handle it. |
Beta Was this translation helpful? Give feedback.
-
@jkotas any ideas on how we can proceed with this? https://github.com/Tyrrrz/DotnetRuntimeBootstrapper is an awesome project and it would really benefit from the ability to handle that error. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
I have my own custom .NET runtime host built on top of legacy .NET framework. I'm able to run the target .NET Core app just fine.
However, I have encountered a problem where if the target app subscribes to
AppDomain.CurrentDomain.UnhandledException
and crashes with an unhandled exception, then the event is not triggered. The event is triggered as expected when running using defaultexe
apphost or from .NET CLI.Here's the code that wraps
hostfxr.dll
:https://github.com/Tyrrrz/DotnetRuntimeBootstrapper/blob/8d07097dbb1751a2322132ff1229cdbf7be4d45f/DotnetRuntimeBootstrapper.AppHost/Dotnet/DotnetHost.cs#L60-L125
Here's the implementation of
NativeLibrary.GetFunction()
:https://github.com/Tyrrrz/DotnetRuntimeBootstrapper/blob/8d07097dbb1751a2322132ff1229cdbf7be4d45f/DotnetRuntimeBootstrapper.AppHost/Native/NativeLibrary.cs?_pjax=%23js-repo-pjax-container%2C%20div%5Bitemtype%3D%22http%3A%2F%2Fschema.org%2FSoftwareSourceCode%22%5D%20main%2C%20%5Bdata-pjax-container%5D#L17-L30
Closing the host context returns
0
. As mentioned, everything else works fine besides that event handler.Hostfxr used:
C:\Program Files\dotnet\host\fxr\6.0.0\hostfxr.dll
Related issue: Tyrrrz/DotnetRuntimeBootstrapper#27
Any suggestions as to what I might be doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions