Skip to content

Commit b50ee2a

Browse files
committed
Also allow AppWindowBase inherit
1 parent 8e6e006 commit b50ee2a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

analyzers/StabilityMatrix.Analyzers/ViewModelControlConventionAnalyzer.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ private static void AnalyzeNamedTypeSymbol(SymbolAnalysisContext context)
100100
var templatedControlBaseSymbol = context.Compilation.GetTypeByMetadataName(
101101
"StabilityMatrix.Avalonia.Controls.TemplatedControlBase"
102102
);
103+
var appWindowBaseSymbol = context.Compilation.GetTypeByMetadataName(
104+
"StabilityMatrix.Avalonia.Controls.AppWindowBase"
105+
);
103106
var viewAttributeSymbol = context.Compilation.GetTypeByMetadataName(
104107
"StabilityMatrix.Core.Attributes.ViewAttribute"
105108
);
@@ -135,8 +138,10 @@ private static void AnalyzeNamedTypeSymbol(SymbolAnalysisContext context)
135138
var inheritsTemplatedControlBase =
136139
templatedControlBaseSymbol != null
137140
&& DoesInheritFrom(controlTypeSymbol, templatedControlBaseSymbol);
141+
var inheritsAppWindowBase =
142+
appWindowBaseSymbol != null && DoesInheritFrom(controlTypeSymbol, appWindowBaseSymbol);
138143

139-
if (!inheritsUserControlBase && !inheritsTemplatedControlBase)
144+
if (!inheritsUserControlBase && !inheritsTemplatedControlBase && !inheritsAppWindowBase)
140145
{
141146
var location = directViewAttribute.ApplicationSyntaxReference?.GetSyntax(
142147
context.CancellationToken

0 commit comments

Comments
 (0)