I would like to test some exception handling logic in the empty catch block of the below code.
try
{
//Do Some stuff that throws a exception
//This is the code i need
}
catch (Exception)
{
//Handle things that inherits from Exception
}
catch
{
//Handle things that dont inherits from Exception
//Want to test this code
}
Starting with CLR 2.0 this is not a scenario that you need to worry about. The CLR will now automatically wrap all exceptions which do not derive from System.Exception with a new Exception of type
RuntimeWrappedException(Documentation).This wrapping can be disabled by enabling a level of application compatibility but it is certainly not the normal or common case