In a library I've helper functions that get an active application instance using Marshal.GetActiveObject. Problem is when I'm debugging with visual studio it breaks on/throws the following exception:
An exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll and wasn't handled before a managed/native boundary
Additional information: Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE))
It would be expected if I did not handle the exception but in the library the exception is caught in a try...catch.
I enabled "Enable Just My Code" but it does not change anything.
So I looked for "System.Runtime.InteropServices.COMException" but "Thrown" is already disabled. Same for "User-unhandled".
Additionnal information:
Is there another option to look for or do I have a corrupted visual studio and I should reset all IDE + plugins?
Thank you.
Edit: Code
In Library A (which is an API of an external software): Definition of IApplication
In Library B (mine) :
public static bool TryGetRuntime(out IApplication app)
{
try
{
app = Marshal.GetActiveObject("TheApplicationId") as IApplication;
}
catch (COMException)
{
app = null;
}
return app != null;
}
In App C:
IApplication app;
if (HelperClass.TryGetRuntime(out app)) {
//do some work
}
User contributions licensed under CC BY-SA 3.0