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
- Out-of-bounds memory access with multiple CanvasRenderers under a Canvas when using Mesh API
- Inspector tries to access file after it was deleted when the file was locked in Inspector window
- Changing Transform values in Search window Inspector loses focus while dragging and stopping mouse without releasing dragging action
- Saving changes on the dirty VFX Graph during the Play mode throws "The referenced script (Unknown) on this Behaviour is missing!" warnings
- VFX Graph Debug Info overlaps the "Initialize" block debug info by default
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.