Search Issue Tracker
By Design
Votes
0
Found in
2017.4.0f1
2018.4.0f1
2019.2.0a1
2019.2.5f1
2019.3.0a1
2020.1.0a1
Issue ID
1184635
Regression
No
Assert Exceptions in Finalizers are not logged to Console
Steps to reproduce:
1. Download attached project
2. Open 'SampleScene' scene
3. Enter play mode
Actual results: Notice that the Assertion Exceptionisn't printed.
AssertionException: Assertion failure. Value was False
Expected: True
~AssertFinalizedClass(True)
at UnityEngine.Assertions.Assert.Fail (System.String message, System.String userMessage) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.Assertions.Assert.IsTrue (System.Boolean condition, System.String message) [0x00000] in <00000000000000000000000000000000>:0
at AssertFinalizedClass.Finalize () [0x00000] in <00000000000000000000000000000000>:0
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
System.Xml.OnDefaultAttributeUseDelegate:Invoke(IDtdDefaultAttributeInfo, XmlTextReaderImpl)
Reproduced with: 2020.1.0a4, 2019.3.0b4, 2019.2.6f1, 2018.4.9f1, 2017.4.32f1
Note:
- This AssertionException is printed in Standalone, UWP, iOS players.
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
- Test Runner’s vertical scrollbar overlaps with the up and down arrows and upper toolbar tabs when the window is minimized
- The Input Field view is not updated when deleting lines of text
- The scrollbar does not respect empty lines in the Input Field
- “Texture Atlas Viewer“ button text overlaps another button when the UI Toolkit Debugger is narrowed
- Thresholds are no longer automatically calculated after deleting Motion fields in Blendtrees
Resolution Note:
Assert logic can either Debug.Log, and continue, or raise an exception and stop
Finalizer calls are called by Mono when the GC is collecting. and unhandled Exceptions do not get outputted to the log when they are in Finalizers.
Exceptions should not be thrown in the Finalizer. If one wants Assert in Finalizers, always set the raiseExceptions to false before.