dotnet/wpf · error · ArgumentException

SR.SerializerProviderManufacturerNameNull

Error message

SR.SerializerProviderManufacturerNameNull

What it means

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.

Solutions

  1. Implement ManufacturerName to return a non-null company/manufacturer string
  2. Pre-validate factory.ManufacturerName != null before registration
  3. Add a constructor-time guard so a null manufacturer cannot instantiate the factory

Example fix

// before
public string ManufacturerName => _config.VendorName; // _config.VendorName may be null
// after
public string ManufacturerName => _config.VendorName ?? "Unknown Manufacturer";
Defensive patterns

Strategy: validation

Validate before calling

if (string.IsNullOrEmpty(factory.ManufacturerName))
    throw new InvalidOperationException("Serializer ManufacturerName must be set before registration");

Type guard

bool HasManufacturerName(ISerializerFactory f) => !string.IsNullOrEmpty(f.ManufacturerName);

Try / catch

try { SerializerProvider.RegisterSerializer(descriptor); }
catch (ArgumentException ex) { /* inspect which required property was null */ }

Prevention

When it happens

Trigger: Calling CreateFromFactoryInstance (directly or via SerializerProvider.RegisterSerializer) with a factory whose ManufacturerName returns null.

Common situations: Custom ISerializerFactory implementations omitting ManufacturerName; vendor plugins built against an incomplete factory implementation.

Related errors


AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14). Data as JSON: /api/errors/fb1c56783459af0c. Report an issue: GitHub.

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/Serialization/SerializerDescriptor.cs:70

        /// </summary>
        /// <remarks>
        ///     Create a SerializerDescriptor from a ISerializerFactory instance
        ///
        ///     This method currently requires full trust to run.
        /// </remarks>
        public static SerializerDescriptor CreateFromFactoryInstance(
            ISerializerFactory  factoryInstance
            )
        {

            ArgumentNullException.ThrowIfNull(factoryInstance);
            if (factoryInstance.DisplayName == null)
            {
                throw new ArgumentException(SR.SerializerProviderDisplayNameNull);
            }
            if (factoryInstance.ManufacturerName == null)
            {
                throw new ArgumentException(SR.SerializerProviderManufacturerNameNull);
            }
            if (factoryInstance.ManufacturerWebsite == null)
            {
                throw new ArgumentException(SR.SerializerProviderManufacturerWebsiteNull);
            }
            if (factoryInstance.DefaultFileExtension == null)
            {
                throw new ArgumentException(SR.SerializerProviderDefaultFileExtensionNull);
            }

            SerializerDescriptor sd = new SerializerDescriptor
            {
                _displayName = factoryInstance.DisplayName,
                _manufacturerName = factoryInstance.ManufacturerName,
                _manufacturerWebsite = factoryInstance.ManufacturerWebsite,
                _defaultFileExtension = factoryInstance.DefaultFileExtension,

                // When this is called with an instantiated factory object, it must be loadable

View on GitHub (pinned to 81131a70a4)