{"record":{"id":"a20365b66c7d3b5d","repo":"unoplatform/uno","slug":"unresolved-object-reference-0-was-found","errorCode":null,"errorMessage":"Unresolved object reference '{0}' was found","messagePattern":"Unresolved object reference '(.+?)' was found","errorType":"exception","errorClass":"XamlObjectWriterException","httpStatus":null,"severity":"error","filePath":"src/SourceGenerators/System.Xaml/System.Xaml/XamlObjectWriter.cs","lineNumber":604,"sourceCode":"\t\t}\n\n\t\tinternal IXamlNameResolver name_resolver {\n\t\t\tget { return (IXamlNameResolver) service_provider.GetService (typeof (IXamlNameResolver)); }\n\t\t}\n\n\t\tinternal override IAmbientProvider AmbientProvider {\n\t\t\tget { return ambient_provider; }\n\t\t}\n\n\t\tvoid ResolvePendingReferences ()\n\t\t{\n\t\t\tforeach (var fixup in pending_name_references) {\n\t\t\t\tforeach (var name in fixup.Names) {\n\t\t\t\t\tbool isFullyInitialized;\n\t\t\t\t\t// FIXME: sort out relationship between name_scope and name_resolver. (unify to name_resolver, probably)\n\t\t\t\t\tvar obj = name_scope.FindName (name) ?? name_resolver.Resolve (name, out isFullyInitialized);\n\t\t\t\t\tif (obj == null)\n\t\t\t\t\t\tthrow new XamlObjectWriterException (String.Format (CultureInfo.InvariantCulture, \"Unresolved object reference '{0}' was found\", name));\n\t\t\t\t\tif (!AddToCollectionIfAppropriate (fixup.ParentType, fixup.ParentMember, fixup.ParentValue, obj, null)) // FIXME: is keyObj always null?\n\t\t\t\t\t\tSetValue (fixup.ParentMember, fixup.ParentValue, obj);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tvoid HandleBeginInit (object value)\n\t\t{\n\t\t\tvar si = value as ISupportInitialize;\n\t\t\tif (si == null)\n\t\t\t\treturn;\n\t\t\tsi.BeginInit ();\n\t\t\tsource.OnAfterBeginInit (value);\n\t\t}\n\t\t\n\t\tvoid HandleEndInit (object value)\n\t\t{\n\t\t\tvar si = value as ISupportInitialize;","sourceCodeStart":586,"sourceCodeEnd":622,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SourceGenerators/System.Xaml/System.Xaml/XamlObjectWriter.cs#L586-L622","documentation":"Thrown in ResolvePendingReferences (run at the end of writing) when an x:Reference name could not be resolved from either the name scope or the IXamlNameResolver. Forward/back references that remain unresolved at write completion surface here.","triggerScenarios":"XAML containing `<x:Reference Member=\"MissingName\"/>` where no element has `x:Name=\"MissingName\"` in any visible scope.","commonSituations":"Typo in the referenced name; forward reference to a name defined in a sibling/nested scope not visible to the resolver; missing x:Name on the target element.","solutions":["Ensure an element with `x:Name=\"<the name>\"` exists in a scope visible to the resolver.","Fix typos in the x:Reference Member value.","If it is a forward reference, confirm the name resolver supports late resolution and that the name is truly in scope."],"exampleFix":"<!-- before -->\n<CheckBox IsChecked=\"{x:Reference Missing}\" />\n<!-- after -->\n<CheckBox x:Name=\"cb\" IsChecked=\"{x:Reference cb}\" />","handlingStrategy":"validation","validationCode":"// Before finishing, verify every x:Reference target has a matching x:Name in scope.\nforeach (var name in referencedNames)\n    if (nameScope.FindName(name) == null)\n        throw new InvalidOperationException($\"x:Reference target '{name}' is not defined.\");","typeGuard":null,"tryCatchPattern":"try { /* write/load the full graph */ }\ncatch (XamlObjectWriterException ex) when (ex.Message.Contains(\"Unresolved object reference\")) {\n    // a referenced name is missing or out of scope; add/fix x:Name.\n}","preventionTips":["Add x:Name to any element targeted by x:Reference.","Double-check spelling of referenced names.","Confirm forward references are within a scope the name resolver can see."],"tags":["xaml","reference","name-resolution","object-writer"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}