Search Issue Tracker
Third Party Issue
Votes
0
Found in
2019.4
2020.3
2021.2
2021.2.0f1
2022.1
Issue ID
1378700
Regression
No
Packages are inconsistent with the project API Compatibility Level setting when set to .NET Standard 2.1
How to reproduce:
1. Open the user's attached project
2. In the Project window, navigate to Packages -> Examples.Common.Unions -> CodeGen.Genesis
3. Open the script UnionGenerator.cs
4. At line 193, insert the two following lines of code: var hash = new System.HashCode(); hash.Add(0);
5. Save the script file
6. In the Project window, navigate to Assets -> Examples
7. Select the Asset "UnionGenesisSettings"
8. In the Inspector window, click the "Generate" button
9. Observe the Console
Expected result: no exceptions are thrown
Actual result: an exception is thrown: "System.ComponentModel.Win32Exception (0x80004005): ApplicationName='dotnet' <...>"
Reproducible with: 2019.4.33f1, 2020.3.24f1, 2021.2.6f1, 2022.1.0b2
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
- Crash when reimporting fbx asset used as tree by specific Terrain component
- The position of the "X" in the search section is not consistent with other search boxes in the engine
- Unable to pan outside of the active state viewing window in the Animator when the Play Mode is paused
- Window Zoom stops working after Editor window is moved
- Some package directories are not found, and errors are thrown in the Console when the project path is quite long
Resolution Note:
.asmdefs with platform "Editor" only are always compiled against the .net framework profile. To solve the issue, the .asmdef platform should be set as "all platform", and use a define constraint to avoid having it deployed with player builds (adding "UNITY_EDITOR" to the list of define constraints). This way, Unity will compile it as a .NET standard 2.1, and both the Mono runtime and .NET core will succeed in redirecting "System.HashCode, netstandard" to its correct implementation.