-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Clean up STJ references Fixes #39902 #40645
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
Conversation
|
|
||
| <ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'"> | ||
| <PackageReference Include="System.Text.Json" VersionOverride="8.0.0" /> | ||
| <PackageReference Include="System.Text.Json" VersionOverride="$(SystemTextJsonPackageVersion)" Condition="'$(TargetFramework)' == 'net472'"/> |
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.
duplicate condition (previous line covered it)
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.
I'm just confused why things aren't working the way I'd expect, so I was adding some duplication in case I had missed something, and it didn't work as I'd thought.
eng/Versions.props
Outdated
| <SystemSecurityPermissionsPackageVersion>8.0.0</SystemSecurityPermissionsPackageVersion> | ||
| <SystemServiceProcessServiceControllerVersion>8.0.0</SystemServiceProcessServiceControllerVersion> | ||
| <SystemTextJsonPackageVersion>8.0.2</SystemTextJsonPackageVersion> | ||
| <SystemTextJsonPackageVersion>8.0.0</SystemTextJsonPackageVersion> |
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.
This property is used in directory.packages.props so what you're doing here is actually overriding the version used by transitive pinning (so overriding the version for all implicit .net core references). You'll need a separate property to use for pinning to 8.0.0 and let the d.p.props version float to current. Runtime does this too if you see here: https://github.com/dotnet/runtime/blob/main/eng/Versions.props#L137
FYI, I talked to Eric and I'll be prepping a change for 8.0.1xx and 8.0.3xx for how we handle STJ. We'll want that change in 8.0.4xx as well. It depends on a change in runtime so you won't be able to get this PR working in 4xx as it turns out. You should be able to retarget to main, make the above change, apply my changes, and get it sorted out. I'll talk to you offline as it's complicated as there are actually 3 different classes of STJ references, not 2 like I thought.
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.
Following up on this, I believe there are three categories of project that we talked about:
- The four task projects should have STJ references with no version override. Razor and static web assets should have a net472 check but build and publish should not. I recommend looking at the 8.0.3xx internal AzDo branches to confirm:
https://dev.azure.com/dnceng/internal/_git/dotnet-sdk?path=/src/WebSdk/Publish/Tasks/Microsoft.NET.Sdk.Publish.Tasks.csproj&version=GBinternal/release/8.0.3xx&_a=contents - The components we have that build for framework and run in VS should have a reference to STJ for netfx targeting and should have a VersionOverride to version 8.0.0. That's because in these cases, VS is providing STJ and we need to work with whichever version they ship.
- No other .net core building projects should have a reference to STJ.
CC @ericstj to confirm. We discussed this in a 1:1 a few weeks ago but didn't write it down so writing it down here now.
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.
This sounds correct. Minimize the places where you ship a copy if you can reference the version provided by your host process.
| Explicit System.Text.Json package reference is required for source-build to pick up the live package. | ||
| Avoids picking up an old version via transitive dependency from Microsoft.Build or Microsoft.CodeAnalysis.Workspaces.MSBuild. | ||
| --> | ||
| <PackageReference Include="System.Text.Json" /> |
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.
Probably want a review from @tmat but with CPM now enabled, this may not be required anymore like it was before.
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.
Having an explicit package reference is no longer required, or removing it is no longer required?
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.
Having the explicit reference is no longer required, I think. If I understand the original issue per the comment, a transitive version was picked up that didn't work with source build and adding the explicit reference up-versioned to one that was supported. CPM should do the version change as well.
| <Using Remove="Microsoft.NET.TestFramework.Utilities" /> | ||
| <Using Remove="Xunit" /> | ||
| <Using Remove="Xunit.Abstractions" /> | ||
| <PackageReference Include="System.Text.Json" VersionOverride="$(SystemTextJsonPackageVersion)" /> |
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.
this is a test so not sure it'll need the version override
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="System.Text.Json" Condition="'$(UseSystemTextJson)'=='True'" /> | ||
| <PackageReference Include="System.Text.Json" |
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.
This one will require more investigation. The conditional above that sets UseSystemTextJson is configured for core only which we don't need a reference for so I think we might be able to just remove it from here but you'd have to confirm the framework build doesn't use STJ (as I know things changed so this property may not be accurately named anymore)
| <PackageReference Include="Microsoft.Build" ExcludeAssets="runtime" PrivateAssets="all" /> | ||
| <PackageReference Include="Microsoft.Build.Utilities.Core" ExcludeAssets="runtime" PrivateAssets="all" /> | ||
| <PackageReference Include="System.CommandLine" /> | ||
| <PackageReference Include="System.Text.Json" VersionOverride="$(SystemTextJsonPackageVersion)" Condition="'$(TargetFramework)' == 'net472'"/> |
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.
where is SystemTextJsonPackageVersion set and what is it set to? I think it should be 8.0.0 but don't see it in this PR (also the name is really close to what darc will update so it may need a slight update to ensure darc doesn't get confused).
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.
I'm starting to think the PR to create the specific package versions was never ported to main. I'll need to investigate.
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.
My PR is now in which should enable you to update the minimum version name #41890
src/Cli/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj
Outdated
Show resolved
Hide resolved
|
Consider using |
VS has upgraded to STJ 8.0.4, so we can, too
|
The ubuntu failure appears to be dotnet/source-build#4503 |
Fixes #39902
First commit removes references to S.T.J that shouldn't be necessary because we have our own "WorkloadManifestReader.SystemTextJson" class.
The second commit forces all our package versions to 8.0.0.
I was a bit confused with this logic:
<UseSystemTextJson Condition="'$(TargetFramework)'!='netstandard2.0' And '$(TargetFramework)'!='net472'">True</UseSystemTextJson>This seems to say that we should use System.Text.Json on core only