Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Debugging and output messages advice needed 1

Status
Not open for further replies.

golcarlad

Programmer
Nov 23, 2004
232
GB
Whilst I am debugging my prog I get the following errors:

Code:
A first chance exception of type 'System.ObjectDisposedException' occurred in System.Windows.Forms.dll

Code:
A first chance exception of type 'System.NullReferenceException' occurred in Foo.dll

They dont stop my code running - they just appear in the "Output" window of Visual Studio.

Whats going on? are they something I should be worried about , should I be trying to stop these type of messages occuring by more closely debugging my program and fixing the code?
 
I cant find where in the code the errors start as it just dumps them out to the output window - is there a way to set the degugger to halt even on the tiniest of errors?
 
project -> properties -> build -> treat warnings as errors -> all.

don't know if this catches first chance exceptions, though.



mr s. <;)

 
thanks mate - not sure whether that means warnings on compile?? - but anyway.

Actually found what these strange errors were. The were objects that were hanging around after a form was destroyed/closed - the form had some unmanaged COM object references that were not properly released OnDispose event - so I still had some other treenodes hanging around that were creating a System.ObjectDisposedException. Anyway I think thats what happening - 90% sure anyway - still trying to get to grips with the lower level understanding of memory storage on the heap/stack etc (oh what joy!!).
 
Run FxCop (aka CodeAnalysis) against your solution. It's pretty good at identifying areas where you need to Dispose of a resource.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
I like that FxCop - it seems to work quite well - found quite a few silly errors in the first couple of minutes which I was quite impressed with.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top