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

React to breaking RID change in .NET 8 Preview 6 #543

Closed halter73 closed 7 months ago

halter73 commented 1 year ago

There's a breaking change to the .NET SDK coming in .NET 8 Preview 6 (Not preview 5 like the docs indicate @gewarren) that makes any app depending on SQLitePCLRaw.core to output a warning like the following at runtime:

You need to install the latest preview 6 SDK which isn't yet released to repo. In the meantime, you can install the nightlies from https://github.com/dotnet/installer#table

Once you do, you can create a basic console app using something like dotnet new console, make sure you're using a preview6 SDK with a global.json, replace the csproj with:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="SQLitePCLRaw.lib.e_sqlite3" Version="2.1.5" />
  </ItemGroup>

</Project>

If you run or publish the app, you see the following warning. Fortunately, this does not stop the app from running successfully, but it adds noise to the output of any app depending on the package directly or transitively.

> dotnet run
D:\dev\.dotnet\sdk\8.0.100-preview.6.23315.26\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.target
s(267,5): warning NETSDK1206: Found version-specific or distribution-specific runtime identifier(s): alpine-arm, alpine
-arm64, alpine-x64, browser-wasm, maccatalyst-arm64, maccatalyst-x64. Affected libraries: SQLitePCLRaw.lib.e_sqlite3. I
n .NET 8.0 and higher, assets for version-specific and distribution-specific runtime identifiers will not be found by d
efault. See https://aka.ms/dotnet/rid-usage for details. [D:\dev\manual-tests-issue-2163\manual-tests-issue-21
63.csproj]
Hello, World!

My understanding is that RIDs like alpine-arm should be replaced with just linux-musl-arm which already exists. Similarly, browser-wasm should be replaced with just wasm. I'm not sure about the maccatalyst targets. I assume the osx binaries are incompatible since they come from a different build artifact in the nuspec.

https://learn.microsoft.com/en-us/dotnet/core/compatibility/deployment/8.0/rid-asset-list

@gewarren @elinor-fung @richlander I think the breaking change announcement might need to go into a lot more detail about what's allowed. It wasn't clear to me that wasm is probably the intended replacement for browser-wasm until looking at https://github.com/dotnet/runtime/issues/83246. WASM isn't mentioned anywhere in the breaking change announcement. Neither are the full list of OS's, libc versions, and processor architectures.

@davidortinau Do you know what the plan is for libraries that target maui-supported RIDs like maccatalys, android and ios?

@roji Heads up in case you start seeing this in Microsoft.Data.Sqlite.Core

roji commented 1 year ago

Thanks @halter73, /cc @bricelam

elinor-fung commented 1 year ago

Similarly, browser-wasm should be replaced with just wasm. I'm not sure about the maccatalyst targets.

This is actually a bug in the warning. It should not be flagging those two. https://github.com/dotnet/sdk/pull/33584 should be fixing it.

elinor-fung commented 1 year ago

My understanding is that RIDs like alpine-arm should be replaced with just linux-musl-arm which already exists.

It seems to be a direct copy. I think alpine-* should just go away: https://github.com/ericsink/SQLitePCL.raw/blob/760d88f2b6edf5f4fa8ad5c48a872afc55620626/gen_lib_nuspecs/Program.cs#L409-L417

ericsink commented 1 year ago

So the musl part of this change looks straightforward. I just need to delete those alpine RIDs.

The change from browser-wasm to wasm would be straightforward as well, if in fact that is the needed change. I'm not clear on that.

And I'm even less clear about whether any other changes are needed w.r.t. MAUI stuff.

But none of this is difficult once I'm sure I'm doing it right. :-)

elinor-fung commented 1 year ago

The only change needed should be removing the alpine RIDs.

The other ones that were flagged (brower, maccatalyst) were flagged incorrectly - it was a bug in the warning itself.

bricelam commented 10 months ago

@elinor-fung The Alpine RIDs were removed from the package, but we're still getting an error in dotnet/efcore:

D:\source\efcore.dotnet\sdk\8.0.100-rc.1.23407.2\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(267,5): er ror NETSDK1206: Found version-specific or distribution-specific runtime identifier(s): browser, browser-wasm, linux-arm , linux-arm64, linux-armel, linux-mips64, linux-musl-arm, linux-musl-arm64, linux-musl-x64, linux-ppc64le, linux-s390x, linux-x64, linux-x86, maccatalyst-arm64, maccatalyst-x64, osx-arm64, osx-x64, win-arm, win-arm64, win-x64, win-x86. Af fected libraries: SQLitePCLRaw.lib.e_sqlite3, System.Text.Encodings.Web. In .NET 8.0 and higher, assets for version-spe cific and distribution-specific runtime identifiers will not be found by default. See https://aka.ms/dotnet/rid-usage f or details. [D:\source\efcore\src\EFCore.Sqlite\EFCore.Sqlite.csproj]

We're using a very recent build of the SDK:

.NET SDK:
 Version:   8.0.100-rc.1.23407.2
 Commit:    c7045b1a4a

The SQLitePCLRaw.lib.e_sqlite3 package now has the following:

elinor-fung commented 10 months ago

That looks like https://github.com/dotnet/sdk/issues/34003 (based on logs from https://dev.azure.com/dnceng-public/public/_build/results?buildId=369044&view=results).

groogiam commented 1 month ago

@ericsink I am getting this error when compiling a class library with SDK 8.0.204. which references Microsoft.EntityFrameworkCore.Sqlite.Core 8.0.4

Severity    Code    Description Project File    Line    Suppression State
Warning NETSDK1206  Found version-specific or distribution-specific runtime identifier(s): alpine-x64. Affected libraries: SQLitePCLRaw.lib.e_sqlite3. In .NET 8.0 and higher, assets for version-specific and distribution-specific runtime identifiers will not be found by default. See https://aka.ms/dotnet/rid-usage for details. AppPotion.Sandbox   C:\Program Files\dotnet\sdk\8.0.204\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets    284