Author Topic: Dll files are not loaded by Autocad 2011 Windows7 on 64bits  (Read 14878 times)

0 Members and 1 Guest are viewing this topic.

teslaxx

  • Guest
Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« on: February 03, 2011, 06:43:23 AM »
Hello,

I have a net dll, which has been developed with visual studio 2008, language c#. When I tried it on a windows 7 64 bits it does absolutely nothing, it gives no errors, but does absolutely nothing when you type the commands. Commands are not recognized and it does not change the default system menu in autocad.

I set platform target: Any CPU and all the Autocad references have the setting: Copy Local set to false
« Last Edit: February 03, 2011, 06:49:39 AM by teslaxx »

n.yuan

  • Bull Frog
  • Posts: 348
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #1 on: February 03, 2011, 10:53:06 AM »
So, you do see ""Unknown Command" prompt at command line when trying to execute a custom command defined in the loaded DLL, right?

One possible reason for this issue: does the loaded DLL contain a class that is an ExtensionApplication (e.g. it implements IExtensionApplication interface)? If yes, do you have code doing something in the implemented Initialize() method (I guess you do, if a class does implement IExtensionApplication)? Then, do you have try...catch{} block that wraps up all code in Initialize()?

If there is an exception occurs in Initialize() without being caught, AutoCAD simply silently jumps out Intialize() and then the loaded DLL becomes useless, thus the commands defined in it can not be recognised by AutoCAD.

teslaxx

  • Guest
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #2 on: February 04, 2011, 02:48:05 AM »
Nope, is not working. Some behavior.

huiz

  • Swamp Rat
  • Posts: 917
  • Certified Prof C3D
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #3 on: February 04, 2011, 06:04:15 AM »
It does work on 32 bit or XP/Vista?

Is your class public?
The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.

kaefer

  • Guest
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #4 on: February 04, 2011, 06:15:05 AM »
Is your class public?

Other possible failure modes:

Is your method public?

Takes it void and returns it void? (Had that in F#: last statement didn't return unit, then the overall signature of the command method wasn't unit->unit)

As already mentioned, does your class implement IExtensionApllication, without exception handling?

teslaxx

  • Guest
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #5 on: February 04, 2011, 07:31:42 AM »
Yes, all my classes are public and my dll are working on XP.

sinc

  • Guest
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #6 on: February 04, 2011, 08:27:56 AM »
Do you have your build options set to "Any CPU"?

LE3

  • Guest
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #7 on: February 04, 2011, 10:17:06 AM »
Other to check ...
If you use the arx/net wizard and end up adding something like:

[assembly: CommandClass(typeof(YourNamespace.Commands))]

Make sure to have this line added in all your classes, where you have command methods calls.

Or, simple remove all those calls.

... hth maybe

LE3

  • Guest
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #8 on: February 04, 2011, 10:23:23 AM »
Another:

If you have some assemblies that are required to be side by side with your assembly app, check that.

I have to sometimes to rebuild or to make sure I am loading the latest build, when testing/debugging code on my 32 or 64 machines.

... hth maybe

Jeff H

  • Needs a day job
  • Posts: 6150
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #9 on: February 04, 2011, 05:09:49 PM »
Another

Having a commands defined in two classes

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #10 on: February 04, 2011, 05:11:47 PM »

Another  ..

spelling.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #11 on: February 04, 2011, 05:14:31 PM »

Seeing the solution files may help someone resolve the issue.

Or creating a mini-solution that demonstrates your problem.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Jeff H

  • Needs a day job
  • Posts: 6150
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #12 on: February 04, 2011, 05:15:18 PM »

Another  ..

spelling.

Thats why I use the Tab key

I can't spell  :oops:

teslaxx

  • Guest
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #13 on: February 07, 2011, 05:10:32 AM »
For all the questions above: Yes and checked.  :-)

Once again. The "thing" is working on Windows XP, Windows 7(32Bits), but not on the Windows7(64bits)

P.S. And yes, I set to Any CPU and all the suggestions you... suggested.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #14 on: February 07, 2011, 06:44:18 AM »
For all the questions above: Yes and checked.  :-)

Once again. The "thing" is working on Windows XP, Windows 7(32Bits), but not on the Windows7(64bits)

P.S. And yes, I set to Any CPU and all the suggestions you... suggested.

What am I, chopped liver ??


Seeing the solution files may help someone resolve the issue.

Or creating a mini-solution that demonstrates your problem.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

teslaxx

  • Guest
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #15 on: February 07, 2011, 07:59:59 AM »
Hahahahahah  :-D
So funny!!

I attached a mini Project!
On W7 on 32bits, it's working fine.
Now, it seems that Autocad dies if I load the dll file on W7 on 64bits.


