DisconnectFromLibrary's problem

In my program the method DisconnectFromLibrary() can work well in the addin’s main class. But cannot work in my own forms class. I don’t know why.

Anyone knows why? And how to Disconnect Library in user’s form call?Thanks a lot!

Are you using VSTA or Visual Studio?
In a Visual Studio addin, make sure to only call API methods from the main thread (the same thread that calls AddinMain()).

regards,
Johannes

I’m using Visual Studio.
Actually I create a C# form in AddinMain(), and then click the button on this form to disconnect library. And it cannot work!

Is this in a different thread from the main thread?
Sorry, I’m new to the C# program:stuck_out_tongue:.

Thank you!