Visual studio throws exception even when "thrown" is disabled for the exception

1

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))

enter image description here

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:

  • Visual studio 12.0.40629 Update 5
  • ReSharper 2016.3

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
}
visual-studio
visual-studio-2013
asked on Stack Overflow Apr 3, 2017 by nkoniishvt • edited Apr 3, 2017 by nkoniishvt

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0