Alexander Rivilis

  • Bull Frog
  • Posts: 214
  • Programmer from Kyiv (Ukraine)
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #16 on: February 07, 2011, 09:21:17 AM »
You are using P/Invoke:
Code: [Select]
[DllImport("acad.exe", CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl, EntryPoint = "?acedPostCommand@@YAHPB_W@Z")]
        extern static public int acedPostCommand(string strExpr);
First of all check EntryPoint string for AutoCAD x64. It's look like EntryPoint = "?acedPostCommand@@YAHPEB_W@Z"
« Last Edit: February 07, 2011, 09:24:55 AM by Alexander Rivilis »

teslaxx

  • Guest
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #17 on: February 07, 2011, 09:58:01 AM »
Thank you Alex. Now, I can load the .dll file and I can see the menu.
But..
When I enter the command from the menu, it's dies instantly.
When I enter the command in the command menu, it's show "Select the..." and after 1 seconds, it's dies.

Alexander Rivilis

  • Bull Frog
  • Posts: 214
  • Programmer from Kyiv (Ukraine)
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #18 on: February 07, 2011, 10:19:40 AM »
Sorry. I has not AutoCAD x64. That is why I can not test your's code. Try to start transaction AFTER selection of entities.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #19 on: February 08, 2011, 05:04:05 AM »
I haven't looked closely at the code yet ..

Your pre-compiled debug DLL loaded into AC2011 x64

The Menu Loads and can be accessed via Right-Click
I got this while running myMethod after selecting 2 lines.
Quote
************** Exception Text **************
System.MissingMethodException: Method not found: 'Void Autodesk.AutoCAD.DatabaseServices.Entity.IntersectWith(Autodesk.AutoCAD.DatabaseServices.Entity, Autodesk.AutoCAD.DatabaseServices.Intersect, Autodesk.AutoCAD.Geometry.Point3dCollection, Int32, Int32)'.
   at MyNameSpace.Helper.Intersectare(Entity entity1, Entity entity2)
   at MyNameSpace.Helper.myMethod() in C:\Users\iMac\Documents\Visual Studio 2008\Projects\MiniSolution\MiniSolution\Helper.cs:line 54
   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.CommandThunk.Invoke()


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4952 (win7RTMGDR.050727-4900)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll
----------------------------------------
acdbmgd
    Assembly Version: 18.1.0.0
    Win32 Version: 18.1.49.0.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202011/AcdbMgd.DLL
----------------------------------------

Have you tried to debug this yourself ??

« Last Edit: February 08, 2011, 05:10:59 AM by Kerry »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

teslaxx

  • Guest
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #20 on: February 10, 2011, 01:48:34 AM »
I haven't had the time for this problem.
Now, I have :)

I know I receive a similar exception (referring to IntersectWith method) and I changed the references from ObjectARX 2011 to 2010 and it worked.

n.yuan

  • Bull Frog
  • Posts: 348
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #21 on: February 10, 2011, 10:42:50 AM »
Are you saying that in spite using AutoCAD2011, you have to use AutoCAD2010's DLLs as references (because of Win7 64-bit)? It is strange, isn't it?


I haven't had the time for this problem.
Now, I have :)

I know I receive a similar exception (referring to IntersectWith method) and I changed the references from ObjectARX 2011 to 2010 and it worked.

Alexander Rivilis

  • Bull Frog
  • Posts: 214
  • Programmer from Kyiv (Ukraine)
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #22 on: February 10, 2011, 10:53:52 AM »
I haven't had the time for this problem.
Now, I have :)

I know I receive a similar exception (referring to IntersectWith method) and I changed the references from ObjectARX 2011 to 2010 and it worked.
AutoCAD 2011 Update 1.1 must resolve this problem.

teslaxx

  • Guest
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #23 on: February 11, 2011, 06:49:37 AM »
Are you saying that in spite using AutoCAD2011, you have to use AutoCAD2010's DLLs as references (because of Win7 64-bit)? It is strange, isn't it?

No. When I changed the references from ObjectARX 2010 to ObjectARX 2011, I observed that exception when I was using the IntersectWith method.
So, I was received this error, no matter what operating system I was using.

...
Have you tried to debug this yourself ??

I don't have a Windows 7 on 64bits at my disposal. The only thing I can do is asking the person to run my dll. :)



AutoCAD 2011 Update 1.1 must resolve this problem.

I will try your suggestion. :)

Thank You for your responses! :) Have a nice week-end.

deathman20

  • Guest
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #24 on: February 16, 2011, 01:48:57 PM »
Now I have XP 64-bit here running 2010 Mechanical and I ran it and worked no problem.

Mind you its not Win7 and its not 2011.  Though just wanted to say it did work :)

web30

  • Guest
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #25 on: April 19, 2011, 01:17:33 PM »
Are you saying that in spite using AutoCAD2011, you have to use AutoCAD2010's DLLs as references (because of Win7 64-bit)? It is strange, isn't it?

