Recently when I netload in a project for AutoCAD2025 I receive an unhandled exception error (System.IO.FileLoadException). This appears to happen in AeccUiMgd.dll.
************** Exception Text **************
System.IO.FileLoadException: Could not load file or assembly 'C:\Program Files\Autodesk\AutoCAD 2025\C3D\AeccUiMgd.dll'. A dynamic link library (DLL) initialization routine failed. (0x8007045A)
File name: 'C:\Program Files\Autodesk\AutoCAD 2025\C3D\AeccUiMgd.dll'
at Autodesk.Civil.UIWindows.Data.CommonProperties..ctor()
at Autodesk.Civil.UIWindows.Data.DataBindings.get_CommonProperties()
at Autodesk.Civil.UIWindows.RibbonServices.SetInitialTogglePanelDisplay(RibbonTab tab)
at Autodesk.Civil.UIWindows.RibbonServices.OnTabActivated(RibbonTab tab)
at Autodesk.Civil.UIWindows.RibbonServices.OnRibbonPaletteSetLoaded(RibbonPaletteSet paletteSet)
at Autodesk.Civil.UIWindows.RibbonServices.RibbonPaletteSet_Loaded(Object sender, EventArgs e)
at Autodesk.AutoCAD.Ribbon.RibbonPaletteSet.ApplyWorkspace(RibbonWorkspace ribbonWorkspace)
at Autodesk.AutoCAD.Ribbon.RibbonPaletteSet.LoadRibbon()
at Autodesk.AutoCAD.Ribbon.RibbonPaletteSet.Initialize()
at Autodesk.AutoCAD.Ribbon.RibbonServices.CreateRibbonPaletteSet()
at Autodesk.AutoCAD.Ribbon.Commands.Ribbon()
at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorker(MethodInfo mi, Object commandObject, Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorkerWithExceptionFilter(MethodInfo mi, Object commandObject, Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.CommandClass.Invoke(MethodInfo mi, Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.CommandClass.CommandThunk.Invoke()
Because of this issue, Visual Studio stops the app which mean that I cannot proceed.
To test this issue I have created two separate projects, one for Framework 4.8 and one for .Net 8. Neither project has any real code in it, both projects have only one class that extends IExtensionApplication.
using Autodesk.AutoCAD.Runtime;
[assembly: ExtensionApplication(typeof(AutoCADTest.RunOnLoad))]
namespace AutoCADTest
{
public class RunOnLoad : IExtensionApplication
{
void IExtensionApplication.Initialize()
{
string message = string.Empty;
}
void IExtensionApplication.Terminate()
{
}
}
}
Both projects have three Autodesk dll's referenced (for the respective versions):
accoremgd.dll
Acdbmgd.dll
Acmgd.dll
I have two registry keys set up to netload in both projects:
Computer\HKEY_CURRENT_USER\SOFTWARE\Autodesk\AutoCAD\R25.0\ACAD-8101:409\Applications\TestAutoCADCore
Computer\HKEY_CURRENT_USER\SOFTWARE\Autodesk\AutoCAD\R25.0\ACAD-8101:409\Applications\TestAutoCADFramework
On startup the AutoCAD 2025 project will crash with the error and the AutoCAD 2024 project continues as expected.
I have uninstalled/reinstalled both AutoCAD 2025 and Visual Studio.
Has anyone seen anything like this?
Solved! Go to Solution.
Solved by Scott_FergusonPVMNH. Go to Solution.
Here are links to the test project and error txt file.
https://drive.google.com/drive/folders/1O3knV4Ea5a9POAiHIG5aJeU7mDQbZcx8?usp=sharing
Have you verified that the file 'C:\Program Files\Autodesk\AutoCAD 2025\C3D\AeccUiMgd.dll' exists?
Does the exception happen if you disable your plugin so it doesn't load? The reason I ask is because the exception is being triggered by code that is being called from the handler of a registered command.
If AeccUiMgd.dll does exist, the problem is most-likely a result of that file (or a file it depends) on either not being found, or possibly using the wrong framework version.
I would completely disable your plugin so it doesn't load, and try using NETLOAD to load AeccUiMgd.dll.
I checked and the AeccUiMgd.dll file exists and it is a .Net 8 compiled file, I checked using Jet Brains dot peek.
It's an empty project with only one class.
I netloaded into the project dll and called a simple command at the command line. That worked as expected.
If I use the registry to netload it, and run the project in Visual Studio the error is generated.
If I don't use Visual Studio to run the project then there is no error.
I have zipped both test projects and attached them.
Norman Yuan
OK, I think the issue is probably you added the registry key (for autoload/command invocation of your plugin) underneath a wrong AutoCAD 2025 product. That is, the plugin is meant to C3D, but you may place the registry key underneath the plain AutoCAD (or other AutoCAD vertical).
See, underneath Hkey_current_user\....AutoCAD\R25.0, you may have a bunch of keys: ACAD-810X:409, depending on which Acad2025 verticals have been installed, and the order of their installation. The registry key starts with ACAD-8100, and increment by 1 with every other verticals being installed.
Take one of my computer as an example:
I installed C3D 2025 first, thus the key is ACAD8100:409;
Then I installed plain AutoCAD 2025, the key is ACAD8101:409;
I later installed Map 2025, the key for it is ACAD8102:409;
Not sure which Acad2025 verticals you have in your computer, but I bet it is more than one, due to the key being ACAD8101, not ACAD8100. You should look up HKEY_LOCAL_MACHINE to identify which of these "ACAD810X" is C3D, because your plugin is C3D specific.
Edit:
BTW, I created a simple plugin with references to C3D API references and then added the auto-load registry key in the Windows Registry. It auto-loaded OK when my C3D launches.
Norman Yuan
Maybe I'm not following what you wrote, but if the loader registry entry was being added under the registry key for the wrong product, how could the assembly be loaded automatically when launching a different product?
Well, the OP only says AutoCAD 2025 but the exception clearly indicate a C3D managed assembly cannot be fond/load. But the OP did not mention the AutoCAD session is started as C3D, or as plain AutoCAD or other verticals (i.e. the specified /product argument for acad.exe startup), this my reply. Actually I am also quite confused, without knowing all the details of the project. So, I am going to take "the risk" to download/try the OP attached project to satisfy my curiosity.
Norman Yuan
When I uninstall C3D and run the test project, using Visual Studio to start AutoCAD, there is no error. This makes sense as the error says it's happening in AeccUiMdg.dll, which is a C3D library. My test project is almost empty with only one class that simple extends 'IExtensionApplication'. This class has almost no code as both extended methods are empty. The project also references the three autocad dlls which are required to netload the project into autocad.
It's like there is some behind-the-scenes error going on in AeccUiMgd.dll that is bubbling up and causing Visual Studio to crash.
I've tried going into 'Exception Settings' in visual studio and preventing it from crashing on the FileLoadException (see attached image).
I'm currently reinstalling C3D (its taking ages!). Then I will continue to explore the Exception Settings some more to see if I can get Visual Studio to ignore the error AeccUiMgd.dll is bubbling up.
The curious thing is this unhandled exception happens in the AeccUiMgd.dll library whether I use Visual Studio to start plain AutoCAD or Civil 3D (C3D).
The issues turns out to be caused because C3D is installed. When I uninstall it and start up plain AutoCAD using Visual Studio, then no error.
OK, I download the posted simple test project. Added Editor.WriteMessage() line in the IExtensionApplication.Initialize() so I can see the DLL is loaded at command line.
Here is the registry change in the HKEY_CURRENT_USER:
and this is a video clip showing C3D is started by double-clicking its shortcut on desktop, and the DLL is autoloaded OK:
Then I did debug-start with Visual Studio, and the DLL is also autoloaded OK as expected:
I used the downloaded project without change (except for adding a line of code in Initialize()), it might be the C3D installation issue (being messed up somehow?).
Norman Yuan
@Scott_FergusonPVMNH wrote:>>>
If I use the registry to netload it, and run the project in Visual Studio the error is generated.
<<<
Exactly how are you attempting this ?
added:
Are you 'Attatching to Process' after AutoCAD starts ?
// Called Kerry or kdub in my other life.
Everything will work just as you expect it to, unless your expectations are incorrect.
Sometimes the question is more important than the answer.
class keyThumper<T> : Lazy<T>; another Swamper
When I say I use the registry to netload it: This is what I mean:
1) I set a key under the product key:
Computer\HKEY_CURRENT_USER\SOFTWARE\Autodesk\AutoCAD\R25.0\ACAD-8101:409\Applications\TestAutoCADCore
In the 'TestAutoCADCore' key I have set the required sub key/values
Please see attachment image of my registry values (RegistrySettings.png).
2) In visual studio I have a 'launchSettings.json' file in my Properties directory:
{
"profiles": {
"Executable": {
"commandName": "Executable",
"executablePath": "C:\\Program Files\\Autodesk\\AutoCAD 2025\\acad.exe",
"commandLineArgs": "/product ACAD /language \"en-US\"",
"workingDirectory": "C:\\Program Files\\Autodesk\\AutoCAD 2025"
}
}
}
3) I then do a debug start in visual studio.
I downloaded the project and only briefly looked at it, and I didn't see any references to C3D assemblies, or any code that's dependent on C3D. It's just a bare-bones C# project with references to AutoCAD assemblies and a class that implements IExtensionApplication.
@Scott_FergusonPVMNH wrote:The curious thing is this unhandled exception happens in the AeccUiMgd.dll library whether I use Visual Studio to start plain AutoCAD or Civil 3D (C3D).
The issues turns out to be caused because C3D is installed. When I uninstall it and start up plain AutoCAD using Visual Studio, then no error.
The exception isn't happening in AeccUiMgd.dll. The exception is that AeccUiMgd.dll cannot be found, or cannot be loaded. The thing is that the projects you posted do not have any references to Civil3D assemblies whatsoever.
The strange thing is that the exception stack trace indicates that the code that is throwing the exception is being called from the handler of a registered command method.
I didn't see any references to C3D assemblies, or any code that's dependent on C3D.
That's right, this is the weird part. There are no references to C3D, the issue only arises when I have C3D installed on my computer.
When I uninstall C3D, and run the exact same bare bones project, then there is no issue, i.e. no 'FileLoadException' exception that stops Visual Studio.
As you noted I don't call C3D, in the stacktrace from the error message, it appears to happen in the ribbon.
************** Exception Text **************
System.IO.FileLoadException: Could not load file or assembly 'C:\Program Files\Autodesk\AutoCAD 2025\C3D\AeccUiMgd.dll'. A dynamic link library (DLL) initialization routine failed. (0x8007045A)
File name: 'C:\Program Files\Autodesk\AutoCAD 2025\C3D\AeccUiMgd.dll'
at Autodesk.Civil.UIWindows.Data.CommonProperties..ctor()
at Autodesk.Civil.UIWindows.Data.DataBindings.get_CommonProperties()
at Autodesk.Civil.UIWindows.RibbonServices.SetInitialTogglePanelDisplay(RibbonTab tab)
at Autodesk.Civil.UIWindows.RibbonServices.OnTabActivated(RibbonTab tab)
at Autodesk.Civil.UIWindows.RibbonServices.OnRibbonPaletteSetLoaded(RibbonPaletteSet paletteSet)
at Autodesk.Civil.UIWindows.RibbonServices.RibbonPaletteSet_Loaded(Object sender, EventArgs e)
at Autodesk.AutoCAD.Ribbon.RibbonPaletteSet.ApplyWorkspace(RibbonWorkspace ribbonWorkspace)
at Autodesk.AutoCAD.Ribbon.RibbonPaletteSet.LoadRibbon()
at Autodesk.AutoCAD.Ribbon.RibbonPaletteSet.Initialize()
at Autodesk.AutoCAD.Ribbon.RibbonServices.CreateRibbonPaletteSet()
at Autodesk.AutoCAD.Ribbon.Commands.Ribbon()
at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorker(MethodInfo mi, Object commandObject, Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorkerWithExceptionFilter(MethodInfo mi, Object commandObject, Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.CommandClass.Invoke(MethodInfo mi, Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.CommandClass.CommandThunk.Invoke()
You should check your project's debug startup settings to verify that if there is a working directory specified, it is not for the wrong product.
If uninstalling Civil3d makes the error go away, it could only mean there is some type of misconfiguration that is causing something to be loaded, which has a dependence on AeccUiMgd.dll.
It 'appears' that the issue is raised while setting the Menu/Ribbon/Pallette/Properties.
Is this likely to be causal.
// Called Kerry or kdub in my other life.
Everything will work just as you expect it to, unless your expectations are incorrect.
Sometimes the question is more important than the answer.
class keyThumper<T> : Lazy<T>; another Swamper
Can't find what you're looking for? Ask the community or share your knowledge.