Compile-time error in generated proxy[.cs]

Latest post 06-24-2008 9:43 AM by Melody. 1 replies.
  • 06-24-2008 5:44 AM

    Compile-time error in generated proxy[.cs]

    Hello, everyone.

    I have a problem with generated by ProxyGen proxy code file. The assembly for which I created the proxy is quite simple (it contains only Program and Form classes). When I try to compile the assebly proxy library I receive 4 errors:

    Error 2 'MyTextEditor.frmMain' does not contain a definition for 'RemoteObject' and no extension method 'RemoteObject' accepting a first argument of type 'MyTextEditor.frmMain' could be found (are you missing a using directive or an assembly reference?) C:\Content\Projects & distributives\MyTextEditor\MyTextEditorProxy\proxy.cs 50 88 MyTextEditorProxy
    Error 3 'System.Windows.Forms.Form' does not contain a constructor that takes '2' arguments C:\Content\Projects & distributives\MyTextEditor\MyTextEditorProxy\proxy.cs 57 17 MyTextEditorProxy
    Error 4 'MyTextEditor.frmMain' does not contain a definition for 'RemoteObject' and no extension method 'RemoteObject' accepting a first argument of type 'MyTextEditor.frmMain' could be found (are you missing a using directive or an assembly reference?) C:\Content\Projects & distributives\MyTextEditor\MyTextEditorProxy\proxy.cs 68 22 MyTextEditorProxy
    Error 5 'MyTextEditor.frmMain' does not contain a definition for 'RemoteObject' and no extension method 'RemoteObject' accepting a first argument of type 'MyTextEditor.frmMain' could be found (are you missing a using directive or an assembly reference?) C:\Content\Projects & distributives\MyTextEditor\MyTextEditorProxy\proxy.cs 70 40 MyTextEditorProxy


    The reason of it is usage of these parts of generated proxy code:

    public partial class frmMain : global::System.Windows.Forms.Form, global::Microsoft.VisualStudio.Tools.Applications.IProxy {

    // ...

    global::System.AddIn.Contract.IContract global::Microsoft.VisualStudio.Tools.Applications.IProxy.Contract
    {
    get
    {
    return ((global::Microsoft.VisualStudio.Tools.Applications.IProxy)this.RemoteObject).Contract;
    }
    }

    // ...


    [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
    [global::System.ComponentModel.BrowsableAttribute(false)]
    public frmMain(global::System.AddIn.Contract.IContract contract, global::Microsoft.VisualStudio.Tools.Applications.TypeInfrastructureManager typeInfrastructureManager) :
    base(contract, typeInfrastructureManager)
    {
    // ...
    }


    I've found the discussion about same trouble here. But I can't see the solution still.
    Can anyone describe me how to solve it?

    p.s. Sorry for my english.
  • 06-24-2008 9:43 AM In reply to

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

    Re: Compile-time error in generated proxy[.cs]

    Igor,

    Thanks for checking out VSTA.  The problem is you are generation a proxy for a class which uses an external base class (frmMain : System.Windows.Forms.Form).  When you generated the proxy file the following warning probably came up:

    ProxyGen.exe Warning: 0 : Warning: Using an external type as a base type will on
    ly work if those types are wrapped.


    If you check out the ShapeAppBasicCSharp sample you will notice that the ApplicationForm is not exposed to ProxyGen (marked isExcluded="true" in the descriptor file).  Instead the Application class is which uses the interface System.Windows.Form.IWin32Window and holds the ApplicationForm as an internal variable which is also not exposed (isExcluded="true").

    If you would like a smaller sample which shows how to handle form with VSTA v 1 check out our EventSample.

    Please let me know if you have any more questions (and your English is excellent).
    Thanks!
    -Melody

Page 1 of 1 (2 items) | RSS
Copyright Summit Software Company, 2008. All rights reserved.