By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,725 Members | 1,094 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,725 IT Pros & Developers. It's quick & easy.

Structuring Code for Effective Debugging

P: n/a
When I'm debugging code and a runtime error occurs, Visual Studio
usually gives me a specific error message and identifies the line
which caused the error.

Sometimes, however, it does not do those things. Instead, it gives me
the generic error message "Exception has been thrown by the target of
an invocation" and identifies a line higher up in the call stack. When
this happens, it can be difficult to diagnose the cause of the runtime

1. Why do I sometimes get the generic message? What rules determine
Visual Studio's behavior in this regard?

I've found that code in New() tends to raise the generic message. If I
move the code to the Load event procedure, it tends to raise the
specific message. Because of this, I'm considering avoiding New(), and
using the Load event procedure instead.

2. Have other programmers found it necessary to avoid New(), or make
other structural decisions, to facilitate effective debugging?

Jul 26 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.