Why is TargetInvocationException treated as uncaught by the IDE?

This seems to be “by design”. What happens is that you likely have menu Tools → Options → Debugging → General → Enable Just My Code enabled. As How to: Break on User-Unhandled Exceptions states: The Debug → Exceptions dialog shows an additional column (Break when an exception is User-unhandled) when “Enable Just My Code” … Read more

Get string name of property using reflection

If you already have a PropertyInfo, then @dtb’s answer of using PropertyInfo.Name is the right way. If, however, you’re wanting to find out which property’s code you’re currently in, you’ll have to traverse the current call stack to find out which method you’re currently executing and derive the property name from there. var stackTrace = … Read more

Setting a property by reflection with a string value

You can use Convert.ChangeType() – It allows you to use runtime information on any IConvertible type to change representation formats. Not all conversions are possible, though, and you may need to write special case logic if you want to support conversions from types that are not IConvertible. The corresponding code (without exception handling or special … Read more