[Closed] .NET assembly – ExecuteMAXScriptScript crashes
When I place my assembly in /bin/assemblies, in the AssemblyMain() method I put GlobalInterface.Instance.ExecuteMAXScriptScript(“print “face””). Max crashes on load. If I put it in a class and call it from maxscript as a dotNetObject, its fine, however its critical for my purposes that I call it on initialization. Anyone had similar problems?
Here’s the only file in my test dll:
namespace Test
{
using ManagedServices;
public abstract class AssemblyEntry
{
public static void AssemblyMain()
{
GlobalInterface.Instance.ExecuteMAXScriptScript("print \"face\"", true, null);
}
public static void AssemblyShutdown()
{
}
}
}
can you delay loading the assembly by moving it elsewhere and then calling
<dotNetObject>dotNet.loadAssembly <assembly>
from a startup script ? least then you know that core mxs functionality is loaded.
You can register for the system notification #NOTIFY_MXS_POST_STARTUP and run your code there.
Thanks lo, that did the trick! I deferred initialising my stuff until I received that callback, and destroyed it on the shutdown callback. Works great!
that’s i would do – load my scripts and assemblies in an order of their dependency.
I wouldn’t bother with that unless you have some persistence handling to do. Windows will tear down the process along with everything in it anyways.