dotnet/wpf · error · ArgumentException
SR.SerializerProviderCannotLoad
Error message
SR.SerializerProviderCannotLoad
What it means
SerializerProvider.CreateSerializerWriter wraps factory creation and wraps FileNotFoundException in an ArgumentException with SR.SerializerProviderCannotLoad. This means the serializer plug-in assembly (named by serializerDescriptor.DisplayName) could not be found on disk when CreateSerializerFactory attempted to load it. The plug-in descriptor exists in the registry but the underlying DLL is missing.
Solutions
- Reinstall or repair the serializer plug-in so its assembly is present at the registered location.
- Remove the stale plug-in registration so it no longer appears in InstalledSerializers.
- Pick a different installed serializer from InstalledSerializers whose assembly loads successfully.
- Catch ArgumentException (paramName = DisplayName) and fall back to the built-in XPS serializer.
Example fix
// before
var writer = SerializerProvider.CreateSerializerWriter(stream, descriptor);
// after
try
{
writer = SerializerProvider.CreateSerializerWriter(stream, descriptor);
}
catch (ArgumentException ex)
{
throw new InvalidOperationException($"Serializer '{descriptor.DisplayName}' could not be loaded: {ex.Message}", ex);
} Defensive patterns
Strategy: try-catch
Validate before calling
static bool TryGetFactory(SerializerDescriptor d, out ISerializerFactory f)
{ try { f = d.CreateSerializerFactory(); return true; } catch (FileNotFoundException) { f = null; return false; } } Type guard
null
Try / catch
try { writer = SerializerProvider.CreateSerializerWriter(stream, descriptor); }
catch (ArgumentException ex) when (ex.ParamName == descriptor.DisplayName)
{ log.Error($"Serializer assembly for '{descriptor.DisplayName}' is missing.", ex); writer = UseBuiltInXps(stream); } Prevention
- Repair/reinstall plug-ins after OS or framework servicing
- Prune stale plug-in registrations
- Keep a built-in XPS fallback in code
When it happens
Trigger: Calling CreateSerializerWriter with a descriptor whose factory creation (serializerDescriptor.CreateSerializerFactory / Assembly.Load) throws FileNotFoundException because the plug-in assembly file is absent.
Common situations: A registered WPF serializer plug-in was deleted or moved after registration; partial uninstall left stale registry entries; deployment to a machine missing the plug-in DLL; mismatched x86/x64 install paths.
Understand the failure class
Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.
Related errors
- ArgumentNullException(nameof(writer))
- Cannot find the appropriate serializer.
- Cannot find the appropriate serializer.
- Cannot find the appropriate serializer.
- Cannot instantiate a serializer of the given type.
AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14).
Data as JSON: /api/errors/0a5b782d1ed25869.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/Serialization/SerializerProvider.cs:158
found = true;
break;
}
}
if (!found)
{
throw new ArgumentException(SR.SerializerProviderUnknownSerializer, serializerKey);
}
try
{
ISerializerFactory factory = serializerDescriptor.CreateSerializerFactory();
serializerWriter = factory.CreateSerializerWriter(stream);
}
catch (FileNotFoundException)
{
throw new ArgumentException(SR.SerializerProviderCannotLoad, serializerDescriptor.DisplayName);
}
catch (FileLoadException)
{
throw new ArgumentException(SR.SerializerProviderCannotLoad, serializerDescriptor.DisplayName);
}
catch (BadImageFormatException)
{
throw new ArgumentException(SR.SerializerProviderCannotLoad, serializerDescriptor.DisplayName);
}
catch (MissingMethodException)
{
throw new ArgumentException(SR.SerializerProviderCannotLoad, serializerDescriptor.DisplayName);
}
return serializerWriter;
}
#endregionView on GitHub (pinned to 81131a70a4)