Exception has been thrown by the target of an invocation...

For all coding issues - MODers and programmers, HTML and more.

Moderators: Jeff250, fliptw

Post Reply
User avatar
SirWinner
DBB Fleet Admiral
DBB Fleet Admiral
Posts: 2700
Joined: Thu Nov 05, 1998 12:01 pm
Location: Oklahoma City, Oklahoma, United States of America
Contact:

Exception has been thrown by the target of an invocation...

Post by SirWinner »

Yet another .Net error that doesn't say much.

In a \"Try...End Try\" block was attempting to catch the error in VB.Net:

Try
...Some Code...
Catch ex as exception
msgbox (ex.message.tostring)
End Try

- This link helped track it down:
http://www.geekpedia.com/Question70_Exc ... ation.html

Replaced the msgbox line with:

MessageBox.Show(ex.InnerException.Message)

The \"New Message\" revealed the routine that called the routine where the error was and the line in that routine where the error occurred.

Fixed the Offending Routine (Log File Routine) by encapulating it in a \"Try...End Try\" block.

Enjoy!

:)
User avatar
Topher
DBB Alumni
DBB Alumni
Posts: 3545
Joined: Thu Nov 05, 1998 12:01 pm
Location: New York
Contact:

Post by Topher »

Even better, can't you use Visual Studio, Debug -> Exceptions and break anytime an exception is thrown? This should give you the exact location of where the exception is coming from.
User avatar
SirWinner
DBB Fleet Admiral
DBB Fleet Admiral
Posts: 2700
Joined: Thu Nov 05, 1998 12:01 pm
Location: Oklahoma City, Oklahoma, United States of America
Contact:

Post by SirWinner »

I'll try that next time... Thanks Topher!

;)
User avatar
DCrazy
DBB Alumni
DBB Alumni
Posts: 8826
Joined: Wed Mar 15, 2000 3:01 am
Location: Seattle

Post by DCrazy »

Doesn't the Locals window put the $exception on the stack so you can walk through it when your program breaks? Even less clicking :)
Post Reply