Breakpoints view not showing ".Net Exception Breakpoints" for Unity project

I'm trying to get Rider to break on exceptions in my code, in a Unity project. https://www.jetbrains.com/help/rider/Debugging_Exceptions.html appears to cover this but I'm not seeing a .NET Exception Breakpoint section in the breakpoints view. Ummm ...

There is a 'CLR Exception Breakpoints' section ... setting that up with an 'any exception' rule does nothing unless I untick 'Only in my code' at which point it'll start breaking on dozens of internal Unity exceptions. 

How can I add the .Net Exception Breakpoints section? Is that even the issue here? Thanks! 

6 comments
Comment actions Permalink

Hello Ben,

 

CLR Exception Breakpoints is responsible for processing .Net exceptions. If you enable the 'Only in my code' option, the debugger should only break on exceptions in your code. 

 

Let me know you want to achieve some specific behavior or in case you face any issues while using this feature.

0
Comment actions Permalink

Kirill Filin Thanks for the reply ... as I mentioned in my post, if I have 'only in my code' ticked then nothing happens, the debugger won't break on exceptions.

Here's a code example:

The line breakpoint shows up under a '.NET Line Breakpoints' section in the breakpoints view. 

"CLR Exception Breakpoints is responsible for processing .Net exceptions."

... Are you saying that this is how it's supposed to look in Rider? If so does it make sense to update the docs?

0
Comment actions Permalink

Thank you for the update, Ben. Yes, this is how it's supposed to look in Rider. Documentation will be updated as soon as possible to reflect this.

 

Regarding the exception breakpoints - could you please check if the project has been rebuilt since the last time the source was changed? I've checked the Rider's behavior using your example and got the results you want - Rider placed a breakpoint upon encountering System.DivideByZeroException.

 

Please note that if Unity was closed while you were editing the script, you might need to build the project once before starting the play session.

 

Let me know if this helps.

0
Comment actions Permalink

Hi, so this is really crazy ... I rebuilt the Exception Test project in Rider (that script above is the only thing in it + the default unity 2d project stuff) and ... no change. Then I tried re-adding the line exception breakpoint and ... it worked. Then I took the line exception breakpoint out and ... it still worked. Then I closed Rider and Unity, reopened both and ... it's stopped working again and now I can't get it to work whatever combination of rebuilding/cleaning/attaching I do.

I just have no idea what to do from here ... maybe I could try a completely clean Rider reinstall? How would I go about that? 

 

0
Comment actions Permalink

From 2020.2 EAP build 202.5792.135 release notes:

* We've fixed the issue where the debugger was sometimes treating user code as external code.

... it does indeed seem to have fixed the issue I was having - I can now break on exceptions happening in my code using that EAP build. Relief!

0
Comment actions Permalink

Hi,

 

I'm glad to know that new EAP build helped with the issue. Feel free to contact us if you have any questions.

 

Have a nice day!

0

Please sign in to leave a comment.