dotnet/wpf · error · ArgumentException

SR.SerializerProviderManufacturerWebsiteNull

Error message

SR.SerializerProviderManufacturerWebsiteNull

What it means

SerializerDescriptor.CreateFromFactoryInstance throws ArgumentException (SR.SerializerProviderManufacturerWebsiteNull) when the ISerializerFactory's ManufacturerWebsite property is null. The website is mandatory metadata describing where users can obtain the serializer plugin.

Solutions

  1. Return a valid non-null website URL string from ManufacturerWebsite
  2. Validate all factory properties (DisplayName, ManufacturerName, ManufacturerWebsite, DefaultFileExtension) before registration
  3. Catch ArgumentException around RegisterSerializer when accepting third-party factories

Example fix

// before
public string ManufacturerWebsite => null;
// after
public string ManufacturerWebsite => "https://example.com/myserializer";
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

bool HasWebsite(ISerializerFactory f) => !string.IsNullOrEmpty(f.ManufacturerWebsite);

Try / catch

try { SerializerProvider.RegisterSerializer(descriptor); }
catch (ArgumentException) { /* supply missing metadata and retry */ }

Prevention

When it happens

Trigger: Calling CreateFromFactoryInstance or RegisterSerializer with a factory whose ManufacturerWebsite property returns null.

Common situations: Custom serializer factories omitting the website property; template/scaffold code leaving the getter unimplemented.

Related errors


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

Appendix: source

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

        ///     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
                _isLoadable = true
            };

            Type factoryType = factoryInstance.GetType();

View on GitHub (pinned to 81131a70a4)