No. When I changed the references from ObjectARX 2010 to ObjectARX 2011, I observed that exception when I was using the IntersectWith method.
So, I was received this error, no matter what operating system I was using.

...
Have you tried to debug this yourself ??

I don't have a Windows 7 on 64bits at my disposal. The only thing I can do is asking the person to run my dll. :)



AutoCAD 2011 Update 1.1 must resolve this problem.

I will try your suggestion. :)

Thank You for your responses! :) Have a nice week-end.



Did this issue get resolved? I'm having the exact same problem. I've tried everything everyone has suggested, up to the AutoCAD 2011 update and recompiling with the 2011 objectARX, which will be the next step for me.

Thanks..

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #26 on: April 19, 2011, 02:34:23 PM »
Hi,

Isn't this related to the fact the Entity.IntersectWith() method has different signatures for 32 and 64 bit platforms ?
The Entity.IntersectWith() two last arguments are typed as Int32 on 32 bit and Int64 on 64 bits.

Tony Tanzillo provided a 'PlatformCompatibilityExtensionMethods' static class to insure a compatible method: C# and VB.
Speaking English as a French Frog

web30

  • Guest
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #27 on: April 19, 2011, 02:57:52 PM »
I don't have Entity.IntersectWith() in my code. My dll does, however run under 32 bits on XP with AutoCAD 2010, but the same code gives me "unknown command" when run under 64bit on Windows7 and AutoCAD 2011.

web30

  • Guest
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #28 on: April 19, 2011, 04:12:48 PM »
I'm attaching a copy of the code. I tried the AutoCAD update, but that didn't make a difference. I also tried both the 2010 and 2011 ObjectARX references; it doesn't make a difference.

I am compiling with Vis Studio 2008 on 32bit XP machine. My client is running W7, 64-bit 2011 AutoCAD Mechanical with update 1 (which includes update 1.1 for AutoCAD). I have access to a test machine that's running XP, AutoCAD 2011 (not mechanical), 32 bit, and this code works on that machine, compiled with ObjectARX 2010.

This code is copied from the video that shows how to convert VBA to VB.Net; it's in several places on the web. And it works on my test machine, but not on my client's machine.

The specific line of code that's creating the error is:

aDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.AcadDocument

If I comment out that line, recompile, netload my dll, and type TST, I get "This is a TST command". However, the BeginCommand and EndCommand code still don't display Begin and End Command.

If I leave that line in the code, recompile and netload my dll, and type TST, I get "unknown command".

So.. it's got something to do with referencing the acadDocument. But again, it works on my test machine - just not my client's.

Any ideas?

Thanks for your time.

n.yuan

  • Bull Frog
  • Posts: 348
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #29 on: April 19, 2011, 07:00:58 PM »
Why you have to use COM API (AcadApplication/AcadDocument) and handle the COM object event? COM API code, not like .NET code that works with both 32-bit and 64-bit system, is bit-specific. Since you develop with 32-bit Acad, it would not run with 64-bit AutoCAD.

You can do what you want (catch event before and after a command is executed) with pure .NET API: Document.CommandWillStart/CommandEnded.

I am pretty much against the propaganda of saying how easy it would be to move VBA code to .NET code. Most of such saying is abuse COM API and does learning AutoCAD .NET API programming bad than good.


I'm attaching a copy of the code. I tried the AutoCAD update, but that didn't make a difference. I also tried both the 2010 and 2011 ObjectARX references; it doesn't make a difference.

I am compiling with Vis Studio 2008 on 32bit XP machine. My client is running W7, 64-bit 2011 AutoCAD Mechanical with update 1 (which includes update 1.1 for AutoCAD). I have access to a test machine that's running XP, AutoCAD 2011 (not mechanical), 32 bit, and this code works on that machine, compiled with ObjectARX 2010.

This code is copied from the video that shows how to convert VBA to VB.Net; it's in several places on the web. And it works on my test machine, but not on my client's machine.

The specific line of code that's creating the error is:

aDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.AcadDocument

If I comment out that line, recompile, netload my dll, and type TST, I get "This is a TST command". However, the BeginCommand and EndCommand code still don't display Begin and End Command.

If I leave that line in the code, recompile and netload my dll, and type TST, I get "unknown command".

So.. it's got something to do with referencing the acadDocument. But again, it works on my test machine - just not my client's.

Any ideas?

Thanks for your time.


web30

  • Guest
Re: Dll files are not loaded by Autocad 2011 Windows7 on 64bits
« Reply #30 on: April 19, 2011, 07:52:42 PM »
I thought as long as you included the 64-bit references instead of the 32-bit, it would still work. Is this incorrect?

I will try changing the begin/end to the document.commandWillStart/CommandEnded, as you suggested.

I still need thisDrawing.adoc set, though, since it's used in a few hundred places in the code. Or is there a way around it without using COM API? How else can you reference it?