Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent break on unhandled ExitGUIException #2119

Merged
merged 3 commits into from
Jul 12, 2021

Conversation

citizenmatt
Copy link
Member

The Unity 2021.2 beta has an upgraded Mono which now reports unhandled exceptions to the debugger. The previous Mono version (~5.12ish) didn't report unhandled exceptions. This old behaviour does not appear to be deliberate or intentional, and it's not yet clear if this behaviour will be rolled back or not.

However, it has the consequence that the debugger will now frequently stop on unhandled ExitGUIExceptions. These are used as control flow exceptions, thrown in managed code and caught in native code (and therefore considered "unhandled" by Mono and Rider) in order to cancel behaviour in the GUI. The exception is thrown frequently as the user works with the Inspector and other windows, and makes using the Unity editor while debugging very annoying. This PR will ignore any unhandled ExitGUIExceptions for Unity projects.

If the behaviour is rolled back (or even back ported to older Unity versions), the feature is safe - it will only suppress unhandled exceptions with a full name of UnityEngine.ExitGUIException. If Unity stop reporting the exception, there will be no exception to match.

Note that this Unity change also means that Rider will break on unhandled exceptions that the user throws, which is a change in behaviour from previous versions. Ironically, this release of Rider suppresses unhandled exceptions in IL2CPP, which has always reported them to the debugger, to better match the old editor behaviour (and it also helps avoid situations with empty call stacks due to exceptions being thrown in library code that IL2CPP doesn't generate debug information for, and/or which doesn't have any managed code to decompile and show). This feature is enabled by default but can be disabled in the settings. We can re-evaluate the default setting for the next release, depending on what Unity decides should be their default unhandled exception strategy.

The behaviour for unhandled exceptions has changed in the Unity 2021.2 beta, thanks to a Mono upgrade. ExitGUIException is frequently thrown in the GUI, but handled in native code. Mono now reports this as an unhandled exception, which is very annoying and makes it hard to use the editor while debugging.
@citizenmatt citizenmatt added this to the Rider 2021.2 milestone Jul 12, 2021
@citizenmatt citizenmatt self-assigned this Jul 12, 2021
@citizenmatt
Copy link
Member Author

See also RIDER-64944

@citizenmatt citizenmatt merged commit ef1015b into net212 Jul 12, 2021
@citizenmatt citizenmatt deleted the net212-mte-unhandled-exceptions branch July 12, 2021 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants