Don't waste time adding Idle event handlers, because you can't use the NETLOAD command without an active document.
The exception can occur long before your Initialize() method runs, if it references a type from an assembly that can't be loaded. In that case, Initialize() will never be called, because the exception occurs when it is just-in-time compiled prior to calling it. It's that JIT process where types that are referenced from Initialize() are loaded, from whatever assemblies they're in, and if the correct version of one of those assemblies cannot be found/loaded, that's when the exception occurs.
Add a line to display a message on the console in the Initialize() method to confirm it's being called.
If Initialize() not being called, the easiest way to diagnose this, is to add a handler to the AppDomain's FirstChanceException event in another assembly that's already loaded. In the handler for the FirstChanceException event, dump the exception stacktrace to the console. That must be done in another assembly that's already loaded when you try to load the problematic assembly.
Another way to identify issues with assembly binding failures is to use fuslogvw.exe:
Fusion Log Viewer
🔹Location: C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX <version>\fuslogvw.exe
🔹How to use:
- Open a Command Prompt as Administrator.
- Run fuslogvw.exe.
- In the Fusion Log Viewer, enable logging (Settings → Log All Binds).
- Load your assembly (e.g., via NETLOAD in AutoCAD).
- Refresh fuslogvw.exe to see binding failures.
- Click on an entry to see details about why the assembly failed to load.