Skip to content

Update System.Text.Json in packages which use 4.12 Roslyn#80197

Merged
RikkiGibson merged 2 commits intodotnet:mainfrom
RikkiGibson:cg-fix-4
Sep 10, 2025
Merged

Update System.Text.Json in packages which use 4.12 Roslyn#80197
RikkiGibson merged 2 commits intodotnet:mainfrom
RikkiGibson:cg-fix-4

Conversation

@RikkiGibson RikkiGibson requested a review from a team as a code owner September 9, 2025 19:12
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" VersionOverride="$(MicrosoftCodeAnalysisVersionForAnalyzers)" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" VersionOverride="$(MicrosoftCodeAnalysisVersionForAnalyzers)" />
<PackageReference Include="Microsoft.Build.Tasks.Core" VersionOverride="17.10.29" ExcludeAssets="Runtime" />
<PackageReference Include="System.Text.Json" VersionOverride="8.0.5" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be doing a SystemTextJsonVersionForAnalyzers like the other pattern is above?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could see it being in the src/RoslynAnalyzers/Directory.Build.props

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe SystemTextJsonVersionForMetric

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved them to Version.props

@JoeRobich JoeRobich requested a review from a team as a code owner September 10, 2025 17:23
Copy link
Member

@jasonmalinowski jasonmalinowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signing off on the change, but the comment confuses me a bit. Feel free to merge and update the comment later (or tell me that I'm wrong) since this will resolve the security alert.

Comment on lines +106 to +108
Metrics targets the same older Microsoft.CodeAnalysis version as the RoslynAnalyzers. Analyzers pick up patched versions
of Roslyn's transtive dependencies from the compiler that is hosting them. Since Metrics is a standalone tool and not an
Analyzer, it needs to directly reference patched versions of some transitive dependencies.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment correct? Because in the case of these two dependencies (System.Text.Json and Microsoft.Build) there is no compiler host verson it'd be using, right? So it will actually use that version?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A host's version of those assemblies can still be used even if compiler itself doesn't have a dependency on them. Our assembly loading simply works by first trying to load the assembly in the same ALC that the host compiler is loaded in. If it works, then the search is over, otherwise we will try to load from the sub-ALC which is specific to the directory the analyzer is located in.

That means if ServiceHub, LanguageServer etc. has those dependencies, then they will get used, and not the analyzer's version. It can even mean, IIRC, that an analyzer's version of a dep can be get used in one environment, while a host's version will get used in a different environment.

Copy link
Member Author

@RikkiGibson RikkiGibson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@RikkiGibson RikkiGibson merged commit be438f1 into dotnet:main Sep 10, 2025
28 checks passed
@RikkiGibson RikkiGibson deleted the cg-fix-4 branch September 10, 2025 21:25
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Sep 10, 2025
333fred added a commit to 333fred/roslyn that referenced this pull request Sep 11, 2025
* upstream/main: (233 commits)
  Extensions: add SyntaxGenerator support and AssociatedExtensionImplementation API (dotnet#80170)
  Fix error when hoisting a non-ref call (dotnet#80138)
  Ensure that refkinds are rewritten for complex methods (dotnet#79916)
  Revert
  Do not go through the workspace to access services
  DefiniteAssignmentPass.MarkFieldsUsed - avoid infinite recursion due to generic substitution (dotnet#80135)
  Reduce allocations in AnalyzerDriver.TryExecuteSymbolEndActions (dotnet#79855)
  RefSafetyAnalysis: Fix handling of nested deconstruction utilizing modern extensions (dotnet#80231)
  Extensions: adjust rewriting of anonymous type property symbols (dotnet#80211)
  Extensions: Move public APIs into INamedTypeSymbol (dotnet#80230)
  Extensions: improve error recovery in older language versions (dotnet#80206)
  Fall back to `dotnet exec` if apphost does not exist (dotnet#80153)
  Update dependencies from https://github.com/dotnet/dotnet build 282708 (dotnet#80228)
  Add a workaround for microsoft/vs-mef#620
  Revert "FailFast if the MEF composition is clearly broken"
  switch from windows combobox to visualstudio combobox (dotnet#80219)
  Update System.Text.Json in packages which use 4.12 Roslyn (dotnet#80197)
  add flags to unblock CI (dotnet#80222)
  Move static members to another type - qualifies static member references in the moved members (dotnet#80178)
  Fix broken link for C# 14 lambda parameter modifiers
  ...
@akhera99 akhera99 modified the milestones: Next, 18.0 P1, 18.0 P2 Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants