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
- NullReferenceException when selecting a Dropdown Component override in the Prefab Overrides menu for the second time
- USS variables are broken on IOS
- Crash when project is reopened or upgraded
- Hub doesn't install windows 10 sdk properly
- Crash building for iOS after canceling a build
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.