Rider incorrect detect handled and unhandled exceptions

Hello!

I see a strange situation in Rider debugger. I have code:

using (var stream = System.IO.File.OpenRead(fullname))
{
object r= bf.Deserialize(stream);
T result=null;
try
{
result = (T) r;//this is handled exeption
}
catch (Exception e)
{
result = (T) r;//this is unhandled exeption
}
finally
{
stream.Close();
}
//result = (T) r;//this is unhandled exeption
return result;
}

And I have screenshots with labels "handled" in both cases:

 

Why Rider detect this both cases as "handled"? Case inside catch block is unhandled, isn't it?

And second question: How to configure Rider for stop debugger only on unhandled exceptions in my code?

I have following options:

In Settings:

 

In Breakpoints window:

Thank you for your attention;

0
1 comment

Hi! Is it possible to share a full stack trace in the moment of InvalidCastException being thrown? You're probably handling it somewhere in your code. We also have a known issue that user-unhandled exception is marked as handled when there's an exception breakpoint (just like in your case). Repro project would help us a lot too. As for your question about stopping only on unhandled exceptions, you can disable 'Any exception' exception breakpoint.

0

Please sign in to leave a comment.