{"record":{"id":"df2906038539b549","repo":"unoplatform/uno","slug":"unsupported-resource-type-for-reference-display","errorCode":null,"errorMessage":"Unsupported resource type for {reference.Display} ({reference.GetType()})","messagePattern":"Unsupported resource type for (.+?) \\((.+?)\\)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs","lineNumber":761,"sourceCode":"\t\tprivate static bool IsInsideUnoSolution(GeneratorExecutionContext context)\n\t\t\t=> context.GetMSBuildPropertyValue(\"_IsUnoUISolution\") == \"true\";\n\n\t\tprivate void GenerateResourceLoader(IIndentedStringBuilder writer)\n\t\t{\n\t\t\tTryAnnotateWithGeneratorSource(writer);\n\t\t\twriter.AppendLineIndented($\"global::Windows.ApplicationModel.Resources.ResourceLoader.DefaultLanguage = \\\"{_defaultLanguage}\\\";\");\n\n\t\t\twriter.AppendLineIndented($\"global::Windows.ApplicationModel.Resources.ResourceLoader.AddLookupAssembly(GetType().Assembly);\");\n\n\t\t\tforeach (var reference in _metadataHelper.Compilation.References)\n\t\t\t{\n\t\t\t\tif (_metadataHelper.Compilation.GetAssemblyOrModuleSymbol(reference) is IAssemblySymbol assembly)\n\t\t\t\t{\n\t\t\t\t\tBuildResourceLoaderFromAssembly(writer, assembly);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tthrow new InvalidOperationException($\"Unsupported resource type for {reference.Display} ({reference.GetType()})\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tprivate void BuildResourceLoaderFromAssembly(IIndentedStringBuilder writer, IAssemblySymbol assembly)\n\t\t{\n\t\t\tvar unoHasLocalizationResourcesAttribute = assembly.GetAttributes().FirstOrDefault(a =>\n\t\t\t\tSymbolEqualityComparer.Default.Equals(a.AttributeClass, Generation.AssemblyMetadataSymbol.Value)\n\t\t\t\t&& a.ConstructorArguments.Length == 2\n\t\t\t\t&& a.ConstructorArguments[0].Value is \"UnoHasLocalizationResources\");\n\t\t\tvar unoHasLocalizationResourcesAttributeDefined = unoHasLocalizationResourcesAttribute is not null;\n\n\t\t\tvar hasUnoHasLocalizationResourcesAttributeEnabled = unoHasLocalizationResourcesAttribute\n\t\t\t\t?.ConstructorArguments[1]\n\t\t\t\t.Value\n\t\t\t\t?.ToString()\n\t\t\t\t.Equals(\"True\", StringComparison.OrdinalIgnoreCase) ?? false;\n","sourceCodeStart":743,"sourceCodeEnd":779,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs#L743-L779","documentation":"Thrown during InitializeResourceLoaders when iterating compilation references for localization resources. For each reference, GetAssemblyOrModuleSymbol is called; if the result is not an IAssemblySymbol (e.g. it is null or a module symbol), the exception includes the reference display name and its runtime type.","triggerScenarios":"A compilation reference that is not a standard assembly reference is encountered during the resource-loader initialization scan — e.g. a stream-based reference, a corrupted reference, or a reference type that the generator does not expect.","commonSituations":"Unusual or non-standard assembly references in the compilation (e.g. from analyzers, source generators, or ref-emitted assemblies); SDK or tooling version that produces a reference type not handled by the generator; a corrupted NuGet package reference.","solutions":["Check the reference display name in the error to identify the problematic assembly reference.","Ensure all project references are standard assembly or project references.","Try cleaning and restoring NuGet packages (dotnet clean && dotnet restore).","If the reference is from an analyzer or source generator output, verify it is not being included as a compilation reference."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// If building the compilation programmatically, filter references to valid assemblies:\n// foreach (var reference in compilation.References)\n// {\n//     var sym = compilation.GetAssemblyOrModuleSymbol(reference);\n//     if (sym is IAssemblySymbol asm) { /* safe */ }\n//     else { /* log and skip — non-assembly reference encountered */ }\n// }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep NuGet packages clean and fully restored.","Avoid adding non-standard references (streams, ref-emitted assemblies) to the compilation.","Run dotnet clean && dotnet restore if the error appears after a package change."],"tags":["resources","compilation-references","source-generator","localization"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}