none
Proxy objects -- What were they thinking?

    Question

  • Either I am doing something completely wrong, or the VSTO team took a big step backwards with the RTM Release.

    I have a project that I created in VSTO Beta2.  Like everyone else I grumbled about all the COM objects and how it would have been so much better if VSTO was truly mananged.

    But now, instead of COM objects we have to deal with proxies to remote objects?
    This makes it damn near impossible to debug anything.

    Again, maybe its just me, but seeing
    Cannot obtain fields or call methods on the instance of type 'Microsoft.Office.Interop.Excel.Range' because it is a proxy to a remote object.
    isn't very helpful at all.


    Thoughts? Feel free to tell me where I have gone astray. 
    I would love to find out it is just me so I can fix the problem and get back to debugging my app.

    MikeH
    (frustrated -- not angry)


    Thursday, November 17, 2005 3:05 PM

Answers

  • Hi Mike,
    We introduced the TransparentProxy in the RTM release to help resolve the Excel 1033 locale issue.  See Eric Carter's blog at http://blogs.msdn.com/eric_carter/archive/2005/06/15/429515.aspx for information about this.  The proxies provide huge benefit for solutions deployed on localized systems.  One of the pain it introduces is the debugging issue - you see _TransparentProxy as the types for all the objects instead of _COMObject and it gets difficult to debug.

    For C# projects, we provide a debugger visualizer that resolves this issue - you can see the type information and properties etc for the objects in the debug windows instead of getting the message that you see above.  Unfortunately, we could not get it working for VB projects in time for the VSTO2005 release.

    One way to get over this debugging problem in VB projects is to turn the proxies off for debugging.  In your AssemblyInfo.vb file, you will find the following declaration:

    <Assembly: ExcelLocale1033(True)>

    Change this to

    <Assembly: ExcelLocale1033(False)>

    This will turn the proxies off and you will get the COMObject debugging experience.  I highly recommend that you turn the proxies off only for debugging - turn it on for the final application as it helps resolve a very big problem for you.

    Hope this helps
    Mohit Gupta.

    Thursday, November 17, 2005 7:32 PM

All replies

  • Hi Mike,
    We introduced the TransparentProxy in the RTM release to help resolve the Excel 1033 locale issue.  See Eric Carter's blog at http://blogs.msdn.com/eric_carter/archive/2005/06/15/429515.aspx for information about this.  The proxies provide huge benefit for solutions deployed on localized systems.  One of the pain it introduces is the debugging issue - you see _TransparentProxy as the types for all the objects instead of _COMObject and it gets difficult to debug.

    For C# projects, we provide a debugger visualizer that resolves this issue - you can see the type information and properties etc for the objects in the debug windows instead of getting the message that you see above.  Unfortunately, we could not get it working for VB projects in time for the VSTO2005 release.

    One way to get over this debugging problem in VB projects is to turn the proxies off for debugging.  In your AssemblyInfo.vb file, you will find the following declaration:

    <Assembly: ExcelLocale1033(True)>

    Change this to

    <Assembly: ExcelLocale1033(False)>

    This will turn the proxies off and you will get the COMObject debugging experience.  I highly recommend that you turn the proxies off only for debugging - turn it on for the final application as it helps resolve a very big problem for you.

    Hope this helps
    Mohit Gupta.

    Thursday, November 17, 2005 7:32 PM
  • Thanks for your response. I appreciate your time.
    I am using C#, but I will try your suggestion.
    --MikeH
    Thursday, November 17, 2005 8:23 PM
  • I am having the exact same problem. I am running VS 2008 and am using Microsoft.Office.Interop.Excel and C#.

    I get the below message when i attempt to view a cell's text after running this line of code (I also do NOT get a visualizer for this excel.range object):

    Excel.

    Range cell = (Excel.Range)range.Cells[idx, idxCol];

    Range cell = (Excel.Range)range.Cells[idx, idxCol];

     

     

     

    cell.Text.ToString()    Cannot obtain fields or call methods on the instance of type 'Microsoft.Office.Interop.Excel.Range' because it is a proxy to a remote object. string


    ChrisIII
    Wednesday, March 16, 2011 8:32 PM