fix: remove Workspaces dependency from core package - #29
Conversation
Move CodeFixProviderBase and SyntaxModifierExtensions from the core package to Testing. These were the only consumers of Microsoft.CodeAnalysis.Workspaces.Common in the core package and have zero external consumers. This eliminates Workspaces from the core package's transitive dependency graph, fixing RS1038 errors in downstream analyzer projects that reference ANcpLua.Roslyn.Utilities. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary of ChangesHello @ANcpLua, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
WalkthroughTwo minimal changes: added a Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request successfully removes the Microsoft.CodeAnalysis.Workspaces.Common dependency from the core ANcpLua.Roslyn.Utilities package by moving CodeFixProviderBase<T> and SyntaxModifierExtensions to the ANcpLua.Roslyn.Utilities.Testing package. The changes are logical and correctly address the problem of dependency leakage.
One important point to consider is that the namespaces of the moved files (CodeFixProviderBase.cs and SyntaxModifierExtensions.cs) have not been updated. They are still in the ANcpLua.Roslyn.Utilities.CodeFixes namespace. To align with .NET conventions and the new project structure, their namespaces should be updated to ANcpLua.Roslyn.Utilities.Testing.CodeFixes to match their new location within the ANcpLua.Roslyn.Utilities.Testing project. This will improve code organization and maintainability.
| @@ -1,3 +1,4 @@ | |||
| using System.Collections.Immutable; | |||
There was a problem hiding this comment.
For consistency with the established project style, consider making this a global using. Both the source project (ANcpLua.Roslyn.Utilities) and the destination project (ANcpLua.Roslyn.Utilities.Testing) use global usings. Instead of adding an explicit using here, you could add <Using Include="System.Collections.Immutable"/> to ANcpLua.Roslyn.Utilities.Testing.csproj. This would maintain a consistent approach to dependency management across projects and keep the code cleaner.
There was a problem hiding this comment.
Pull request overview
This PR removes the Roslyn Workspaces dependency from the core ANcpLua.Roslyn.Utilities package by relocating the only Workspaces-dependent code-fix infrastructure types into the ANcpLua.Roslyn.Utilities.Testing package, preventing RS1038 issues from leaking into downstream analyzer projects via transitive dependencies.
Changes:
- Removed
Microsoft.CodeAnalysis.Workspaces.Commonfrom the core utilities.csproj. - Moved
CodeFixProviderBase<TSyntax>into the Testing package. - Moved
SyntaxModifierExtensions(andModifierPosition) into the Testing package.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| ANcpLua.Roslyn.Utilities/ANcpLua.Roslyn.Utilities/ANcpLua.Roslyn.Utilities.csproj | Drops the transitive Workspaces dependency from the core package. |
| ANcpLua.Roslyn.Utilities/ANcpLua.Roslyn.Utilities.Testing/CodeFixes/SyntaxModifierExtensions.cs | Adds the modifier manipulation helpers to the Testing package. |
| ANcpLua.Roslyn.Utilities/ANcpLua.Roslyn.Utilities.Testing/CodeFixes/CodeFixProviderBase.cs | Adds the code-fix base class to the Testing package (Workspaces-dependent). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Two vectors caused Workspaces to leak into analyzer projects: 1. ANcpLua.Roslyn.Utilities transitively depends on Workspaces.Common 2. CSharp.Workspaces centrally defined + transitive pinning amplified it Fix: - Remove CSharp.Workspaces from central PackageVersion - Add ExcludeAssets="all" for Workspaces.Common in analyzer projects - Switch CodeFixes/Tests to VersionOverride for CSharp.Workspaces Upstream fix: ANcpLua/ANcpLua.Roslyn.Utilities#29 removes Workspaces from the core package entirely. Once published, these workarounds can be reverted and CSharp.Workspaces restored to central management. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Roslyn.Utilities 1.31.0 removes Microsoft.CodeAnalysis.Workspaces.Common from the core package (CodeFixProviderBase moved to Testing). This eliminates the transitive Workspaces dependency that caused 169 RS1038 errors in analyzer projects. No workarounds needed — clean version bump resolves the issue at source. Upstream: ANcpLua/ANcpLua.Roslyn.Utilities#29 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Roslyn.Utilities 1.31.0 removes Microsoft.CodeAnalysis.Workspaces.Common from the core package (CodeFixProviderBase moved to Testing). This eliminates the transitive Workspaces dependency that caused 169 RS1038 errors in analyzer projects. No workarounds needed — clean version bump resolves the issue at source. Upstream: ANcpLua/ANcpLua.Roslyn.Utilities#29 Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Summary
CodeFixProviderBase<T>andSyntaxModifierExtensionsfrom core to Testing packageMicrosoft.CodeAnalysis.Workspaces.Commonfrom core csprojProblem
The core
ANcpLua.Roslyn.Utilitiespackage depends onMicrosoft.CodeAnalysis.Workspaces.Common, which causes RS1038 errors in downstream analyzer projects (ANcpLua.Analyzers). WithCentralPackageTransitivePinningEnabled=true, this dependency leaks into every project that references Roslyn.Utilities.Root Cause
CodeFixProviderBase<T>was the only class in the core package that required Workspaces APIs (Document,CodeAction,CodeFixProvider). It belongs in the Testing package alongside the other test infrastructure.Test plan
dotnet buildsucceeds with 0 errors, 0 warningsdotnet nuget whyconfirms Workspaces.Common is no longer a dependency of coreCodeFixProviderBaseexist in ANcpLua.Analyzers, ErrorOrX, or any downstream repo🤖 Generated with Claude Code
Summary by CodeRabbit