dotnet/wpf · warning · ArgumentException
SR.SerializerProviderNotRegistered
Error message
SR.SerializerProviderNotRegistered
What it means
SerializerProvider.UnregisterSerializer deletes the registry subkey '{DisplayName}/{AssemblyName}/{AssemblyVersion}/{WinFXVersion}' for the given descriptor. If no such key exists, it throws ArgumentException (SR.SerializerProviderNotRegistered) with the serializer key as paramName — you cannot unregister a serializer that was never registered.
Solutions
- Verify registration first (open the registry key or attempt RegisterSerializer semantics) before calling UnregisterSerializer
- Catch ArgumentException and treat 'not registered' as a no-op success in uninstall code
- Ensure the descriptor passed matches the original registration exactly (same DisplayName, AssemblyName, AssemblyVersion, WinFXVersion)
- Manually delete the stale plugin subkey under the serializer plugins registry path if descriptors cannot be reconstructed
Example fix
// before
SerializerProvider.UnregisterSerializer(descriptor); // throws if absent
// after
try { SerializerProvider.UnregisterSerializer(descriptor); }
catch (ArgumentException) { /* not registered - nothing to do */ } Defensive patterns
Strategy: try-catch
Validate before calling
using Microsoft.Win32;
bool SerializerKeyExists(RegistryKey root, string pluginsPath, SerializerDescriptor d) {
using var plugins = root.OpenSubKey(pluginsPath);
var key = $"{d.DisplayName}/{d.AssemblyName}/{d.AssemblyVersion}/{d.WinFXVersion}";
using var k = plugins?.OpenSubKey(key);
return k != null;
} Try / catch
try { SerializerProvider.UnregisterSerializer(descriptor); }
catch (ArgumentException) { /* not registered - no-op */ } Prevention
- Check for the key before unregistering
- Reuse the exact descriptor (same version) used at registration
- Make uninstallers idempotent by swallowing 'not registered' errors
When it happens
Trigger: Calling UnregisterSerializer with a descriptor whose registration key is absent: never registered, already uninstalled, or registered with different DisplayName/AssemblyName/AssemblyVersion/WinFXVersion values than the descriptor passed now.
Common situations: Uninstaller removing a plugin twice; unregistration using a descriptor whose version differs from the one originally registered; cleaning a machine where the plugin registry was manually edited.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- SR.SerializerProviderAlreadyRegistered
- SR.ReachSerialization_NoSerializer
- SR.SerializerProviderDefaultFileExtensionNull
- SR.SerializerProviderDisplayNameNull
- SR.SerializerProviderManufacturerNameNull
AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14).
Data as JSON: /api/errors/be645e87166d9770.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/Serialization/SerializerProvider.cs:105
/// <summary>
/// Un-Registers the serializer plug-in identified by serializerDescriptor in the registry
/// </summary>
/// <remarks>
/// Removes a previously installed plug-n serialiazer from the registry
///
/// This method currently requires full trust to run.
/// </remarks>
public static void UnregisterSerializer(SerializerDescriptor serializerDescriptor)
{
ArgumentNullException.ThrowIfNull(serializerDescriptor);
RegistryKey plugIns = _rootKey.CreateSubKey(_registryPath);
string serializerKey = $"{serializerDescriptor.DisplayName}/{serializerDescriptor.AssemblyName}/{serializerDescriptor.AssemblyVersion}/{serializerDescriptor.WinFXVersion}";
if (plugIns.OpenSubKey(serializerKey) == null)
{
throw new ArgumentException(SR.SerializerProviderNotRegistered, serializerKey);
}
plugIns.DeleteSubKeyTree(serializerKey);
}
/// <summary>
/// Create a SerializerWriter identified by the passed in SerializerDescriptor on the passed in stream
/// </summary>
/// <remarks>
/// With a SerializerProvider (which requires full trust to ctor) and a SerializerDescriptor (which requires
/// full trust to obtain) create a SerializerWriter
///
/// This method currently requires full trust to run.
/// </remarks>
public SerializerWriter CreateSerializerWriter(SerializerDescriptor serializerDescriptor, Stream stream)
{
SerializerWriter serializerWriter = null;View on GitHub (pinned to 81131a70a4)