ProxyGen v 1 Issues addressed in ProxyGen v 2 CTP Release

  • 12-12-2007 2:25 PM In reply to

    • Melody
    • Top 10 Contributor
    • Joined on 04-26-2007
    • Syracuse, NY
    • Posts 219

    Re: ProxyGen v 1 Issues addressed in ProxyGen v 2 CTP Release

    Henrik,

    Static methods and properties are fully supported in version 2 with no post processing for the proxy files.  The confustion came from the SDK section "Proxies for Managed Assemblies" which incorrectly states that static types and memebers are not supported.  This contradiction has been reported and will be corrected.  The SDK section "Architecture of Generated Proxy Code" contains the correct information on how proxies are handled.  I have updated the suppliement to reflect this information and am including the main changes below.

    IV.      How the Proxy file works

     

    ProxyGen v 2 creates much different proxies than were generated by ProxyGen v 1.  In ProxyGen v 2 each exposed class from the host application has one or two (if the class is and add-in entry point) corresponding classes in the proxy layer.  Along with these two types of classes is one additional class, the ProxyServices.Helper class which is used by static methods.

     

    The first corresponding class has the same name as the class in the host application and contains non-implemented properties and methods for non-static and non-constructor methods in the host application.  Static methods and properties in the host class are fully implemented here, and available to add-ins through this class.  Constructors found in the proxy are for internal use only (proxies do not support the “new” operator).  Calls to the non-implemented methods should resolve themselves prior to the reaching the NotImplementedException in the non-implemented methods. 

     

    The second corresponding class is for add-in entry points and has the same name as the class in the host application appended with “EntryPoint”.  These classes contain code to allow communication between the add-in and host and for are fully implemented.  These implemented methods are similar to the methods produced by ProxyGen v 1.  Static methods and properties are not included in these entry point classes; instead, they are resolved using the first corresponding class and the ProxyServices.Helper class.

     

     

    IX.3           Static Properties and Methods 

     

    Static properties and methods appear in the descriptor file with the property isStatic=”true”.  Non-static properties and methods do not have this property in the descriptor file.  Static properties and methods are implemented in the proxy in the corresponding non-entry point classes and use the ProxyServices.Helper class to communicate remotely with the host.  If the class containing the static properties and methods is an add-in entry point, the static properties and methods are not carried over to the corresponding entry point class in the proxy file.  Static methods and properties must be accessed only in reference to the containing class, not to a specific instance of the class. 

     

    For example, in the ShapeAppBasicCSharp sample, the Application class has the static property MinShapeSize and static method CreateSize.  For an application level add-in to set the MinShapeSize the calls must be made through the class, not through the “this” instance of the class.

     

    Correct:

    Microsoft.VisualStudio.Tools.Applications.Samples.ShapeApp.Application.MinShapeSize = Microsoft.VisualStudio.Tools.Applications.Samples.ShapeApp.Application.CreateSize(100, 100);

     

    Incorrect:

    this.MinShapeSize = this.CreateSize(100, 100);

Copyright Summit Software Company, 2008. All rights reserved.