Skip to content

Commit

Permalink
Don't suggest using the generator on C# < 13
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio0694 committed Dec 29, 2024
1 parent 1b607b5 commit b8a7824
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ public override void Initialize(AnalysisContext context)

context.RegisterCompilationStartAction(static context =>
{
// If the language is not at least C#, the generator can't be used, so we shouldn't emit warnings.
// If we did so, users wouldn't be able to fix them anyway without bumping the language first.
if (!context.Compilation.HasLanguageVersionAtLeastEqualTo(LanguageVersion.CSharp13))
{
return;
}

// Get the XAML mode to use
bool useWindowsUIXaml = context.Options.AnalyzerConfigOptionsProvider.GlobalOptions.GetMSBuildBooleanPropertyValue(WellKnownPropertyNames.DependencyPropertyGeneratorUseWindowsUIXaml);

Expand Down

0 comments on commit b8a7824

Please sign in to comment.