.NET

Reply
Valued Mentor
370 Posts
175 Kudos
Registered: ‎05-06-2012
Post 21 of 25

Re: netload does not load dll

06-18-2012 08:53 PM in reply to: PencilsWereSoEasy

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()
  {
  }
} 

 

Distinguished Contributor
716 Posts
4 Kudos
Registered: ‎01-24-2003
Post 22 of 25

Re: netload does not load dll

06-19-2012 07:22 AM in reply to: DiningPhilosopher

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.

Valued Contributor
69 Posts
1 Kudo
Registered: ‎05-07-2012
Post 23 of 25

Re: netload does not load dll

06-19-2012 08:15 AM in reply to: eljobe

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.


______________________________
~ "if this were /. this would be funny"
Valued Contributor
69 Posts
1 Kudo
Registered: ‎05-07-2012
Post 24 of 25

Re: netload does not load dll

06-19-2012 08:35 AM in reply to: PencilsWereSoEasy

here's the code for the main problem dll


______________________________
~ "if this were /. this would be funny"
Valued Mentor
341 Posts
53 Kudos
Registered: ‎05-12-2009
Post 25 of 25

Re: netload does not load dll

06-19-2012 04:29 PM in reply to: PencilsWereSoEasy

Loading your dll from a network is most likely your problem

http://through-the-interface.typepad.com/through_the_interface/2011/07/loading-blocked-and-network-h...

You can also find your answers @ TheSwamp
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!