ObjectARX

Reply
Active Member
SAJalali
Posts: 9
Registered: ‎07-10-2011
Message 1 of 8 (201 Views)

FATA error when saving custom object

201 Views, 7 Replies
09-24-2012 02:51 AM

Hi.

I have derived an object from AcDbEntity. whenever the save command is issued in debug time, I get this exception :

"First-chance exception at 0x000007fefd6faa7d in acad.exe: Microsoft C++ exception: _com_error at memory location 0x2c2fea00.."

the callStack breaks at:

>    KernelBase.dll!000007fefd6faa7d()     

and dissassembly at this:

"000007FEFD6FAA7D 48 81 C4 C8 00 00 00 add         rsp,0C8h "

The problem leads to this error when running autoCAD out of debugging environment:

"FATAL ERROR: Unhandled Access violation reading 0xffffffff exception at 77521e02h"

I have put break points at dwgOutFields() method of the custom class and the exception occurres after passing the control to the caller.

 

Thank you in advance.:smileyhappy:

Valued Mentor
owenwengerd
Posts: 496
Registered: ‎08-06-2002
Message 2 of 8 (189 Views)

Re: FATA error when saving custom object

09-24-2012 05:01 AM in reply to: SAJalali

It's not clear why you think the _com_error exception is related to the fatal error. Set your debugger to break at the access violation exception, then check the call stack to find the context within your code where the exception occurs.

--
Owen Wengerd
ManuSoft
Active Member
SAJalali
Posts: 9
Registered: ‎07-10-2011
Message 3 of 8 (174 Views)

Re: FATA error when saving custom object

09-24-2012 10:17 PM in reply to: owenwengerd

Thanks Owen for your reply.

I set the debugger to break at access violation through: "debug->exceptions->win32 exceptions->c000005 access violation" but the debugger did not break. Actually the program is built in debug version. When I run it directly from AutoCAD the fatal error window appears. however, debugging with all the exceptionsturnes on leads only to the exception I mentioned before and the error window does not come up in autoCAD.

The output window shows the same exception too.

I forgot to say I am using objectARX 2012 with visual studio 2010. I have a class derived from AcDbEntity which itself is parent of 6 more classes that overwrite som of the methods.

 

Thank you.

Active Member
SAJalali
Posts: 9
Registered: ‎07-10-2011
Message 4 of 8 (171 Views)

Re: FATA error when saving custom object

09-24-2012 10:46 PM in reply to: SAJalali

It should be added that I am working in windows7 64-bit.

 

Thanks and Regards

Moderator
Alexander.Rivilis
Posts: 1,346
Registered: ‎04-09-2008
Message 5 of 8 (163 Views)

Re: FATA error when saving custom object

09-25-2012 06:59 AM in reply to: SAJalali

Do I understand correctly that you are using:
1) ObjectARX 2012
2) AutoCAD 2012
3) VS 2010 without installed VS 2008 SP1?
If so, then you will not work without VS 2008 SP1.


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Valued Mentor
owenwengerd
Posts: 496
Registered: ‎08-06-2002
Message 6 of 8 (158 Views)

Re: FATA error when saving custom object

09-25-2012 08:14 AM in reply to: Alexander.Rivilis

If the bug is not evident in your debug build, then you have to debug your release build instead. Add debug information to your release build to make it easier.

--
Owen Wengerd
ManuSoft
Active Member
SAJalali
Posts: 9
Registered: ‎07-10-2011
Message 7 of 8 (152 Views)

Re: FATA error when saving custom object

09-25-2012 09:08 PM in reply to: owenwengerd

Thank you all for your kind helps.

After removing all components and sequentially assembling them testing the program after adding each library, I finally found the error cause. In a routine -which was written long time ago when I was so beginner and the program was still too small- I had allocated memory dynamically to a string and returned the pointer to the new string. However, deallocating the memory by the caller was omitted in the program. calling the routine times and times in each dwgOutFields() call, accumulatedly used up the stack. A problem in which AutoCAD seems to suffer from extra sensitivity as some other posts comply too.

About the _com_error, it still persists to come up but the fatal error has been solved.

 

Thank you again

Alireza

 

ADN Support Specialist
Balaji_Ram
Posts: 609
Registered: ‎03-21-2011
Message 8 of 8 (135 Views)

Re: FATA error when saving custom object

10-01-2012 08:48 AM in reply to: SAJalali

Hi Alireza,

 

Such issues are hard to spot. Here are few suggestions :

 

1. Check to see if you have left any AutoCAD entities without closing them. Although you might be thinking that the error is during saving it could well be from an db operation performed earlier. Watch this recording :

http://through-the-interface.typepad.com/through_the_interface/2007/10/autocad-10-easy.html

You may find some clue if it is similar to what your app does. It is mainly to do with .Net API but some concepts are relevant to OARX.

 

2. As you said your class is the base class to several other classes. Narrow down on which entity is causing the save to fail. This might require some iterations to figure out.

 

3. Since you have mentioned that it does not crash when in debug mode, resort to logging messages. Use "acutPrintf" in places to track the flow before the crash happens.

 

Hope it helps.

 

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community