Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed reporting for 'MVVMTK0052'
  • Loading branch information
Sergio0694 committed Nov 30, 2024
commit aa9df8a3b7f628a19388ac1eb8295e7b349f5c33
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public sealed class InvalidPartialPropertyLevelObservablePropertyAttributeAnalyz
/// <inheritdoc/>
public override void Initialize(AnalysisContext context)
{
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
// This generator is intentionally also analyzing generated code, because Roslyn will interpret properties
// that have '[GeneratedCode]' on them as being generated (and the same will apply to all partial parts).
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze | GeneratedCodeAnalysisFlags.ReportDiagnostics);
context.EnableConcurrentExecution();

context.RegisterCompilationStartAction(static context =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,6 @@ public partial string Name
}

[TestMethod]
[Ignore("The symbol callback is not being triggered correctly (see https://github.com/dotnet/roslyn/issues/76166)")]
public async Task InvalidPartialPropertyLevelObservablePropertyAttributeAnalyzer_OnImplementedProperty_GeneratedByAnotherGenerator_Warns()
{
const string source = """
Expand All @@ -913,8 +912,7 @@ public partial string Name
}
""";

// This test is having issues, let's invoke the analyzer directly to make it easier to narrow down the problem
await CSharpAnalyzerWithLanguageVersionTest<InvalidPartialPropertyLevelObservablePropertyAttributeAnalyzer>.VerifyAnalyzerAsync(source, LanguageVersion.Preview);
await VerifyAnalyzerDiagnosticsAndSuccessfulGeneration<InvalidPartialPropertyLevelObservablePropertyAttributeAnalyzer>(source, LanguageVersion.Preview);
}

[TestMethod]
Expand Down