Skip to content

Commit 3eaa8d1

Browse files
fix
1 parent a16d096 commit 3eaa8d1

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/Controls/src/SourceGen/CodeBehindCodeWriter.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public static string GenerateXamlCodeBehind(XamlProjectItemForCB? xamlItem, Comp
148148
if ((xamlInflators & XamlInflator.Runtime) == XamlInflator.Runtime)
149149
InitComp("InitializeComponent");
150150
else if ((xamlInflators & XamlInflator.XamlC) == XamlInflator.XamlC)
151-
InitComp("InitializeComponent", empty: true);
151+
InitComp("InitializeComponent");
152152
else if ((xamlInflators & XamlInflator.SourceGen) == XamlInflator.SourceGen)
153153
InitComp("InitializeComponent", partialsignature: true);
154154
}
@@ -170,11 +170,8 @@ void InitComp(string methodName, bool empty = false, bool partialsignature = fal
170170
if (namedFields != null && namedFields.Any())
171171
{
172172
sb.AppendLine($"#if NET5_0_OR_GREATER");
173-
foreach ((var fname, _, _) in namedFields)
174-
{
175-
173+
foreach ((var fname, _, _) in namedFields)
176174
sb.AppendLine($"\t\t[global::System.Diagnostics.CodeAnalysis.MemberNotNullAttribute(nameof({EscapeIdentifier(fname)}))]");
177-
}
178175

179176
sb.AppendLine($"#endif");
180177
}

0 commit comments

Comments
 (0)