Blog Stats
  • Posts - 42
  • Articles - 0
  • Comments - 98
  • Trackbacks - 34

 

Monday, February 06, 2006

LOTD # 1 : Check the InnerException


Today, one of my teammate was getting a "TargetInvocationException" : Exception has been thrown by the target of an invocation. This reminded me of my 'initial learning curve' days in .Net when I encountered this exception, and had a really hard time fixing this one. I can't remember how we(There were other team members who worked on this as well and it was back in 2002-03) solved it.

The beauty of the problem is you wouldn't know why you are being thrown this one, inspite of things working as they should.

The lesson learned is to do in-depth (F11) debugging and check for the InnerException when you catch it (always use try catch around potentially functional code). It will excatly tell you what's wrong. Print it out (Console.WriteLine) on the output window and you'll know.

LOTD: Lesson Of The Day is a series starting on my blog.

 

 

Copyright © Vinayak