MSDN > 論壇首頁 > Visual Studio Extensibility > How to Create an Instance of the C# Expression Evaluator
發問發問
 

已答覆How to Create an Instance of the C# Expression Evaluator

  • 2009年6月25日 上午 08:58Coder2009 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    I tried

     

    Guid CSharpEEGuid = new Guid("{60F5556F-7EBC-4992-8E83-E9B49187FDE3}");

     

    Type CSharpEE = Type.GetTypeFromCLSID(CSharpEEGuid);

     

    object temp = Activator.CreateInstance(CSharpEE);

     

    var temp2 = temp as IDebugExpressionEvaluator2;

    But the GUID does not seem to be a registered COM GUID in the registry.

解答

  • 2009年7月1日 下午 05:01Ed DoreMSFT, 版主使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     已答覆

    Expression Evaluators are registered under the VS hive's AD7Metrics registry key. You've correctly identified the CLSID, but as Zhang pointed out it isn't COM creatable. You would need to use something like ILocalRegistryService.CreateInstance to create an instance of the EE.

    Even so, this isn't a supported scenario. The EE is registered so that the VS debug package can create it when needed, and it's tightly intertwined with other services like the C# project system and the debugger's debug engine.

    Sincerely,


    Ed Dore

所有回覆

  • 2009年7月1日 上午 09:15Rong-Chun ZhangMSFT, 版主使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    Hello,

    It seems that the debugger Expression Evaluator is not registered as COM visible. Why you want to create such an instance?

    You might have a look at the EESample in Visual Studio SDK.
    http://code.msdn.microsoft.com/DebuggerExpEvalDD

    Thanks,
    Rong-Chun Zhang
    Please mark the replies as answers if they help and unmark if they don't.
    Welcome to the All-In-One Code Framework, a sample code project owned by the MSDN Forum Support team!
  • 2009年7月1日 下午 05:01Ed DoreMSFT, 版主使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     已答覆

    Expression Evaluators are registered under the VS hive's AD7Metrics registry key. You've correctly identified the CLSID, but as Zhang pointed out it isn't COM creatable. You would need to use something like ILocalRegistryService.CreateInstance to create an instance of the EE.

    Even so, this isn't a supported scenario. The EE is registered so that the VS debug package can create it when needed, and it's tightly intertwined with other services like the C# project system and the debugger's debug engine.

    Sincerely,


    Ed Dore