3

I am working on C# program to get the users from A component called Cyber-Ark which stores encrypted data. When my code is running half way I am getting this exception and even if i catch all the exceptions i still get it.Is there any work around for this?

Unhandled Exception: System.Runtime.InteropServices.InvalidComObjectException: COM object that has been separated from its underlying RCW cannot be used.
   at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, Boolean& pfNeedsRelease)
   at PAObjectsLib.PrivateArkClass.Term()
   at CyberArk.API.Objects.PrivateArk.Term()
   at CyberArk.API.Objects.PrivateArk.DoDispose(Boolean disposing)
   at CyberArk.API.Objects.CyberArkBase.Dispose()
   at Program.Main(String[] args)
Charles
  • 50,943
  • 13
  • 104
  • 142
aswin
  • 33
  • 5
  • Can you show your main method? But so far it looks as if you should get an update from your component vendor to fix this problem. – Dirk Vollmar Dec 16 '10 at 12:41

3 Answers3

5

You can get this exception if the underlying COM object has been released (by calls to IUnknown.Release). I have seen this happen during shutdown where the runtime has collected the RCW (run-time callable wrapper) and some cleanup code then tries to access the now non-accessible COM object to call a "cleanup" function on the COM object before releasing it.

If this is correct you could try to Dispose the object earlier at shutdown.

Martin Liversage
  • 104,481
  • 22
  • 209
  • 256
0

What do you want by "I still get it ?"

Catching an exception will never it to happened.

On the other hand, Visual Studio can be configured to stop when any exception is trown, even if you code handles (catch) it. Go in the debug/Exception menu to configure that level of details.

VdesmedT
  • 9,037
  • 3
  • 34
  • 50
  • I read it as this exception is escaping a `try { ... } catch(Exception e) { ... }` block. – Rup Dec 16 '10 at 12:42
0

There are more than one reasons that may be causing the exception. (try disposing correctly as @Martin Liversage said).

If it doesn work and you have purchased the component, contact Cyber-Ark tech support.

Gerardo Grignoli
  • 14,058
  • 7
  • 57
  • 68