Plugin .Bundle is loading Cui, Tool Palettes, LISP but is not loading .Net .DLL. Manual NetLoad command still works.

Plugin .Bundle is loading Cui, Tool Palettes, LISP but is not loading .Net .DLL. Manual NetLoad command still works.

nshupeFMPE3
Advocate Advocate
431 Views
5 Replies
Message 1 of 6

Plugin .Bundle is loading Cui, Tool Palettes, LISP but is not loading .Net .DLL. Manual NetLoad command still works.

nshupeFMPE3
Advocate
Advocate

This problem arose this morning on a new computer and install of AutoCAD 2024. I have a .bundle that other members on the team are using and works fine for them. But getting a new person up and running this morning proved challenging. 

This is the PackageContents.xml file that is used for everyones .bundle folder (used by everyone it has worked for and the one person it is not working for)

<?xml version="1.0" encoding="utf-8"?>

<ApplicationPackage 
    SchemaVersion="1.0"
    ProductType="Application"
    Name="MyTools Tools"
    AppVersion="31.6.10"
    Description="Company Tools"
    Author="Me"
	Icon="renamesubs16.bmp"
	ProductCode="C9A7FDFB-F608-45ED-9465-BF7D1F0F1C1F">

  <CompanyDetails 
	  Name="ACME Inc."
	  Phone="800-588-2300"
	  Url="http://www.acme.com/"
	  Email="me@acme.com" />

	<Components Description="AutoCAD 2021-2024">

		<RuntimeRequirements SupportPath="./" Platform="AutoCAD*" SeriesMin="R21.0" SeriesMax="R25.0" ToolPalettePath="./Palettes/" />
		<ComponentEntry
			AppName="My CUI" 
			ModuleName="./CUI/company.cuix"
			AppType="CuiX">			
			<RuntimeRequirements OS="Win64"
			Platform="AutoCAD"
			SeriesMin="R21.0"
			SeriesMax="R24.0"/>			
		</ComponentEntry>

		<ComponentEntry
			AppName="Properties for the Tools"
			ModuleName="./DLL/asdkOPMNetExt.dll"
			AppType=".Net"
			LoadOnAutoCADStartup="True">
			<RuntimeRequirements OS="Win64"
					Platform="AutoCAD"
					SeriesMin="R21.0"
					SeriesMax="R24.0"/>
		</ComponentEntry>

		<ComponentEntry
			AppName="Company Tools"
			ModuleName="./DLL/CompanyTools.dll"
			LoadOnAutoCADStartup="True">
			<RuntimeRequirements OS="Win64"
			                     Platform="AutoCAD"
			                     SeriesMin="R21.0"
			                     SeriesMax="R24.0"/>
		</ComponentEntry>


	</Components>

</ApplicationPackage>


There are two .DLL files that get loaded. One handles interfacing with COM so that custom properties can be created in .NET.

the other is our .NET code. 

If I manually run the NETLOAD command and select "CompanyTools.dll" the .DLL successfully loads. 

0 Likes
432 Views
5 Replies
Replies (5)
Message 2 of 6

ActivistInvestor
Mentor
Mentor

If the assembly that isn't loading at startup has an IExtensionApplication, you should post it because that could be one cause of the problem. You should also check the code that initializes static variables on any type that is used from an IExtensionApplication's Initialize() method.

 

Lastly, have you tried running AutoCAD in a debug session and setting a breakpoint on code in the assembly that is failing to load at startup that runs when the assembly loads (e.g., IExtensionApplication)?

0 Likes
Message 3 of 6

nshupeFMPE3
Advocate
Advocate

The assembly that isn't loading does extend IExtensionApplication. Its quiet long and intensive, which is why I'm hesitant to post it. But I have run a debugging session on my own computer and have had no problems with the assembly being loaded. And as I wrote in the original post, 5+ other people are using the same .bundle + assembly and are having no problems with the autoloader. 

The individual who's computer was having the problem ended up getting a new computer, to which I installed 2024 and set up our .bundle folder. This is a clean install of 2024 on a clean computer, and for some reason the only thing to load was the Tool Palettes that are part of the bundle. Not even the CUI was loading this time, but it was previously. 

I know there are work arounds like going into the CUI dialog and adding the CUI manually, and then setting a LISP script to Netload the DLL. This just seemed like such strange behavior and I wasn't sure if there are any mechanisms to hunt down the problem.

0 Likes
Message 4 of 6

ActivistInvestor
Mentor
Mentor

What is the reason for automatically loading asdkOPMNetExt.dll ?

 

That dll is referenced from projects that use it, and should be loaded dynamically by the runtime when one of it's types appears in referencing code in another assembly.  I don't see what purpose there is to automatically loading this DLL at startup.

 

0 Likes
Message 5 of 6

nshupeFMPE3
Advocate
Advocate

If that's so then I wasn't aware. I tried to follow what the original example did. Though that example used 

Assembly.LoadFrom("asdkOPMNetExt.dll");


In the Initialization() of the Application. I cant exactly remember how I came to the conclusion to use the autoloader instead but it seems to work.

0 Likes
Message 6 of 6

ActivistInvestor
Mentor
Mentor

In the following code from the original example you linked to, asdkOPMNetExt.dll has already been loaded before the call to Assembly.LoadFrom() has executed.  So, that line is entirely pointless:

public void Initialize () 
{
   /// When this line of code runs, asdkOPMNetExt.dll 
   /// is already loaded:
   /// Assembly.LoadFrom("asdkOPMNetExt.dll");

   // Add the Dynamic Property
   Dictionary classDict =SystemObjects.ClassDictionary;
   RXClass lineDesc =(RXClass)classDict.At("AcDbLine");

   /// When this method is just-in-time compiled (before
   /// it is called), the following line triggers automatic 
   /// loading of asdkOPMNetExt.dll (because the type 
   /// IPropertyManager2 is from asdkOPMNetExt.dll):
   
   IPropertyManager2 pPropMan =(IPropertyManager2)xOPM.xGET_OPMPROPERTY_MANAGER(lineDesc);

   custProp =new CustomProp();
   pPropMan.AddProperty((object)custProp);
}

 

You can omit the component entry from the bundle , and you can delete the line that calls Assembly.LoadFrom(), since by the time that line is reached, asdkOPMNetExt.dll is already loaded.

0 Likes