You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've got a native app that calls a .NET 6 assembly via a generated .comhost.dll using COM. The .NET 6 assembly call blocks on Socket.Receive.
When the OS is shutting down, the Socket.Receive throws native exception internally (code 0xE0434352) that isn't wrapped into a .NET Exception by the runtime but the native exception is propagated back into my native code, instead of being translated into an HRESULT.
This results in Windows reporting my service as crashed (Informational APPCRASH entry in the Event Viewer).
Is this expected and documented? I would expect the call to return a FAILED(HRESULT) instead which is what happens if a Socket.Receive error occurs while not shutting down the OS.
I know closing the Socket in a response to SERVICE_CONTROL_PRESHUTDOWN fixes this but I'm looking for some documentation when to expect COM calls into managed assemblies to raise exceptions instead of returning an HRESULT.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've got a native app that calls a .NET 6 assembly via a generated .comhost.dll using COM. The .NET 6 assembly call blocks on Socket.Receive.
When the OS is shutting down, the Socket.Receive throws native exception internally (code 0xE0434352) that isn't wrapped into a .NET Exception by the runtime but the native exception is propagated back into my native code, instead of being translated into an HRESULT.
This results in Windows reporting my service as crashed (Informational APPCRASH entry in the Event Viewer).
Is this expected and documented? I would expect the call to return a FAILED(HRESULT) instead which is what happens if a Socket.Receive error occurs while not shutting down the OS.
I know closing the Socket in a response to SERVICE_CONTROL_PRESHUTDOWN fixes this but I'm looking for some documentation when to expect COM calls into managed assemblies to raise exceptions instead of returning an HRESULT.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions