{"record":{"id":"aea47566f049e1cc","repo":"dotnet/wpf","slug":"cannot-get-a-xamldeferringloader-from-xamlvalueconverter-0","errorCode":null,"errorMessage":"Cannot get a XamlDeferringLoader from XamlValueConverter '{0}' because its ConverterInstance property is null.","messagePattern":"Cannot get a XamlDeferringLoader from XamlValueConverter '(.+?)' because its ConverterInstance property is null\\.","errorType":"exception","errorClass":"XamlObjectWriterException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Runtime/ClrObjectRuntime.cs","lineNumber":589,"sourceCode":"                throw CreateException(SR.Format(SR.SetXmlInstance, property), e);\n            }\n        }\n\n        public override TConverterBase GetConverterInstance<TConverterBase>(XamlValueConverter<TConverterBase> converter)\n        {\n            return converter.ConverterInstance;\n        }\n\n        public override object DeferredLoad(ServiceProviderContext serviceContext,\n                                             XamlValueConverter<XamlDeferringLoader> deferringLoader,\n                                             XamlReader deferredContent)\n        {\n            try\n            {\n                XamlDeferringLoader converter = GetConverterInstance(deferringLoader);\n                if (converter is null)\n                {\n                    throw new XamlObjectWriterException(SR.Format(SR.DeferringLoaderInstanceNull, deferringLoader));\n                }\n\n                return converter.Load(deferredContent, serviceContext);\n            }\n            catch (Exception e)\n            {\n                // Reset the reader in case our caller catches and retries\n                if (deferredContent is IXamlIndexingReader indexingReader && indexingReader.CurrentIndex >= 0)\n                {\n                    indexingReader.CurrentIndex = -1;\n                }\n\n                if (CriticalExceptions.IsCriticalException(e) || e is XamlException)\n                {\n                    throw;\n                }\n\n                throw CreateException(SR.DeferredLoad, e);","sourceCodeStart":571,"sourceCodeEnd":607,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Runtime/ClrObjectRuntime.cs#L571-L607","documentation":"ClrObjectRuntime.DeferredLoad resolves the XamlDeferringLoader for deferred (x:XData-like) content via GetConverterInstance(deferringLoader). If the XamlValueConverter has no ConverterInstance (the loader type could not be constructed/instantiated), it throws XamlObjectWriterException with DeferringLoaderInstanceNull. The library throws this because it cannot load deferred content without a live loader instance.","triggerScenarios":"Calling DeferredLoad during XamlObjectWriter/ClrObjectRuntime processing of deferred content where the XamlDeferringLoader's XamlValueConverter.ConverterInstance is null — typically because the loader type failed to construct (no parameterless ctor, abstract type, missing assembly, type load failure).","commonSituations":"Custom XamlDeferringLoader with no public parameterless constructor; assembly containing the loader not referenced/available at load time; x:XamlDeferringLoader attribute pointing at a wrong or renamed type after a refactor.","solutions":["Ensure the deferring loader type has a public parameterless constructor and is instantiable (not abstract/generic-open)","Add a reference to the assembly containing the XamlDeferringLoader type","Verify the x:XamlDeferringLoader / XamlDeferringLoader attribute names the correct, existing type"],"exampleFix":"// before\nclass MyLoader<T> : XamlDeferringLoader { ... } // open generic, cannot construct\n// after\nclass MyLoader : XamlDeferringLoader { public MyLoader() { } ... }","handlingStrategy":"try-catch","validationCode":"var conv = schemaContext.GetXamlType(typeof(MyDeferredType)).DeferringLoader; bool ok = conv?.ConverterInstance != null; if (!ok) throw new InvalidOperationException(\"Deferring loader not instantiable for \" + typeof(MyDeferredType));","typeGuard":"static bool HasLiveLoader(XamlValueConverter c) => c?.ConverterInstance != null;","tryCatchPattern":"try { LoadDeferred(content); } catch (XamlObjectWriterException ex) when (ex.Message.Contains(\"DeferringLoader\")) { throw new InvalidOperationException(\"Check XamlDeferringLoader type: public parameterless ctor + referenced assembly\", ex); }","preventionTips":["Give every custom XamlDeferringLoader a public parameterless constructor","Reference the assembly containing the loader in every consuming project","Keep loader type names in markup in sync during refactors (use Resharper/IDE rename)"],"tags":["xaml","deferring-loader","runtime","instantiation"],"backgroundTag":"missing-dependency","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-21T21:30:21.729Z"}