Strictly speaking, this isn’t a Rider bug, but we could definitely do something to provide a nicer experience for Unity.
The exception is thrown in managed code, but intended to be caught in native code. As such, there is no managed code to handle the exception, and so Mono and Rider treat it as an unhandled exception, and Rider will break in the debugger. In the normal .net world, an unhandled exception is a bad thing, which has a high chance of crashing your app, so it’s a good thing that the debugger stops and lets you know. Of course, Unity isn’t a normal .net app, but hosts Mono and calls your methods directly - there is no way for Rider to know that this is happening, and no way to know if an exception will be handled by the native code. So Rider is doing the best it can with the information it’s got, but in this particular scenario, it’s undesired behaviour.
You can disable this behaviour in the Preferences | Build, Execution, Deployment | Debugger settings page, with the “break on unhandled exceptions” checkbox. This has implications, though. It means that Rider will no longer break on ANY unhandled exception, for any project you open, not just this Unity project, and it might be very helpful to get these unhandled exception notifications.
We’ll improve this situation for the next Rider release (we’re just finalising Rider 2021.2, so we don’t have time to get it in there, so it’s likely to be 2021.3), so Rider will know to ignore unhandled ExitGuiExceptions. The checkbox is there as a workaround for now. (The issue to track is RIDER-64944).
Interestingly, I think Unity’s behaviour has changed recently. As part of Rider 2021.2, I’ve added support to ignore unhandled exceptions for IL2CPP players, to mimic the behaviour of the editor. I have a project with unhandled exceptions that would break when debugging in IL2CPP, but not in the editor - Mono wasn’t reporting unhandled exceptions to us. I’ll try to find out what’s changed.