3 Replies Latest reply on Sep 26, 2016 9:20 PM by daitranthanhoa

    [vb.net] RPC Error - for each loop

    Hemachandiran

      Hi,

       

      I am using CS5 Indesign Interop in vb.net to process.

       

      In some cases, I am getting RPC Error. I tried with vs 2005 and vs 2008 with CS5 and result is the same.

       

      On exploring it was found that, RPC error occurs while using the 'for each loop' instead of 'for loop'. This looks strange because it works for some cases and also fails in some cases.

       

      I tried with different system, cleared the profile and the result is the same.

       

      I have given the error below what I got:

       

      The object invoked has disconnected from its clients. (Exception from HRESULT: 0x80010108 (RPC_E_DISCONNECTED))   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)

         at System.Runtime.InteropServices.CustomMarshalers.EnumeratorViewOfEnumVariant.MoveNext()

       

      Is there any way to solve/fix this problem?

       

       

      Thanks.

        • 1. Re: [vb.net] RPC Error - for each loop
          amorinaj

          I had the same error today using C#.  The workaround was to replace all foreach loops with For loops.

           

          Hope this helps,

          • 2. Re: [vb.net] RPC Error - for each loop
            ThinkingThings Level 1

            @Hemachandiran and @amorinaj --

             

            I know that this is an old thread, but I thought that it may be appropriate to update it with some new (not so great) news...

             

            I am running VS2013, W7, InDesign CS6 on MSSQL2008R2. Beating myself up over the last day with this same error:

             

            An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in CustomMarshalers.dll

            (Exception from HRESULT: 0x80010108 (RPC_E_DISCONNECTED))

             

            As of the writing of this post, the only apparent workaround is what you have described above - to replace for/each loops with for/next loops.

             

            Hope this continues to help someone...

             

            Best regards,

             

            -TT

            • 3. Re: [vb.net] RPC Error - for each loop
              daitranthanhoa Level 1

              "As of the writing of this post, the only apparent workaround is what you have described above - to replace for/each loops with for/next loops.

              Hope this continues to help someone..."

               

              --> Change all [for/each loops] by [for/next loops] in Project?

              Or only change [for/each loops]  of Objects of Indesign?