From 7f9a1bc6003b97e721840ea4f79ecaa60163ef7f Mon Sep 17 00:00:00 2001 From: Steven He Date: Tue, 3 Sep 2024 01:06:49 +0900 Subject: [PATCH] Treat initonly properties as cannot write --- src/Authoring/WinRT.SourceGenerator/AotOptimizer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Authoring/WinRT.SourceGenerator/AotOptimizer.cs b/src/Authoring/WinRT.SourceGenerator/AotOptimizer.cs index afde6b005..00e0bae9f 100644 --- a/src/Authoring/WinRT.SourceGenerator/AotOptimizer.cs +++ b/src/Authoring/WinRT.SourceGenerator/AotOptimizer.cs @@ -346,7 +346,7 @@ void AddProperty(ISymbol symbol) ToFullyQualifiedString(propertySymbol.Type), // Make sure the property accessors are also public even if property itself is public. propertySymbol.GetMethod != null && propertySymbol.GetMethod.DeclaredAccessibility == Accessibility.Public, - propertySymbol.SetMethod != null && propertySymbol.SetMethod.DeclaredAccessibility == Accessibility.Public, + propertySymbol.SetMethod != null && !propertySymbol.SetMethod.IsInitOnly && propertySymbol.SetMethod.DeclaredAccessibility == Accessibility.Public, propertySymbol.IsIndexer, propertySymbol.IsIndexer ? ToFullyQualifiedString(propertySymbol.Parameters[0].Type) : "", propertySymbol.IsStatic