Search code examples
c#com.net-assemblymscorlib

Type.GetTypeFromCLSID() returns not COM Wrapper


Trying to get System.__Comobject from Type.GetTypeFromCLSID(GUID), but instead it gives me right class, and also loads file assembly of him.

In other projects, this code correctly gets System.__ComObject, I don`t really know what forces it to load right assembly.

Guid clsid = Guid.Parse(guid);
Type type = Type.GetTypeFromCLSID(clsid);

Solution

  • Problem solved. The next line in App.config created this problem

      <startup useLegacyV2RuntimeActivationPolicy="true"> 
    

    Still don`t know why this line can impact, i would to like to hear any explanation.