.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

.Net (Cannot Load Assembly)

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
VB_Autocad_guy
5297 Views, 6 Replies

.Net (Cannot Load Assembly)

Hello,

 

I get this strange error in my Command Window. 

Any ideas what's going on? 

My .Net app appears isn't recognizing commands either. 

 

Cannot load assembly. Error details: Autodesk.AutoCAD.Runtime.Exception: eDuplicateKey   at Autodesk.AutoCAD.Runtime.Interop.Check(Int32 returnValue)   at Autodesk.AutoCAD.Runtime.CommandClass.AddCommand(ICommandLineCallable ca, MethodInfo mi)   at Autodesk.AutoCAD.ApplicationServices.AutoCADApplicationHolder.Initialize(Assembly assembly)   at Autodesk.AutoCAD.ApplicationServices.ExtensionLoader.ProcessAssembly(Assembly assembly)

 

SFR.jpg

 

 

Public Sub Initialize() Implements IExtensionApplication.Initialize
        Try
            'add anything that needs to be instantiated on startup

            'Step1
            'Write Message to Acad Console Window
            ed.WriteMessage("<<[Initializing - VB.NET:ClassAutocad2011.dll Loaded]>>")
            ed.WriteMessage(Environment.NewLine)

            'Step2
            'Check to see if Autocad is Setup Already

            If Not (modRegistry.IsAcadSetup) Then
                modAcadSetup.RunSetup_AC2K11()
            End If

            'Step3 -Initalize All Application Events
            AddAppEvent()

            'Step4 -Intialize All Document Events
            DocEvents.AddDocEvents()

            'Step5 -Standard Startup Variables
            modAcadSetup.TurnFileDialogOn()

            'Step6 -Write Text File to M Drive Signaling that Autocad is being used by this User
            modTextFiles.CreateTextFile_User_OpenedAutocad(Environment.UserName)

            ed.WriteMessage("<<[Done Initializing Autocad 2011]>>")
            ed.WriteMessage(Environment.NewLine)

        Catch ex As System.Exception
            MsgBox(ex.Message)

        End Try

    End Sub


    Public Sub Terminate() Implements IExtensionApplication.Terminate
        ' Do plug-in application clean up here
        'Autocad .DLL Library is Terminated(Exited)
   
        'handle closing down a link to a database/etc.

        Console.WriteLine("Cleaning up...")
    End Sub

 

6 REPLIES 6
Message 2 of 7

I'd start looking here:

http://forums.autodesk.com/t5/NET/2008-NetLoad-Error/td-p/2092595

To quote Tony:

You have multiple CommandMethod attributes, or
LispFunction attributes with the same command
or function name

 

I think I had 2 functions with the same name, I'd look for that first.

Message 3 of 7

Yep that was it!

Sloppy code... had duplicate Command Methods. 

I had two <CommandMethod("listrib")> _ in two different places. 

That would make sense why it would hang up autocad and stop recognizing commands as they are global. 

 

Many Thanks for helping me see my blind spot!

Message 4 of 7

I would like to add an additional bit of help in case anyone else needs to know.

 

You get the same error if you accidentally forget to change the 'Copy Local' property to false when adding a Acad reference to your project ...

 

Bugged me for a couple of hour because I only had *one* CommandMethod therefore couldn'y understand why the solution was to remove a duplicate!

 

Smiley Very Happy

Message 5 of 7
cyranobb30
in reply to: McBoogerballs

Hi

i have a little question.

is posible have two CommandMethod in a Class

 

Saludos

Message 6 of 7
_gile
in reply to: cyranobb30

Hi,

 

You can define as many CommandMethod attributed methods as you want in the same class.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 7 of 7
CADbloke
in reply to: VB_Autocad_guy

Posting here because $searchEngine brought me here for my error ...

Cannot load assembly. Error details: Autodesk.AutoCAD.Runtime.Exception: eInvalidInput
   at Autodesk.AutoCAD.Runtime.CommandClass.AddCommand(ICommandLineCallable ca, MethodInfo mi)
   at Autodesk.AutoCAD.ApplicationServices.AutoCADApplicationHolder.Initialize(Assembly assembly)
   at Autodesk.AutoCAD.ApplicationServices.ExtensionLoader.ProcessAssembly(Assembly assembly)

Note: eInvalidInput - I hadn't typed anything, the DLL was still loading.

 

The culprit ... The localized or underscored English command name; must be 64 characters or less in length. Actually, I make it 63 or less, I tested it, 1 character at a time.  

 

Verbosity killed my cat.

 

- - - - - - -
working on all sorts of things including www.tvCAD.tv & www.CADreplace.com

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost