Skip to content
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

Move support to sdk 8 #80

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Move support to sdk 8 #80

wants to merge 3 commits into from

Conversation

rjmurillo
Copy link
Owner

@rjmurillo rjmurillo commented Dec 20, 2024

This change moves the minimum supported SDK to 8.0.100, the SDK that shipped with Visual Studio 2022 version 17.8 and C# 12.0. This is the earliest SDK that is in support.

  • New Features

    • Updated package versions to support .NET 8 and Visual Studio 2022.
    • Added new documentation references for SDK versioning.
  • Bug Fixes

    • Adjusted roll-forward policy for .NET SDK versioning to allow patch-level updates.
  • Refactor

    • Streamlined method calls by removing unnecessary cancellation token arguments in benchmark compilation factory.
  • Chores

    • Updated target framework from .NET 8.0 to .NET 9.0 in the PerfDiff project file.

@rjmurillo rjmurillo requested a review from Copilot December 20, 2024 22:00
Copy link
Contributor

coderabbitai bot commented Dec 20, 2024

Walkthrough

This pull request encompasses updates across multiple configuration and source files, primarily focusing on version upgrades and SDK configuration. The changes include updating package versions in Directory.Packages.props, modifying the SDK roll-forward policy in global.json, upgrading the target framework for the PerfDiff project to .NET 9.0, and simplifying method calls in a benchmark helper class by removing explicit cancellation tokens.

Changes

File Change Summary
Directory.Packages.props - Updated Microsoft.CodeAnalysis.CSharp.Workspaces from 4.3.1 to 4.8
- Added Microsoft.CodeAnalysis.CSharp package version 4.8
- Moved Microsoft.Bcl.HashCode package to a different ItemGroup
global.json Changed SDK rollForward property from "disable" to "patch"
src/tools/PerfDiff/PerfDiff.csproj Updated target framework from .NET 8.0 to .NET 9.0
tests/EffectiveCSharp.Analyzers.Benchmarks/Helpers/BenchmarkCSharpCompilationFactory.cs Removed CancellationToken.None from WithAnalyzers method calls in two CreateAsync methods

Possibly Related PRs

Suggested Labels

build, dependencies, releasable, github_actions


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 4 changed files in this pull request and generated no comments.

Files not reviewed (3)
  • Directory.Packages.props: Language not supported
  • global.json: Language not supported
  • src/tools/PerfDiff/PerfDiff.csproj: Language not supported
@rjmurillo rjmurillo added dependencies Pull requests that update a dependency file releasable labels Dec 20, 2024
Copy link

codacy-production bot commented Dec 20, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.00% (target: -1.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (38604b6) 1377 1200 87.15%
Head commit (d170c06) 1377 (+0) 1200 (+0) 87.15% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#80) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 38604b6 and d170c06.

📒 Files selected for processing (4)
  • Directory.Packages.props (1 hunks)
  • global.json (1 hunks)
  • src/tools/PerfDiff/PerfDiff.csproj (1 hunks)
  • tests/EffectiveCSharp.Analyzers.Benchmarks/Helpers/BenchmarkCSharpCompilationFactory.cs (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
tests/EffectiveCSharp.Analyzers.Benchmarks/Helpers/BenchmarkCSharpCompilationFactory.cs (1)

Pattern **/*.cs: I need your help tracking down and fixing some bugs that have been reported in this codebase.

I suspect the bugs are related to:

  • Incorrect handling of edge cases
  • Off-by-one errors in loops or array indexing
  • Unexpected data types
  • Uncaught exceptions
  • Concurrency issues
  • Improper configuration settings

To diagnose:

  1. Review the code carefully and systematically
  2. Trace the relevant code paths
  3. Consider boundary conditions and potential error states
  4. Look for antipatterns that tend to cause bugs
  5. Run the code mentally with example inputs
  6. Think about interactions between components

When you find potential bugs, for each one provide:

  1. File path and line number(s)
  2. Description of the issue and why it's a bug
  3. Example input that would trigger the bug
  4. Suggestions for how to fix it

After analysis, please update the code with your proposed fixes. Try to match the existing code style. Add regression tests if possible to prevent the bugs from recurring.

I appreciate your diligence and attention to detail! Let me know if you need any clarification on the intended behavior of the code.

🪛 Biome (1.9.4)
global.json

[error] 4-4: JSON standard does not allow comments.

(parse)

🔇 Additional comments (7)
global.json (1)

1-5: Verify SDK version alignment with PR objectives

The SDK version is set to 9.0.100, but the PR objective states updating to 8.0.100. Please confirm if this is intentional or if it should be adjusted to align with the stated objective.

🧰 Tools
🪛 Biome (1.9.4)

[error] 4-4: JSON standard does not allow comments.

(parse)

src/tools/PerfDiff/PerfDiff.csproj (1)

5-5: Verify framework version alignment with PR objectives

The target framework is set to net9.0, but the PR objective is to update to SDK 8.0.100. Please confirm if this is intentional or if it should be adjusted to align with the stated objective.

tests/EffectiveCSharp.Analyzers.Benchmarks/Helpers/BenchmarkCSharpCompilationFactory.cs (1)

19-20: LGTM! Changes align with modern C# practices

The changes look good:

  1. Removing explicit CancellationToken.None is safe as it's the default value
  2. Using collection expressions ([]) makes the code more concise and readable

Let's verify collection expression compatibility across the solution:

Also applies to: 38-40

✅ Verification successful

Collection expressions are compatible with the codebase

The benchmarks project targets .NET 9.0, which fully supports C# 12 collection expressions. The usage of collection expressions in WithAnalyzers([...]) calls is appropriate and consistent with the project's target framework.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if collection expressions are used consistently
ast-grep --pattern 'WithAnalyzers([$_], $_)'

Length of output: 46


Script:

#!/bin/bash
# Let's try a different approach to find WithAnalyzers usage
rg "WithAnalyzers" -A 2 -B 2

Length of output: 8494


Script:

#!/bin/bash
# Let's check the project file to verify .NET SDK version compatibility
rg -l "TargetFramework|LangVersion" --type xml

Length of output: 197


Script:

#!/bin/bash
# Let's try finding project files first, then check their contents
fd -e csproj . | xargs cat

Length of output: 7036

Directory.Packages.props (4)

15-19: Documentation improvements look good!

The addition of the SDK versioning documentation link enhances maintainability by providing clear references for future SDK updates.


25-25: Package reorganization looks good!

The move of Microsoft.Bcl.HashCode to the utility packages group improves organization while maintaining the stable version 1.1.1.


20-22: Verify Roslyn package version compatibility

The update to version 4.8 aligns with the PR objective to support SDK 8.0.100. Let's verify the version compatibility.

✅ Verification successful

Let me gather more information about VS 2022 17.8 compatibility by checking the global.json and other configuration files.


Roslyn package versions are compatible and correctly aligned

The version 4.8 of Microsoft.CodeAnalysis.CSharp packages is appropriate for this codebase because:

  • Both Roslyn packages (CSharp and CSharp.Workspaces) are consistently versioned at 4.8
  • The project targets .NET 9.0 (SDK 9.0.100) which is newer than .NET 8, making Roslyn 4.8 a suitable version
  • The packages are used correctly across the solution with proper references in test and analyzer projects
  • The version is compatible with VS 2022 17.8 as it's a stable release that predates both VS 2022 17.8 and .NET 8
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify Roslyn package versions align with VS 2022 17.8 and SDK 8.0.100

# Check if both packages have consistent versions in the solution
rg -g "*.props" -g "*.csproj" "Microsoft\.CodeAnalysis\.(CSharp|CSharp\.Workspaces)" -A 1

# Check package compatibility with VS 2022 17.8
gh api graphql -f query='
{
  repository(owner: "dotnet", name: "roslyn") {
    releases(first: 10, orderBy: {field: CREATED_AT, direction: DESC}) {
      nodes {
        tagName
        description
      }
    }
  }
}'

Length of output: 3343


Script:

#!/bin/bash
# Check SDK version and other relevant configurations
fd "global.json|Directory.Build.props" --type f --exec cat {}

# Check if there are any specific version requirements or constraints
rg -g "*.props" -g "*.csproj" -g "*.sln" "VisualStudioVersion|LangVersion|TargetFramework"

Length of output: 1859


Line range hint 1-36: Verify all package versions for SDK 8.0.100 compatibility

While the Roslyn package updates look good, let's verify if other packages need updates for SDK 8 compatibility.

✅ Verification successful

Package versions are appropriate for .NET 9 SDK compatibility

Based on the verification results:

  1. The project is using .NET 9 SDK (version 9.0.100) as shown in global.json
  2. Microsoft.CodeAnalysis packages are at version 4.8, which is the latest stable release supporting .NET 8/9
  3. Microsoft.Extensions.Logging is at 8.0.0, which is compatible with .NET 9
  4. Other utility packages (BenchmarkDotNet, System.CommandLine) are at appropriate versions that don't impact SDK compatibility

The package versions in Directory.Packages.props are well-balanced for both compatibility and modernity, as mentioned in the inline documentation.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if any other packages have newer versions that better support SDK 8.0.100

# Get all package references
echo "Checking package versions..."
for pkg in $(rg -g "Directory.Packages.props" "PackageVersion Include=\"([^\"]+)\"" -o --replace '$1'); do
  echo "Package: $pkg"
  curl -s "https://api.nuget.org/v3-flatcontainer/$pkg/index.json" | jq -r '.versions[]' | tail -n 5
done

Length of output: 5809


Script:

#!/bin/bash
# Let's fix the previous script by correctly extracting package names
echo "Checking package versions..."
rg -g "Directory.Packages.props" "PackageVersion Include=\"([^\"]+)\"" -o --replace '$1' | while read -r pkg; do
  echo "Package: $pkg"
  curl -s "https://api.nuget.org/v3/registration5-gz-semver2/$pkg/index.json" | jq -r '.items[0].upper' 2>/dev/null || echo "No version info found"
done

# Also check target framework to confirm SDK compatibility
echo -e "\nChecking target framework..."
fd -e csproj -e props . -x cat {} \; | grep -E "TargetFramework|<Project"

Length of output: 6016


Script:

#!/bin/bash
# Let's try one more time with the correct package URL format
echo "Checking latest versions for key packages..."
for pkg in "Microsoft.CodeAnalysis.CSharp.Workspaces" "Microsoft.CodeAnalysis.CSharp" "Microsoft.Extensions.Logging" "BenchmarkDotNet" "System.CommandLine"; do
  echo "Package: $pkg"
  curl -s "https://api.nuget.org/v3-flatcontainer/$pkg/index.json" | jq -r '.versions[]' | sort -V | tail -n 5
done

# Check global.json for SDK version
echo -e "\nChecking SDK version..."
find . -name "global.json" -exec cat {} \;

Length of output: 2594

@@ -1,7 +1,7 @@
{
"sdk": {
"version": "9.0.100",
"rollForward": "disable" /* setup-dotnet is broken and we don't want to have differences in CI vs local, so make this disabled */
"rollForward": "patch" /* setup-dotnet is broken and we don't want to have differences in CI vs local, so make this disabled */
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Consider using a separate documentation file for comments

The JSON standard does not support comments. Consider moving the comment about setup-dotnet to a separate documentation file (e.g., README.md) or removing it to maintain JSON standard compliance.

🧰 Tools
🪛 Biome (1.9.4)

[error] 4-4: JSON standard does not allow comments.

(parse)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file releasable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant