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

Tests fail due to code fixes in bad locations #1364

Open
AArnott opened this issue Jan 12, 2025 · 0 comments
Open

Tests fail due to code fixes in bad locations #1364

AArnott opened this issue Jan 12, 2025 · 0 comments

Comments

@AArnott
Copy link
Member

AArnott commented Jan 12, 2025

Bug description

A couple tests fail with:

Message: 
System.InvalidOperationException : Code fix is attempting to provide a fix for a non-local analyzer diagnostic

  Stack Trace: 
DefaultVerifier.False(Boolean assert, String message)
CodeFixTest`1.FixEachAnalyzerDiagnosticAsync(ImmutableArray`1 analyzers, ImmutableArray`1 codeFixProviders, Nullable`1 codeFixIndex, String codeFixEquivalenceKey, Action`2 codeActionVerifier, Project project, Int32 numberOfIterations, IVerifier verifier, CancellationToken cancellationToken)
CodeFixTest`1.VerifyFixAsync(String language, ImmutableArray`1 analyzers, ImmutableArray`1 codeFixProviders, SolutionState oldState, SolutionState newState, Int32 numberOfIterations, Func`10 getFixedProject, IVerifier verifier, CancellationToken cancellationToken)
CodeFixTest`1.VerifyFixAsync(SolutionState testState, SolutionState fixedState, SolutionState batchFixedState, IVerifier verifier, CancellationToken cancellationToken)
CodeFixTest`1.RunImplAsync(CancellationToken cancellationToken)
AnalyzerTest`1.RunAsync(CancellationToken cancellationToken)
VSTHRD010MainThreadUsageAnalyzerTests.RequiresUIThreadTransitive_MultipleInMember() line 580
--- End of stack trace from previous location ---

These are the tests that fail:

RequiresUIThreadTransitive_MultipleInMember
TransitiveNoCheck_InCtor

Repro steps

Enable the tests and run them.

Expected behavior

Tests should pass.

Actual behavior

Tests fail when enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant