Search Issue Tracker
By Design
Votes
0
Found in
2020.2.0a12
2020.2.0b7
2021.1
Issue ID
1286237
Regression
Yes
Exceptions during compile for ILPostProcessors with static constructors
How to reproduce:
1. Open the attached project ("New Unity Project.zip")
2. Observe compile errors
Expected results: No compile errors
Actual results: System.MissingMethodException is thrown
Reproducible with: 2020.2.0a12, 2020.2.0b9, 2021.1.0a3
Not reproducible with: 2018.4.28f1, 2019.4.13f1, 2020.1.10f1, 2020.2.0a11
Note: Cause of error in PostProcessor.cs
Error:
(0,0): error System.MissingMethodException: Attempted to access a missing method.
Error with "EditorUtility.DisplayDialog("test", "test", "ok");" uncommented:
(0,0): error System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'Test.CodeGen.PostProcessor' threw an exception. ---> System.MissingMethodException: Attempted to access a missing method.
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
- Foldout arrow indent is misaligned in the Inspector when used in Custom Type
- [Android] The Player screen turns black when playing a video under certain conditions
- Search window icons at the bottom are cut off when Search window is resized vertically
- "Try something else?" text label is cut off when searching for a long text in the Search window
- Rendering Debugger window sections do not have a minimum width set when resizing with the slider in the middle of the window
Resolution Note:
You cannot call Unity APIs from ILPostProcessors, as they run outside of the Unity Editor process in 2020.2+ and inside a pure .NET application named ILPostProcessorRunner.
You can use Console.WriteLine instead of Debug.Log to get text output redirected to the console/editor log.