Search Issue Tracker
Won't Fix
Votes
1
Found in
2017.1.1f1
Issue ID
949370
Regression
No
Assertions always throw exceptions when debugging scripts and ignore the Assert.raiseExceptions property
How to reproduce:
1. Download attached project file and open "Main" Scene
2. Select the GameObject named "GameObject" in order to display its editor in the inspector and enter Play Mode.
3. Check "Generate Assertions" in Inspector Window (Notice how the console logs "Assertion failed: Assertion failure. Value was True. Expected: False")
4. Check "Assert Raise Exceptions" in Inspector Window (Notice how the console now logs "AssertionException: Assertion failure. Value was True. Expected: False")
5. Exit Play Mode and open the C# project using Visual Studio (2015 or 2017)
6. Activate script debugging, return to Unity and enter Play Mode again
7. Check "Generate Assertions" in Inspector Window (Notice how the console logs "AssertionException: Assertion failure. Value was True. Expected: False" instead of the correct "Assertion failed, ...")
Expected result: Behaviour of assertions should not change whether the script debugging is enabled or not.
Actual result: Checking "Assert Raise Exceptions" or not does not change anything when debugging scripts, assertions always raise exceptions. This isn't ideal when debugging because exceptions stop the script execution.
Reproduced with: 5.5.4p3, 5.6.3p3, 2017.1.1p1, 2017.2.0b11, 2017.3.0a7
Comments (1)
-
qwertyman
Dec 23, 2017 09:23
When I have a debugger attached I find that assertions always throw exceptions regardless of the Assert.raiseExceptions property. This behavior is not present when a debugger is not attached.
This may be intentional in order to trigger a break in execution when an assertion fails. If this is the case it should definitely be documented in the Assert.raiseExceptions page.
I have observed this using Unity 5.6.4p4 using JetBrains Rider as my IDE.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Undoing Animator Parameter name change breaks references to it
- Crash on BV4_OverlapBoxAll when moving in play mode
- Custom mesh water surface normal map fades out when Y Position increases
- Sprite renderer does not issue draw calls correctly when using SRP Batcher
- [Android] Flickering artifacts when using "ScriptableRenderer.EnqueuePass(RenderPassEvent.BeforeRenderingPostProcessing)" multiple times
Resolution Note:
This particular case has been investigated thoroughly and we have decided, in the interests of protecting the stability and features of Unity for users that rely upon the affected versions, to not address this fix for the time being. We understand that this will cause problems for some users, and so may address in a future version.