microsoft / FASTER

Fast persistent recoverable log and key-value store + cache, in C# and C++.
https://aka.ms/FASTER
MIT License
6.29k stars 563 forks source link

use IsReferenceOrContainsReferences for .NET Standard 2.1+ and 6_0+ #901

Closed Tornhoof closed 5 months ago

Tornhoof commented 5 months ago

This ports the change done by @paulusparssinen done in https://github.com/microsoft/garnet/pull/36 to FASTER. This only applies to the builds for .NET STANDARD 2.1 and 6_0+ as otherwise the helper method is not available, the reflection method is also still used in the code.

PaulusParssinen commented 5 months ago

Deleted earlier incorrect comment, misread the changes 🤦‍♂️

This actually fixes a bug as the .NET 7+ onwards it is invalid to rely on dummy GCHandle for the blittability check (see https://github.com/dotnet/runtime/pull/68694)