0

I'm not sure if I'm missing something here, but it doesn't appear to be possible to debug exceptions in Jetbrains Rider. I have an incredibly simple piece of code that throws an exception (invalid file name) and there is no way I can find to

a) stop on the exception line in my code raising the exception, and

b) view the value of any variables in my source code that may have contributed to the exception.

I've recorded a sample video here that shows the debug attempt, and why it seems illogically impossible.

Has anyone found a way of debugging this stuff? Is Rider actually broken?

Sample video showing (attempted) debug session

JSobell
  • 1,825
  • 1
  • 14
  • 10
  • Don't know what you mean: at second 12, you're actually clicking your stackframe which contains all your variables for that stackframe. But since you've enabled debugging external sources, the debugger stops where the exception occurs (which is deeper than your code) – mu88 May 03 '22 at 14:56
  • Well firstly, at 12 seconds it's showing me the Main() function with no variables, not the "FileWasCreated" function that has a variable, which is why there are no variables shown. – JSobell May 03 '22 at 23:21
  • But, I just found that the disabling 'debugging external sources' prevents any error being displayed at all, so I experimented with the Breakpoints dialog, and enabling 'CLR Exception Breakpoints/Any Exception' makes it stop correctly and show variable values. I think the most unintuitive aspect is that enabling "Only break on exceptions thrown from user code" leaves a weird state where the debugger kicks in, but gives no information about the code path involved in an exception. – JSobell May 03 '22 at 23:39
  • Thanks for giving me a suggestion. It does indeed stop deeper in the code, which is what I normally want, but what I didn't understand is why it lost all contextual information regarding the path down to that location, and that appears to be because I had "Only break on exceptions thrown from user code" enabled. The fact that enabling this drops all parent contextual data is a very unexpected side-effect! – JSobell May 04 '22 at 00:12
  • I still don't get it, but it seems that your question is solved, right? :) – mu88 May 04 '22 at 06:52

1 Answers1

0

For anyone experiencing the same situation, enable "Any Exception" and disable "Only break on exceptions thrown from user code" in Breakpoint Options. You can also (as @mu88 mentions) disable debugging of external sources, but that simply reduces the clutter in stack frames.

JSobell
  • 1,825
  • 1
  • 14
  • 10