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

Looking for a list of C# errors

1 REPLY 1
Reply
Message 1 of 2
Anonymous
207 Views, 1 Reply

Looking for a list of C# errors

Hello,
I did a few years with the C++ API and had a checklist of things to check in my programs to "harden" them
so they could be counted on not to bomb out. Things like:
1) Delete for each New
2) free for each malloc
3) delete enumerators
etcetera.

I have been using C# for over a year now and I am still not sure about what I need to do to "harden" the programs
I write. I thought the Garbage Collector was supposed to handle any concerns with memory. I understand that if
I do any memory intensive usage that I may have to Garbage Collect on my own. I use transactions on every database
operation and file operation. I know that I should do a try-catch-(finally) on anything doubtful. I know that I need to
-= any events that I += . I know that I have to need to make sure that I am conscious of which database is being
using in an MDI environment. I know I don't want to get caught in an endless loop, or get lost in recursion.

My question is, is there anything else I should be concerned with in order to "harden" a program so that I can count
on it not to bomb? Does anybody have a checklist they could offer of everything that should be checked?

I have this feeling I am missing something. That feeling is corroborated when one of the programs I have written bombs out. Then
I know I am missing something. I have several programs I have written that are doing this. I have most of them to the point that they only bomb when I am closing the drawing or exiting AutoCAD, or sometimes when I am opening a new drawing. So the functionality is there,
but its still bombing on the close.

Thanks for your insight, Tumpliner
1 REPLY 1
Message 2 of 2
Anonymous
in reply to: Anonymous

I don't know of any checklist, but from the symptoms you describe, there is
clearly something you should be cleaning up (errors when AutoCAD shuts
down), or you are trying to use something that no longer exists (like
something in a drawing that has been closed).

Event handlers are usually where the latter type of bug manifests. If you
use objects that implement IDisposable, you need to make sure you call their
Dispose() method, even if the code terminates abnormally because of an
exception. The most reliable way to ensure that Dispose() is called, is to
use the using(){..} construct, because it guarantees that Dispose() is
called regardless of how the code exits the using() block.

Beyond that, no one can tell you why your code bombs without seeing it, or
running AutoCAD in the debugger. In many cases, you can find out what's
causing AutoCAD to crash when you close it, by running your code in the
debugger. In some cases AutoCAD cannot deal with managed exceptions and will
often crash when one occurs, even though that shouldn't happen.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6305439@discussion.autodesk.com...
Hello,
I did a few years with the C++ API and had a checklist of things to
check in my programs to "harden" them
so they could be counted on not to bomb out. Things like:
1) Delete for each New
2) free for each malloc
3) delete enumerators
etcetera.

I have been using C# for over a year now and I am still not sure about what
I need to do to "harden" the programs
I write. I thought the Garbage Collector was supposed to handle any concerns
with memory. I understand that if
I do any memory intensive usage that I may have to Garbage Collect on my
own. I use transactions on every database
operation and file operation. I know that I should do a try-catch-(finally)
on anything doubtful. I know that I need to
-= any events that I += . I know that I have to need to make sure that I am
conscious of which database is being
using in an MDI environment. I know I don't want to get caught in an endless
loop, or get lost in recursion.

My question is, is there anything else I should be concerned with in order
to "harden" a program so that I can count
on it not to bomb? Does anybody have a checklist they could offer of
everything that should be checked?

I have this feeling I am missing something. That feeling is corroborated
when one of the programs I have written bombs out. Then
I know I am missing something. I have several programs I have written that
are doing this. I have most of them to the point that they only bomb when I
am closing the drawing or exiting AutoCAD, or sometimes when I am opening a
new drawing. So the functionality is there,
but its still bombing on the close.

Thanks for your insight, Tumpliner

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