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
- Shader Compilation for projects with lots of Shaders can be slow (i.e. VFX Graph asset heavy projects)
- Crash on RebuildTransformHierarchyOrMarkForDestruction when opening a scene
- The Editor hangs when opening a project that uses local packages and Version Control
- Area Light is culled when Camera Frustrum is outside the lights range
- The characters of the bottom option in the Scene View Debug Draw Mode dropdown menu are cut off
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.