dotnet / dotnet/roslyn

Codefix not loading from within VS, works in rider though

Open
#78,445 0 comments 0 reactions 1 assignee Assigned to @JoeRobich View on GitHub
Area-IDE
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

**Version Used**: VS 17.13.6

**Steps to Reproduce**:

1. Create project ![Image](https://github.com/user-attachments/assets/5d9d2f2b-7dd6-48f9-bb62-3a1237e5ef3c)
2. Save the script below next to the project folders, and run it
3. Open sln with VS + Rider

```pwsh
param(
[string]$Prefix="0.1.0",
[string]$Suffix="internal-$([DateTime]::Now.ToString('yyyyMMddHHmmss'))"
)

$projectName = "NupkgAnalyzerTest"
$tempDir = Join-Path $env:TEMP $(New-Guid) | %{ mkdir $_ }
try
{
Push-Location $tempDir
dotnet new sln -n "TestSolution"
dotnet new classlib -n "TestProject"
dotnet sln add TestProject
dotnet new nugetconfig
mkdir libs
dotnet nuget add source "./libs" --name "local.dir"

$nupkgProj = Resolve-Path "$PSScriptRoot\$projectName.Package\$projectName.Package.csproj"

dotnet restore $nupkgProj
dotnet build $nupkgProj -c Release
dotnet pack $nupkgProj -o "$tempDir/libs"

dotnet add TestProject package "$projectName" --prerelease
dotnet build "./TestSolution.sln"
explorer $tempDir
}
finally
{
Pop-Location
}
```

- Note that i am using a 100% raw template scaffold with zero changes. Any information on whether the template of VS is outdated, or the VS integration is having issues would be very welcome, because i want my analyzer codefix to work for both IDE's
- Also if i build a VSIX and manually install that i also get analyzer diagnostics, but no codefixes

**Diagnostic Id**:
no diagnostic

**Expected Behavior**:
Diagnostic codefix from nupkg works in both Rider+VS
**Actual Behavior**:
Only works fully in Rider - for VS the analyzer shows up but does not provide the codefix

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.