Skip to content

Upgrade Contracts to net8#1837

Open
ryanbrandenburg wants to merge 1 commit into
mainfrom
rybrande/contracts-net8
Open

Upgrade Contracts to net8#1837
ryanbrandenburg wants to merge 1 commit into
mainfrom
rybrande/contracts-net8

Conversation

@ryanbrandenburg

Copy link
Copy Markdown

Went to use some newer language features in the Contracts projects and they weren't available because it was still on netstandard. Upgraded to net8 as per https://devblogs.microsoft.com/dotnet/the-future-of-net-standard/ and then fixed the resulting build errors.

Copilot AI review requested due to automatic review settings July 1, 2026 18:18
@ryanbrandenburg ryanbrandenburg requested a review from a team as a code owner July 1, 2026 18:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates the Microsoft.ComponentDetection.Contracts project to build on .NET 8 (by removing its netstandard2.0 override so it inherits the repo-wide net8.0 target), and adjusts a few APIs/usages accordingly within the Contracts layer.

Changes:

  • Upgraded Contracts from netstandard2.0 to repo-default net8.0 by removing the per-project TargetFramework override.
  • Adopted .NET 8/BCL language/runtime features (range slicing, ArgumentNullException.ThrowIfNull) to resolve build issues after the framework upgrade.
  • Minor cleanup/formatting changes (including a small interface signature update).
Show a summary per file
File Description
src/Microsoft.ComponentDetection.Contracts/TypedComponent/GoComponent.cs Uses range slicing for namespace/name extraction now that Contracts targets .NET 8.
src/Microsoft.ComponentDetection.Contracts/TypedComponent/GitComponent.cs Uses range slicing to trim .git suffix under .NET 8.
src/Microsoft.ComponentDetection.Contracts/Microsoft.ComponentDetection.Contracts.csproj Removes netstandard2.0 override so the project targets repo-default net8.0.
src/Microsoft.ComponentDetection.Contracts/IComponentStream.cs Removes #nullable disable and adds explicit accessibility modifiers on interface members.
src/Microsoft.ComponentDetection.Contracts/FileComponentDetectorWithCleanup.cs Replaces manual null-check with ArgumentNullException.ThrowIfNull.
src/Microsoft.ComponentDetection.Common/Microsoft.ComponentDetection.Common.csproj Whitespace-only cleanup.

Review details

  • Files reviewed: 6/6 changed files
  • Comments generated: 1
  • Review effort level: Low

Comment on lines 10 to 12
/// <summary>
/// Gets the stream object that was discovered by the provided pattern to <see cref="IComponentStreamEnumerableFactory" /> />.
/// </summary>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants