-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bring back direct dependencies on System.Runtime.CompilerServices.Unsafe for other tfms than net7.0 #67385
Conversation
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to this area: @dotnet/area-infrastructure-libraries Issue DetailsFixes #67380 Add dependency on Unsafe package With the removal of the Unsafe package, a few projects which Fixing those projects to declare the direct dependency again. Add infrastructure to use the latest Unsafe ver Whenever Unsafe would be consumed as a transitive dependency of Make sure that when that's the case, to upgrade the version to the
|
With the removal of the Unsafe package, a few projects regressed which previously had a direct dependency on the latest version of Unsafe (6.0.0) by now depending on the transitive Unsafe dependency of i.e. System.Memory which is a very old version (4.5.*). Fixing those projects to declare the direct dependency again.
Whenever Unsafe would be consumed as a transitive dependency of System.Memory, System.Threading.Tasks.Extensions or Microsoft.Bcl.AsyncInterfaces, a very old version of it would be chosen. Make sure that when that's the case, to upgrade the version to the latest available unsafe package.
84f338a
to
888a022
Compare
@@ -63,7 +63,8 @@ System.Formats.Cbor.CborWriter</PackageDescription> | |||
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'"> | |||
<PackageReference Include="System.Buffers" Version="$(SystemBuffersVersion)" /> | |||
<PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)" /> | |||
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1" /> | |||
<PackageReference Include="Microsoft.Bcl.HashCode" Version="$(MicrosoftBclHashCodeVersion)" /> | |||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="$(SystemRuntimeCompilerServicesUnsafeVersion)" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need this on net6.0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It uses System.Memory though...
Or is this the case where the infrastructure will kick in and add the PrivateAssets PackageReference above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct but projects should only reference direct dependencies, transitives are brought along via the project.assets.json file and the ResolvePackageAssets
task (NuGet).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also in this case we talk about the System.Memory 6.0.0.0 assembly from the shared framework and not the 4.5.* version from the package so the Unsafe assembly used is already the latest one from the shared framework (6.0.0.0).
...braries/Microsoft.Extensions.Logging.Console/src/Microsoft.Extensions.Logging.Console.csproj
Show resolved
Hide resolved
I added two more commits:
|
Merging the PR in now. We could consider always referencing the unsafe package when ie the System.Memory package is referenced, even if it isn't a direct dependency but that would be a separate change and I'm not sure it would be the right thing to do. |
I think you might be able to get away with omitting the PackageReference if the asset is targeting |
That's a valid response. The corner case, when customers use the latest available patched package but aren't using the latest patched corrrsponding shared framework, isn't handled then though. Packages provide us the abiluty to reach customers faster as it's more common that packages are updated to the latest than that shared frameworks are updated because of a recent patch. Admittedly, Visual Studio does help update shared frameworks. |
Fixes #67380
Add dependency on Unsafe package
With the removal of the Unsafe package, a few projects which
previously had a direct dependency on the latest version of Unsafe
(6.0.0) regressed as they depend on the transitive Unsafe dependency of i.e.
System.Memory which is a very old version (4.5.*).
Fixing those projects to declare the direct dependency again.