How to mark a method as "ignore all handled exception" + "step through"? Even when user has selected
- by Wolf5
I want to mark a method as "debug step through" even if an exception is thrown (and catched within) the function.
This is because 99% of the times I know this function will throw an exception (Assembly.GetTypes), and since this function is in a library I wish to hide this normal exception. (Why did MS not add an exceptionless GetTypes() call?)
I have tried this but it still breaks the code when debugging:
[DebuggerStepThrough]
[DebuggerStepperBoundary]
private Type[] GetTypesIgnoreMissing(Assembly ass) {
Type[] typs;
try {
typs = ass.GetTypes();
}
catch (ReflectionTypeLoadException ex) {
typs = ex.Types;
}
var newlist = new List<Type>();
foreach (var type in typs) {
if (type != null) newlist.Add(type);
}
return newlist.ToArray();
}
Anyone know of a way to make this method 100% stepthrough even if ass.GetTypes() throw an exception in debug mode? It has to step through even when "Break on Thrown exceptions" is on. (I do not need to know I can explicitly choose to ignore that exact type of exception in the IDE)