I've read through a number of threads on this, but they all seem to go after the code which i don't think applies to me.
I've got a firm of about 60 architects and we use a custom dll that loads on drawing open. the dll loads fine on all but one computer. even explicitly issuing the netload command and grabbing the dll manually does not work. it also does not work on other profiles on that computer (i tried an admin profile, even though the user is a local admin).
so it seems there's some kind of environmental setting somewhere that i'm missing.
any thoughts?
we're using .NET 4.0 on ACAD 2011
The problem you're having has something to do with code that runs when the DLL loads, and the only place where code can run when a DLL loads is the IExtensionApplication.Initialize() method. My guess is the code is dependent on something that is not present or not up-to-date on the problem machine.
So, you should tell the programmer to place all of that code inside of a try/catch and in the catch block, show a message on the AutoCAD command line.
Here is what we do:
public class MyApplication: IExtensionApplication { public void Initialize() { try { // place all initialization code here } catch(System.Exception ex) { Application.DocumentManager.MdiActiveDocument .Editor.WriteMessage(ex.ToString()); } } public void Terminate() { } }
@DiningPhilosopher wrote:
I was asking you what 'event' the DLL is loading on, and why it would behave differently (loading or code execution, it does not matter which) if it is loading on 'event' verses being loaded manually via NETLOAD.
Let me put it another way. Disregard that phrase.
The OP said that the dll loaded when a dwg was opened. That led me to believe that the dll ran some code within the open event. I may be wrong on that point, but what I was trying to point out was that if there was, it would not run when they netloaded it, because a dwg was not opening at that moment, and that might be the reason "it didn't work". IOW, you don't always have code in the plugin's Initialze event.
pretty convinced it's a wonky security setting somewhere. just spend a good bit with the programmer trying to isolate ... anything, really.
he wrote a simple dll that just pops a form on the screen and that worked, if we reset the cad profile. then we noticed that other dlls did not work on the network, but did work if we ran them locally. the kicker is that we also found the opposite to work with other dlls. so it seems to be bit and pieces here and there.
some of them would load, but with this kind of stuff:
System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
so, its might be something in the code, but since it's working on everyone else's standard box, i'm just gonna reimage his (mainly because this is legacy stuff from a 15 year old dvb (that we flipped to .net) and we're building a whole new standalone app to replace it).
i appreciate everyone's help here and i'll post any new developments. gotta move on to current work regular work.