Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/Authoring/WinRT.SourceGenerator/AotOptimizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ private static BindableCustomProperties GetBindableCustomProperties(GeneratorAtt
symbol.TypeKind,
symbol.IsRecord,
classHierarchy,
ToFullyQualifiedString(symbol),
ToFullyQualifiedString(symbol, false),
bindableCustomProperties.ToImmutableArray());

void AddProperty(ISymbol symbol)
Expand All @@ -422,20 +422,20 @@ void AddProperty(ISymbol symbol)
{
bindableCustomProperties.Add(new BindableCustomProperty(
propertySymbol.MetadataName,
ToFullyQualifiedString(propertySymbol.Type),
ToFullyQualifiedString(propertySymbol.Type, false),
// 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.IsInitOnly && propertySymbol.SetMethod.DeclaredAccessibility == Accessibility.Public,
propertySymbol.IsIndexer,
propertySymbol.IsIndexer ? ToFullyQualifiedString(propertySymbol.Parameters[0].Type) : "",
propertySymbol.IsIndexer ? ToFullyQualifiedString(propertySymbol.Parameters[0].Type, false) : "",
propertySymbol.IsStatic
));
}
}
}
#nullable disable

private static string ToFullyQualifiedString(ISymbol symbol)
private static string ToFullyQualifiedString(ISymbol symbol, bool trimGlobal = true)
{
// Used to ensure class names within generics are fully qualified to avoid
// having issues when put in ABI namespaces.
Expand All @@ -446,7 +446,7 @@ private static string ToFullyQualifiedString(ISymbol symbol)
miscellaneousOptions: SymbolDisplayMiscellaneousOptions.UseSpecialTypes | SymbolDisplayMiscellaneousOptions.ExpandNullable);

var qualifiedString = symbol.ToDisplayString(symbolDisplayString);
return qualifiedString.StartsWith("global::") ? qualifiedString[8..] : qualifiedString;
return trimGlobal && qualifiedString.StartsWith("global::") ? qualifiedString[8..] : qualifiedString;
}

private static string ToVtableLookupString(ISymbol symbol)
Expand Down
2 changes: 2 additions & 0 deletions src/Tests/AuthoringTest/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ public sealed partial class CustomProperty
{
public int Number { get; } = 4;
public string Value => "CsWinRT";
public CustomWWW Url => null;
public CustomPropertyStructType CustomPropertyStructType => new CustomPropertyStructType();
}

[GeneratedBindableCustomProperty]
Expand Down
1 change: 1 addition & 0 deletions src/Tests/FunctionalTests/CCW/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,7 @@ public string SetOnly
}
public string PrivateSet { get; private set; } = "PrivateSet";
public static double StaticDouble { get; set; } = 4.0;
public ManagedProperties ManagedProperties { get; set; } = new(4);
}

[GeneratedBindableCustomProperty]
Expand Down
Loading