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
- Opening Terrain Prefab in Prefab Editing Mode throws "NullReferenceException" error
- [Search] Dragging query pills put them behind the search text field
- A CustomPropertyDrawer that returns a PropertyField for a property named the same as a child field will not render all child fields
- Graphics Settings shows default values instead of the real values in the Rendering Debugger when Volume.profile is assigned via script
- Deleting multiple Tags throws “NullReferenceException”, and "Retrieving array element that was out of bounds" errors when holding the Enter key
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.