diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators/BindableTypeProviders/BindableTypeProvidersGenerationTask.cs b/src/SourceGenerators/Uno.UI.SourceGenerators/BindableTypeProviders/BindableTypeProvidersGenerationTask.cs index f61c6ffe16da..e8c0824eecb1 100644 --- a/src/SourceGenerators/Uno.UI.SourceGenerators/BindableTypeProviders/BindableTypeProvidersGenerationTask.cs +++ b/src/SourceGenerators/Uno.UI.SourceGenerators/BindableTypeProviders/BindableTypeProvidersGenerationTask.cs @@ -31,7 +31,7 @@ public class BindableTypeProvidersSourceGenerator : SourceGenerator private INamedTypeSymbol _javaObjectSymbol; private INamedTypeSymbol _nsObjectSymbol; private INamedTypeSymbol _nonBindableSymbol; - + private INamedTypeSymbol _resourceDictionarySymbol; private IModuleSymbol _currentModule; public string[] AnalyzerSuppressions { get; set; } @@ -58,7 +58,7 @@ public override void Execute(SourceGeneratorContext context) _nsObjectSymbol = context.Compilation.GetTypeByMetadataName("Foundation.NSObject"); _stringSymbol = context.Compilation.GetTypeByMetadataName("System.String"); _nonBindableSymbol = context.Compilation.GetTypeByMetadataName("Windows.UI.Xaml.Data.NonBindableAttribute"); - + _resourceDictionarySymbol = context.Compilation.GetTypeByMetadataName("Windows.UI.Xaml.ResourceDictionary"); _currentModule = context.Compilation.SourceModule; AnalyzerSuppressions = new string[0]; @@ -142,7 +142,12 @@ from type in module.GlobalNamespace.GetNamespaceTypes() return writer.ToString(); } - private bool IsValidProvider(INamedTypeSymbol type) => type.IsLocallyPublic(_currentModule); + private bool IsValidProvider(INamedTypeSymbol type) + => type.IsLocallyPublic(_currentModule) + + // Exclude resource dictionaries for linking constraints (XamlControlsResources in particular) + // Those are not databound, so there's no need to generate providers for them. + && !type.Is(_resourceDictionarySymbol); private void GenerateProviderTable(IEnumerable q, IndentedStringBuilder writer) {