{"record":{"id":"6e5d07b03066a90b","repo":"dotnet/wpf","slug":"sr-serializerproviderunknownserializer","errorCode":null,"errorMessage":"SR.SerializerProviderUnknownSerializer","messagePattern":"SR\\.SerializerProviderUnknownSerializer","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/Serialization/SerializerProvider.cs","lineNumber":147,"sourceCode":"            if (!serializerDescriptor.IsLoadable)\n            {\n                throw new ArgumentException(SR.SerializerProviderWrongVersion, serializerKey);\n            }\n            ArgumentNullException.ThrowIfNull(stream);\n\n            bool found = false;\n            foreach (SerializerDescriptor sd in InstalledSerializers)\n            {\n                if (sd.Equals(serializerDescriptor))\n                {\n                    found = true;\n                    break;\n                }\n            }\n\n            if (!found)\n            {\n                throw new ArgumentException(SR.SerializerProviderUnknownSerializer, serializerKey);\n            }\n\n            try\n            {\n                ISerializerFactory factory = serializerDescriptor.CreateSerializerFactory();\n\n                serializerWriter = factory.CreateSerializerWriter(stream);\n            }\n            catch (FileNotFoundException)\n            {\n                throw new ArgumentException(SR.SerializerProviderCannotLoad, serializerDescriptor.DisplayName);\n            }\n            catch (FileLoadException)\n            {\n                throw new ArgumentException(SR.SerializerProviderCannotLoad, serializerDescriptor.DisplayName);\n            }\n            catch (BadImageFormatException)\n            {","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/Serialization/SerializerProvider.cs#L129-L165","documentation":"SerializerProvider.CreateSerializerWriter throws ArgumentException with SR.SerializerProviderUnknownSerializer when the supplied SerializerDescriptor does not match any currently installed serializer. Even if the descriptor looks loadable, it must be found in InstalledSerializers (matched by DisplayName/AssemblyName/version key) before its factory can be used. The descriptor key is passed as paramName.","triggerScenarios":"Calling SerializerProvider.CreateSerializerWriter(Stream, SerializerDescriptor) with a descriptor that is loadable but is not present in the InstalledSerializers enumeration (the foreach loop over InstalledSerializers never sets found=true).","commonSituations":"Manually constructing a SerializerDescriptor for a plug-in that is not registered/installed on the machine; the plug-in was uninstalled or its registration moved between enumerating serializers and using one; targeting a serializer on a machine where it was never deployed.","solutions":["Only use descriptors taken from SerializerProvider.InstalledSerializers; verify the descriptor is in that list before calling CreateSerializerWriter.","Check the plug-in serializer is installed and registered on the target machine (Program Files/WPF plug-in registry entries).","Fall back to the built-in XPS serializer (e.g. XpsDocument/XpsSerializationManager) instead of a third-party plug-in.","Catch ArgumentException and inform the user the requested serializer is not installed."],"exampleFix":"// before\nvar writer = SerializerProvider.CreateSerializerWriter(stream, customDescriptor);\n// after\nvar installed = SerializerProvider.InstalledSerializers\n    .FirstOrDefault(s => s.AssemblyName == customDescriptor.AssemblyName && s.IsLoadable);\nif (installed == null)\n    throw new InvalidOperationException(\"Requested serializer plug-in is not installed.\");\nvar writer = SerializerProvider.CreateSerializerWriter(stream, installed);","handlingStrategy":"validation","validationCode":"bool installed = SerializerProvider.InstalledSerializers\n    .Any(s => s.AssemblyName == descriptor.AssemblyName\n           && s.AssemblyVersion == descriptor.AssemblyVersion);\nif (!installed) throw new InvalidOperationException(\"Serializer plug-in is not installed on this machine.\");","typeGuard":"static SerializerDescriptor FindInstalled(string assemblyName) =>\n    SerializerProvider.InstalledSerializers.FirstOrDefault(s => s.AssemblyName == assemblyName && s.IsLoadable);","tryCatchPattern":"try { writer = SerializerProvider.CreateSerializerWriter(stream, descriptor); }\ncatch (ArgumentException ex) { throw new InvalidOperationException($\"Unknown serializer: {descriptor.DisplayName}\", ex); }","preventionTips":["Never hand-construct SerializerDescriptor for lookups; use InstalledSerializers","Verify plug-in installation before deploying features that need it","Provide a built-in XPS fallback path"],"tags":["wpf","serialization","plugin-not-installed"],"backgroundTag":"resource-not-found","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-22T01:17:13.364Z"}