Results 1 to 9 of 9

Thread: custom app crashes when run in new drawing

  1. #1
    Member
    Join Date
    2010-08
    Posts
    40
    Login to Give a bone
    0

    Default custom app crashes when run in new drawing

    So I'm novice at .NET and have written an app that loads a windows form, inserts several blocks depending on button click, rotates them then counts them up. it seems to be working fine. The occasional problem is when i start or open up a different drawing, running the app (always running from command line) will cause autocad to crash. Now if i go back in and open up the drawing it crashed on, it works fine and then may work on a second drawing fine. So questions, has anyone else experienced this? Is this due to the app being still resident after the first run? Am i missing some code when i hit the exit button to clear it out? (im guessing here) Anyways the code is attached for those that would like to look at it. Oh and im running in C3D 2011, compiled in .NET Framework 4.
    Attached Files Attached Files

  2. #2
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: custom app crashes when run in new drawing

    Firstly, I am new to .NET myself... But this line from your post jumps out to me:

    Quote Originally Posted by cmccartney View Post
    Oh and im running in C3D 2011, compiled in .NET Framework 4.
    2011 products are .NET 3.5, 2012 & 2013 are .NET 4.0, and 2014 is expected to be .NET 4.5.

    Open your project, and change it to compile to .NET 3.5, then rebuild the binary (you'll probably need to close the project, and reopen first).

    HTH
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  3. #3
    Member
    Join Date
    2010-08
    Posts
    40
    Login to Give a bone
    0

    Default Re: custom app crashes when run in new drawing

    Hrmm interesting i was able to run it at all under 4, howerver recompling under 3.5 did not help.

  4. #4
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: custom app crashes when run in new drawing

    I've downloaded the ZIP file you posted, and will try to look it over tonight after work.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  5. #5
    Member
    Join Date
    2010-08
    Posts
    40
    Login to Give a bone
    0

    Default Re: custom app crashes when run in new drawing

    i forgot the source block file, you will need this to test
    Attached Files Attached Files

  6. #6
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: custom app crashes when run in new drawing

    Quote Originally Posted by cmccartney View Post
    i forgot the source block file, you will need this to test
    ... Got it.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  7. #7
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: custom app crashes when run in new drawing

    At the quick glance I see the main reason to crash your application.
    If you use code block " Using... End Using" you do not have never to
    dispose this object, e.g.

    Using tr as Transaction=...
    remove from there: tr.Dispose()
    End using

    Same way for all other objects in similar code blocks
    Hope this helps,

    ~'J'~

  8. #8
    Member
    Join Date
    2010-08
    Posts
    40
    Login to Give a bone
    0

    Default Re: custom app crashes when run in new drawing

    hrmm i see what your saying, but does not fix the problem. i just went four drawings then crash, restarted then crashed on second drawing again sheesh.

  9. #9
    Member
    Join Date
    2010-08
    Posts
    40
    Login to Give a bone
    0

    Default Re: custom app crashes when run in new drawing

    oookay after playing with the code some more i think i solved it, now going on ten coninous drawings started or opened through various methods, no crashes.
    This was the bugger in question:
    Code:
    Blockname = Nothing
    wierd right? i was trying to clear the variable before my next button click, this along with the tr.dipose that i got rid of seems to have fixed it. (Also re-wrote the layer checking section)
    Here's the new code for anyone who wants to take a look.
    so color this post solved!
    Attached Files Attached Files

Similar Threads

  1. 2014: AutoCAD 2014 - Migrate Custom Settings Crashes
    By magnusonzach in forum AutoCAD General
    Replies: 6
    Last Post: 2014-04-15, 02:22 PM
  2. ACA2012 Crashes on drawing open
    By pbeal in forum ACA General
    Replies: 5
    Last Post: 2012-05-23, 05:10 PM
  3. AutoCAD Crashes on close of a drawing
    By ReachAndre in forum AutoCAD General
    Replies: 11
    Last Post: 2011-08-18, 05:56 PM
  4. Replies: 4
    Last Post: 2009-09-03, 12:56 PM
  5. a drawing crashes some ADT2007s not others - clues anyone
    By markjohn.perry in forum ACA General
    Replies: 2
    Last Post: 2007-05-17, 05:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •