It seems this exception is thrown by the reference system checks. So be sure to initialize and set up correctly all the references held by the plugin. See "Tests to ensure that references are set up correctly" in the "Reference System Changes" page of the SDK docs.
Yannick has a good point. Also try to set a breakpoint into your Cleanup() method (if you have one) to see if exception originates from there.
Before recompiling/reloading your plugin also try resetting the scene. Its possible that a reference of your object is still in there and there's a conflict.
It's coming from the language/framework side because I had it trying to use an uninitialized variable. So check that your variables are pointing to valid handles (null object reference, disposed objects etc.)