Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

"COM object that has been separated from its underlying RCW cannot be used"

Hi,

I am using Measurement Studio 8.0.1 and VS2005. I used native datasocket library in my VB project.  Threads are used in the applicaiton. There is an exception "COM object that has been separated from its underlying RCW cannot be used" when the form is closing (i.e. at the time the Dispose method is called automatically). Do you know why this would happen? Thx

Best,
Dicky
0 Kudos
Message 1 of 5
(16,557 Views)
Error message as below:

System.Runtime.InteropServices.InvalidComObjectException was unhandled
  Message="COM object that has been separated from its underlying RCW cannot be used."
  Source="mscorlib"
  StackTrace:
       at System.Runtime.InteropServices.ComTypes.IConnectionPoint.Unadvise(Int32 dwCookie)
       at NationalInstruments.Net.Internal.a.a(Boolean A_0)
       at NationalInstruments.Net.Internal.a.a()

0 Kudos
Message 2 of 5
(16,556 Views)

Can you post a sample project that demonstrates this issue?
Thanks

Bilal Durrani
NI
0 Kudos
Message 3 of 5
(16,547 Views)
Hi Bilal,

I found the problem. I forgot to dispose the datasocket after use. Thanks!

Dicky
0 Kudos
Message 4 of 5
(16,537 Views)

Given a Window object "win", make sure to call win.Dispatcher.InvokeShutdown() before calling win.Close(). (This eliminated the error for me. Furthermore, this is ALL I did to fix the problem - I did not modify the Dispose() method at all.)

Message Edited by minister on 09-14-2008 10:11 PM
0 Kudos
Message 5 of 5
(12,081 Views)