Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | default.kramer |
I created a new Godot project and wanted to test if the following line of code would work:
using var owner = MemoryPool<bool>.Shared.Rent(size);
At first I got a compiler error because the csproj that Godot created had <TargetFramework>net472</TargetFramework>
which is not high enough. I changed it to net6.0
(which I realize might be unsupported). Then I got the following error:
System.MissingMethodException: Method not found: System.Buffers.IMemoryOwner`1<!0> System.Buffers.MemoryPool`1.Rent(int)
When I remove the problematic line, Godot is able to run the rest of my code even while <TargetFramework>net6.0</TargetFramework>
remains in the csproj. So I’m still not sure whether net6.0
is supported or not.
I tried adding the Nuget packages for System.Buffers and System.Memory but the error remained the same.
My next question was whether I could run this code using Mono without involving Godot. So I downloaded the latest version of Mono from this page (64-bit no GTK) and I was able to compile and run the troublesome line of code.
So now I’m confused. I can’t figure out whether or not I should be able to get this working.
EDIT - It just started working and I have no idea why! But at least now I know it is possible.