Search code examples
c#vb.netmarshalling

.NET Further investigate NotMarshalable MDA error


I am getting the "NotMarshalable recognized" error in my VB.NET application:

"A COM component which can not be marshaled is being using from a differrent apartement / context than the other it entered the CLR from. Because it can not be marshaled, it is correctly directly by the current apartement / context. This may lead to data loss."

The IDE stop in this line and offer "Get more information about MDAs" (which takes me to a website that explains MDAs). I have read through the website, but I did not find any information that help me explain which COM component is causing this error.

I can't read assembler, but I guess that all that I have here, right? ->

enter image description here

Can somebody tell me how to track down which COM component is causing this error and why? I have around 20 COM objects in my large project, and I can not rewrite all of them so quickly in .NET.

Thank you!


Solution

  • this is what I would try to do:

    1. setup visual studio to stop on any exception
    2. check what code is doing when the exception happen
    3. check how the stack looks-like when the exception happen
    4. use some .net decompiler to check what is happening inside the .net function that called the COM compenent
    5. check the parameter of the function (by looking at the stack in VS) to try to understand which is the COM component
    6. google any information found