{"record":{"id":"fb1c56783459af0c","repo":"dotnet/wpf","slug":"sr-serializerprovidermanufacturernamenull","errorCode":null,"errorMessage":"SR.SerializerProviderManufacturerNameNull","messagePattern":"SR\\.SerializerProviderManufacturerNameNull","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/Serialization/SerializerDescriptor.cs","lineNumber":70,"sourceCode":"        /// </summary>\n        /// <remarks>\n        ///     Create a SerializerDescriptor from a ISerializerFactory instance\n        ///\n        ///     This method currently requires full trust to run.\n        /// </remarks>\n        public static SerializerDescriptor CreateFromFactoryInstance(\n            ISerializerFactory  factoryInstance\n            )\n        {\n\n            ArgumentNullException.ThrowIfNull(factoryInstance);\n            if (factoryInstance.DisplayName == null)\n            {\n                throw new ArgumentException(SR.SerializerProviderDisplayNameNull);\n            }\n            if (factoryInstance.ManufacturerName == null)\n            {\n                throw new ArgumentException(SR.SerializerProviderManufacturerNameNull);\n            }\n            if (factoryInstance.ManufacturerWebsite == null)\n            {\n                throw new ArgumentException(SR.SerializerProviderManufacturerWebsiteNull);\n            }\n            if (factoryInstance.DefaultFileExtension == null)\n            {\n                throw new ArgumentException(SR.SerializerProviderDefaultFileExtensionNull);\n            }\n\n            SerializerDescriptor sd = new SerializerDescriptor\n            {\n                _displayName = factoryInstance.DisplayName,\n                _manufacturerName = factoryInstance.ManufacturerName,\n                _manufacturerWebsite = factoryInstance.ManufacturerWebsite,\n                _defaultFileExtension = factoryInstance.DefaultFileExtension,\n\n                // When this is called with an instantiated factory object, it must be loadable","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/Serialization/SerializerDescriptor.cs#L52-L88","documentation":"SerializerDescriptor.CreateFromFactoryInstance throws ArgumentException (SR.SerializerProviderManufacturerNameNull) when the ISerializerFactory's ManufacturerName property is null. Manufacturer name is required serializer metadata used in registration and in the save-file-format UI.","triggerScenarios":"Calling CreateFromFactoryInstance (directly or via SerializerProvider.RegisterSerializer) with a factory whose ManufacturerName returns null.","commonSituations":"Custom ISerializerFactory implementations omitting ManufacturerName; vendor plugins built against an incomplete factory implementation.","solutions":["Implement ManufacturerName to return a non-null company/manufacturer string","Pre-validate factory.ManufacturerName != null before registration","Add a constructor-time guard so a null manufacturer cannot instantiate the factory"],"exampleFix":"// before\npublic string ManufacturerName => _config.VendorName; // _config.VendorName may be null\n// after\npublic string ManufacturerName => _config.VendorName ?? \"Unknown Manufacturer\";","handlingStrategy":"validation","validationCode":"if (string.IsNullOrEmpty(factory.ManufacturerName))\n    throw new InvalidOperationException(\"Serializer ManufacturerName must be set before registration\");","typeGuard":"bool HasManufacturerName(ISerializerFactory f) => !string.IsNullOrEmpty(f.ManufacturerName);","tryCatchPattern":"try { SerializerProvider.RegisterSerializer(descriptor); }\ncatch (ArgumentException ex) { /* inspect which required property was null */ }","preventionTips":["Provide non-null defaults for all factory metadata properties","Validate the full factory surface (DisplayName, ManufacturerName, ManufacturerWebsite, DefaultFileExtension) in tests"],"tags":["wpf","serializer","null-argument","argumentexception"],"backgroundTag":"null-argument","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"}