问题
In "MDbg Sample.zip" projects, invoke the function from COM Module as: [ComImport, Guid("3D6F5F61-7538-11D3-8D5B-00104B35E7EF"), InterfaceType((short) 1)] public interface ICorDebug { ... } The question is where to find the Guid("3D6F5F61-7538-11D3-8D5B-00104B35E7EF"), i can not find it in the regedit, but how to connect the ICoreDebug interface with the COM module?
回答1:
It's not in the registry. That guid is the IID, ICorDebug doesn't support remote access so there is no reason to register a stub/proxy against the interface.
How you get an instance depends on what versions of the runtime are installed, but these days "everyone" has CLRv4 installed, so you access via the ICLRMetaHost.
- Use CLRCreateInstance to get an implementation of ICLRMetaHost
- Use ICLRMetaHost to find the ICLRRuntimeInfo for the desired version of the runtime.
- Use ICLRRuntimeInfo.GetInterface to request an implementation of ICorDebug using CLSID_CLRDebuggingLegacy.
来源:https://stackoverflow.com/questions/40908763/how-to-invoke-icordebug