Error that I cannot find where is from

ADO DOT NET

Centurion
Joined
Dec 20, 2006
Messages
160
Hi,
I run my code and while everything should be OK, the code runs without any problem, I don't get any warning or error.
But just in immediate window I get a list of errors that I cannot find where are they from?
I put a breakpoint and even could not catch the error.
Even Catch Ex as Exception didn't fire when this list get some errors!
Interesting is that my code runs properly, and no warning or error is received, just immediate window!
What should I do? :(
 

Attachments

Sometimes errors are thrown and caught completely within DotNet Framework code. The big idea behind exceptions is that you can have an error and try handle it gracefully. That is what is happening here. An exception is being thrown by DotNet code and being caught before it reaches back to your code. Since the exception is neither fatal nor unhandled you are not supposed to have to worry about it.

In the real world, though, you do have to worry about it a little bit, because exceptions can slow things down, and there is usually a noticable lag the first time an application throws an exception.

Story time. One time I found that there was a noticable lag when I populated a ListView in an application I was writing. A little detective work revealed that this lag only occurred when I was using visual styles. Quite curious. After changing some debugger settings (I set the debugger to break on all exceptions, without exception [no pun intended]) I found that the problem was an exception being thrown and caught inside System.Windows.Forms.dll each time I added an item to the ListView. The solution was to call BeginUpdate before adding items and EndUpdate after adding items.

I don't know what the moral of the story is, but while the exceptions are almost transparent to you and practically invisible to the end user, it can be good to try to eliminate them anyways. If you are just curious, I think I've answered your question, but if you are looking to prevent the exceptions here is what I recommend you do.

I don't know if the option is available on all versions of all lanugages, but try to set the compiler to break on all exceptions. If you are using VB, you might need to disable Just-My-Code (I'm not really even sure what, exactly, that feature does). Then you should be able to look at the stack trace when the exception is thrown and find clues as to the cause.
 
Back
Top