Needed: Working .NET example

Discussion in 'AutoCAD' started by Frank Oquendo, Sep 8, 2004.

  1. I've been all over these groups and ADN.

    I've yet to encounter one working example of adding commands to AutoCAD
    with .NET. Not even Autodesk's own documentation can decide whether
    command methods should be static or instance members.

    MgdDbg doesn't work either no matter what references I change.

    Can anyone help?
     
    Frank Oquendo, Sep 8, 2004
    #1
  2. Frank Oquendo

    Jim Awe Guest

    Twice it has happened to me that NETLOAD appears to load MgdDbg, but then
    none of the commands work. The key is whether it prints out the "Loading
    MgdDbg..." message.

    I couldn't figure it out until I found a message in the debugger saying that
    there was a mismatch in versions for acdbmgd.dll. We switch to a new
    version of AutoCAD every week as they are being built. Because .NET apps
    copy their dependent DLLs local, there can exist two copies of the DLL (one
    where AutoCAD expects it, and one where your app copied it). The two times
    I had a problem, the AutoCAD-local copy was newer than the one in my app's
    bin directory. When it goes to load, there is a mismatch.

    So, the only advice I can offer is to look for debugger messages that might
    tip you off, and to look for extra copies of acmgd.dll and acdbmgd.dll. If
    you find them anywhere but the AutoCAD directory (where acad.exe is) delete
    them and rebuild.

    I realize you are a little frustrated, but I can assure you it isn't a
    catastrophic flaw in the samples. I've been working on MgdDbg (and other
    samples) all day, every day for the past two months and I don't have any
    problems. There is just something up with your machine/setup.

    Keep us posted on whether you find any clues as to what might be wrong.

    Jim Awe
    Autodesk, Inc.
     
    Jim Awe, Sep 9, 2004
    #2
  3. Jim might be on to something with the mgds or it could be sp2 of xp because
    your sample runs fine! All I did was remove and reattach the mgd refs.
    Funny thing though is it caused a GPF the first time I tried it - but it
    could be error handling as I accdentally selected something w/o xdata =)

    -- Mike
    ___________________________
    Mike Tuersley
    CADalyst's CAD Clinic
    Rand IMAGINiT Technologies
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Sep 9, 2004
    #3
  4. That's the only part of MgdDbg or my app that works. None of the
    commands do.
    I searched my machine and deleted all copies of acmgd.dll and
    acdbmgd.dll which did not reside in an AutoCAD folder (I have several
    AutoCAD verticals installed).

    Next, I removed the references to said libraries and pointed to the ones
    located in my MDT installation folder. I noticed that the IDE did not
    perform a local copy (they're registered in the GAC).

    I launched AutoCAD, attached to the process, used NETLOAD and actually
    hit a breakpoint which allowed me to step into the initialization code
    so everything was copastetic up to that point.

    Still no joy with any of the commands.
    All my Autodesk apps are stock installs and I'm running C# 2003
    (Standard Edition), v 1.1 of the .NET Framework all on Windows XP, SP2.
     
    Frank Oquendo, Sep 9, 2004
    #4
  5. See below:
    [ALBERT:] They can be both. If the command method is an instance member than
    the enclosing class is instantiated for each document.
    [ALBERT:] Do this:
    1. Attach the managed debugger to AutoCAD before you load your application.
    2. Choose the Debug/Exception menu item in the debugger (VS 2002/2003/2005)
    and make sure that you break into the debugger on all managed exceptions.
    3. Load your app. ->The debugger should come up. ->post the stack you get.

    Albert
     
    Albert Szilvasy \(Autodesk\), Sep 13, 2004
    #5
  6. 'DefaultDomain': Loaded
    'c:\windows\microsoft.net\framework\v1.1.4322\mscorlib.dll', No symbols
    loaded.
    'DefaultDomain': Loaded 'c:\program files\autodesk\mdt
    2005\acdbmgdhost.dll', No symbols loaded.
    'DefaultDomain': Loaded 'C:\Program Files\Autodesk\MDT
    2005\acdbmgd.dll', No symbols loaded.
    'DefaultDomain': Loaded 'C:\Program Files\Autodesk\MDT 2005\acmgd.dll',
    No symbols loaded.
    'DefaultDomain': Loaded
    'c:\windows\assembly\gac\system\1.0.5000.0__b77a5c561934e089\system.dll',
    No symbols loaded.
    'DefaultDomain': Loaded
    'c:\windows\assembly\gac\system.xml\1.0.5000.0__b77a5c561934e089\system.xml.dll',
    No symbols loaded.
    'DefaultDomain': Loaded
    'c:\windows\assembly\gac\system.windows.forms\1.0.5000.0__b77a5c561934e089\system.windows.forms.dll',
    No symbols loaded.
    'DefaultDomain': Loaded
    'c:\windows\assembly\gac\system.drawing\1.0.5000.0__b03f5f7f11d50a3a\system.drawing.dll',
    No symbols loaded.
    'DefaultDomain': Loaded
    'c:\windows\assembly\gac\acdbmgd\16.1.63.0__7208edf2a10162b1\acdbmgd.dll',
    No symbols loaded.
    'DefaultDomain': Loaded 'c:\program files\autodesk\mdt
    2005\aclayer.dll', No symbols loaded.
    'DefaultDomain': Loaded
    'c:\windows\assembly\gac\acmgd\16.1.63.0__7208edf2a10162b1\acmgd.dll',
    No symbols loaded.
    'DefaultDomain': Loaded 'c:\program files\autodesk\mdt
    2005\en-us\aclayer.resources.dll', No symbols loaded.
    'DefaultDomain': Loaded 'C:\Program Files\Autodesk\MDT
    2005\vaac_util.dll', No symbols loaded.
    'DefaultDomain': Loaded 'C:\Program Files\Autodesk\MDT
    2005\vaac_SharedLib7_0.dll', No symbols loaded.
    A first chance exception of type 'System.IO.FileNotFoundException'
    occurred in mscorlib.dll

    Additional information: File or assembly name MgdDbg, or one of its
    dependencies, was not found.
     
    Frank Oquendo, Sep 13, 2004
    #6
  7. It looks like someone registered acdbmgd.dll and acmgd.dll in the GAC on
    your machine. This is double plus no good. You must unregister both to get
    your AutoCAD to work properly. Issue the following commands in a command
    window:

    gacutil /u acmgd, Version=16.1.63.0, Culture=neutral,
    PubliKeyToken=7208edf2a10162b1
    gacutil /u acdbmgd, Version=16.1.63.0, Culture=neutral,
    PubliKeyToken=7208edf2a10162b1

    Albert

     
    Albert Szilvasy \(Autodesk\), Sep 13, 2004
    #7
  8. I recently performed a reinstallation of Inventor Professional 9 after
    uninstalling and rebooting.

    I can only assume something in the install registered acmgd.dll and
    acdbmgd.dll into the GAC.

    Unregistering them solved the problem and commands are now working
    correctly.

    Thanks for the tip.
     
    Frank Oquendo, Sep 14, 2004
    #8
  9. Hi Frank,

    i had the same problem two or three weeks ago. After installing IV9 all my nice AutoCAD.NET samples didn't work any more because of broken references (especially the COM Interop refs). I was somewhat concerned. But next day I had to install 2005 German - after that installation everything worked fine again. No idea what it was...

    Axel
     
    Axel Strube-Zettler, Sep 15, 2004
    #9
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.