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
- "Draw Additional Lights Shadowmap" calls increase when custom MaterialBlockProperty is used
- Crash on _platform_memmove when importing the "Dragon Crashers - URP 2D Sample Project" to a new 2D project
- "Shader is not supported on this GPU" warnings and and shaders are not loading when building the project for non-Chromium browsers
- [iOS][URP] The screen flickers and the "Execution of the command buffer was aborted due to an error during execution" error is thrown continuously
- Shortcut Manager shows empty conflict filter when resolving runtime conflicts involving different contexts
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.