Search Issue Tracker

Fixed in 2022.1.X

Fixed in 2021.2.X



Found in

Issue ID




.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 ( 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=, 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:

NuGet Packages:
- 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:

- System.Buffers.dll
- System.Memory.dll
- System.Threading.Tasks.Extensions.dll

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 that contains these assemblies to reproduce the issue.

  1. 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.

Comments (2)

  1. KuraiAndras

    Feb 14, 2022 12:40

    Do we know when will this be fixed in 2021.2?

  2. MrDizzle26

    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!

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.