KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have some code that is using reflection to pull property values from an object. In some cases the properties may throw exceptions, because they have null references, etc. object result; try { result = propertyInfo.GetValue(target, null); } catch (TargetInvocationException ex) { result = ex.InnerException.Message; } catch (Exception ex) { result = ex.Message; } Ultimately the code works correctly, however when I am running under the debugger: When the property throws an exception, the IDE drops into the debugger as if the exception was uncaught. If I just hit run, the program flows through and the exception comes out as a TargetInvocationException with the real exception in the InnerException property. How can I stop this from happening?
Tags (comma-separated)
Save Edits
Cancel