Open jamesqo opened 7 years ago
Can you verify that in step 5, the project you open does not have the xunit.analyzers package installed via NuGet? If it does, then the analyzers and code fixes provided by that package will be preferred¹ to the analyzers and code fixes provided by the VSIX.
¹ The rules for "preferred" are fairly complex, but should get some clarity in the 15.5 release from #18818. As a general rule, however, the best way to test your analyzers and fixers will be on projects that don't try to use two versions at the same time.
@sharwell The test project does not have xunit.analyzers already installed (it's a dummy test project with only 1 file).
Did you install the xunit package in the test project? IIRC current versions of that package automatically install the analyzers.
@jamesqo please make sure your project uses xunit.core
and xunit.assert
packages directly instead of the xunit
meta-package.
@marcind Tried your suggestions, thank you for the advice. The code fixers still aren't kicking in though. Do they work for you when you try debugging your project on a new xUnit Test Project (.NET Core) template?
Version Used: 1.1.0, VS2017
Steps to Reproduce:
src/xunit.analyzers/xunit.analyzers.csproj
and add<DebugType>full</DebugType>
under the<PropertyGroup>
node (so breakpoints will work)powershell ./build.ps1
at the rootFixableDiagnosticIds
Expected Behavior: When one of the analyzers is triggered, e.g. with
Assert.Equal(null, foo)
, the corresponding code fixer that changes it toAssert.Null(foo)
should be triggered too.Actual Behavior: The analyzer is triggered, but the code fix provider is ignored; the breakpoint inside
FixableDiagnosticIds
is never hit.