Search Issue Tracker
Fixed in 2022.1.X
Fixed in 2021.2.X
.NETStandard 2.1 in the editor is missing System.Memory, System.Buffers at runtime
When referencing .NETStandard 2.0 assemblies coming from NuGet package like System.Text.Json (https://www.nuget.org/packages/System.Text.Json/5.0.2) we are getting the following error in the Editor (before this, we need to disable validation for assemblies, as there is another set of validation errors separated from this issue)
Error: Could not load signature of System.HexConverter:ToBytesBuffer due to: Could not load file or assembly 'System.Memory, Version=188.8.131.52, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.
Unloading broken assembly Assets/Scenes/System.Text.Json.dll, this assembly can cause crashes in the runtime
The problem is that this System.Text.Json assembly comes only in .NETStandard 2.0 form but has dependencies to:
- Microsoft.Bcl.AsyncInterfaces (>= 5.0.0)
- System.Text.Encodings.Web (>= 5.0.1)
Special NuGet Packages but when running in a .NET runtime supporting .NET Standard 2.1, these assemblies are included with the runtime:
- System.Buffers (>= 4.5.1)
- System.Memory (>= 4.5.4)
- System.Runtime.CompilerServices.Unsafe (>= 5.0.0)
- System.Numerics.Vectors (>= 4.5.0)
- System.Threading.Tasks.Extensions (>= 4.5.4)
So it seems that the editor doesn't have the special assemblies above (System.Buffers/System.Memory) in the runtime.
Checking further the AOT folder `Data\MonoBleedingEdge\lib\mono\unityaot-win32\Facades` and comparing it to the one used at editor time `Data\MonoBleedingEdge\lib\mono\unityjit-win32\Facades`, we can see that we are missing some of these assemblies:
Copying these DLLs to the `unityjit-win32\Facades` folder is fixing the issue.
Reproducible with a recent 2021.2 or 2022.1
Attached a project ModernDotNet.zip that contains these assemblies to reproduce the issue.
Feb 14, 2022 12:40
Do we know when will this be fixed in 2021.2?
Oct 29, 2021 15:08
We desperately need this for 2021.2, we'd really appreciate it as we are stuck on b1 until it is done. Thanks!
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- Parallax mapping with UVs set other than UV0 plugged into sample texture 2d produces an error
- Objects with single letter name won't show up in hierarchy search results
- The GameObject is not transparent when setting CameraDepthTexture as a depth render target
- SRP Lens Flares with Occlusion enabled inconsistently shine through objects
- "Can not play a disabled audio source" is thrown when audio is toggled on with disabled Audio Source in the Scene
Resolution Note (fix version 2022.1):
The Unity 4.8 reference profile and the Unity JIT profiles have been updated to address the problem. The missing facade dlls have been added where needed.