Thursday, April 14, 2011

Context 0x1b64e0' is disconnected : DirectoryEntry

I started getting the exception below everytime I close my vb.net application.To fix this I had to either dispose the directory entry object after calling the ProcessDirectoryEntry in the for loop OR change "byval" to "byref" in the ProcessDirectoryEntry de parameter.

 For Each de As DirectoryEntry In delist
            ProcessDirectoryEntry(de)
    ''fix - de.dispose
Next
Sub ProcessDirectoryEntry(ByVal de As DirectoryEntry)
        ..
            ..
            ..
            ..
End Sub


Context 0x1b64e0' is disconnected.  Releasing the interfaces from the current context (context 0x1b6370). This may cause corruption or data loss. To avoid this problem, please ensure that all contexts/apartments stay alive until the application is completely done with the RuntimeCallableWrappers that represent COM components that live inside them.

No comments:

Post a Comment