ericsink / SQLitePCL.raw

A Portable Class Library (PCL) for low-level (raw) access to SQLite
Apache License 2.0
512 stars 106 forks source link

System.Memory dependency causing issue with Xamarin.iOS targets #522

Open prollin opened 1 year ago

prollin commented 1 year ago

Since 2.x. SQLitePCL.raw.core targets NET Standard 2.0 and references System.Memory This causes an incompatibility in Xamarin.iOS projects referencing SQLitePCL.raw since a few types from System.Memory (ReadonlySpan, Span...) are already declared in mscorlib

So far I have failed to find a workaround that doesn't require a change to SQLitePCL.raw.core project.

A possible solution would be to explicitly add xamarin.ios10 TFM (and monodroid90, changing the sdk to Xamarin.Legacy.Sdk) to SQLitePCL.raw.core.csproj and avoid the dependency to System.Memory for those target frameworks

ericsink commented 1 year ago

Possibly related to #462 ?

ericsink commented 1 year ago

What I'm curious about: This was all working just fine for a long time. Sometime during the .NET 6 cycle is when I started getting reports of #462. Did something about the Xamarin classic platform change during that timeframe?

prollin commented 1 year ago

IIRC, I have seen this issue pop on and off since VS 2017 (on various packages). This is the most "root cause" issue I could find on the subject: https://github.com/dotnet/runtime/issues/29209

In my case, explicitly excluding System.Memory 4.5.3 by adding the following to the project referencing the latest version of SQLitePCL.raw seem to work:

<PackageReference Include="System.Memory" Version="4.5.3">
  <ExcludeAssets>all</ExcludeAssets>
</PackageReference>

Explicitly targeting Xamarin.iOS might be a better solution if more ppl are running into this issue though.