Receive NullReferenceException message after recompile

 
 
 
Posted by:dcollier
Data created:4 October 2010

After I recompile I receive the messsage from 3ds max 2010:

System.NullReferenceException: Object reference not set to an instance of an object.
   at Autodesk.Max.Manager.UnloadAssembly(String name)

What could be the problem?

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.

Marsel Khadiyev (Software Developer, EPHERE Inc.)

I just had this exception yesterday.

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.)