Tuesday, January 25, 2011

System.Runtime.InteropServices.InvalidComObjectException: COM object that has been separated from its underlying RCW cannot be used

Error : System.Runtime.InteropServices.InvalidComObjectException: COM object that has been separated from its underlying RCW cannot be used

Here is a problem that I have faced recently. I do not know exactly this is the proper solution or not. But ofcourse I am not facing the same problem after doing something in my code. And solution is to comment some lines of code. I have used System.Runtime.InteropServices.Marshal.ReleaseComObject(session); through out my application, that actually causes the error. I got a reference form the following articles

http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/13bf5c21-081b-4179-ba8c-2ff7e6a5a3da

http://social.msdn.microsoft.com/Forums/en/vsto/thread/5f24a42b-f23c-4d6d-8f11-b892da223500

And after that I have changed the code and it works for me. Hope this will too work for you if u will ever face any simillar problem.

No comments:

Post a Comment