dotnet/wpf · error · ProxyAssemblyNotLoadedException
SR.CouldNotFindType0InAssembly1 (formatted with typeName…
Error message
SR.CouldNotFindType0InAssembly1 (formatted with typeName, assemblyName)
What it means
RegisterProxyAssembly looks for the conventional type '<AssemblyName>.UIAutomationClientSideProviders' inside the loaded proxy assembly; if Assembly.GetType returns null it throws ProxyAssemblyNotLoadedException with SR.CouldNotFindType0InAssembly1. A valid proxy assembly must expose this well-known provider-description type.
Solutions
- Define/rename the class so its full name equals '<AssemblyName>.UIAutomationClientSideProviders' (e.g., assembly 'MyProxies' needs type 'MyProxies.UIAutomationClientSideProviders').
- Make sure the type is public and compiled into the referenced assembly (not a different assembly or internal class).
- Verify the assembly root name (assemblyName.Name) matches the namespace you used for the provider class.
Example fix
// before
namespace MyCompany.Proxies { class UIAutomationClientSideProviders { ... } } // type not found
// after
namespace MyProxies { public class UIAutomationClientSideProviders { public static ClientSideProviderDescription[] ClientSideProviderDescriptionTable = ...; } } Defensive patterns
Strategy: validation
Validate before calling
var asm = Assembly.LoadFrom(proxyDllPath); string expected = asm.GetName().Name + ".UIAutomationClientSideProviders"; bool ok = asm.GetType(expected, throwOnError: false) != null;
Type guard
static bool HasProviderType(Assembly asm) => asm.GetType(asm.GetName().Name + ".UIAutomationClientSideProviders", false) != null;
Try / catch
try { ClientSettings.RegisterClientSideProviders(table); }
catch (ProxyAssemblyNotLoadedException ex) { log.Error($"Invalid proxy assembly layout: {ex.Message}"); } Prevention
- Name the provider class exactly '<AssemblyName>.UIAutomationClientSideProviders'.
- Make the type public and compile it into the proxy assembly itself.
- Add a unit test that loads the proxy assembly and checks the expected type exists.
When it happens
Trigger: Registering a proxy assembly that lacks a public type named '<assembly root namespace>.UIAutomationClientSideProviders' — the default name derived from assemblyName.Name + ".UIAutomationClientSideProviders".
Common situations: Custom proxy assemblies where the provider class was renamed or placed in a namespace not matching the assembly name; building proxies from templates that changed; typo in the class name.
Related errors
- SR.Assembly0NotFound (formatted with assemblyName)
- SR.CouldNotFindRegisterMethodOnType0InAssembly1 (formatted…
- SR.NonclientClassnameCannotBeUsedWithFlagsOrImagename
- ' ' is not a valid value for this control.
- ArgumentNullException (hwnd)
AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14).
Data as JSON: /api/errors/bfb2229803afb503.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/MS/Internal/Automation/ProxyManager.cs:64
// load proxies from specified assembly
internal static void RegisterProxyAssembly ( AssemblyName assemblyName )
{
Assembly a = null;
try
{
a = Assembly.Load( assemblyName );
}
catch(System.IO.FileNotFoundException)
{
throw new ProxyAssemblyNotLoadedException(SR.Format(SR.Assembly0NotFound,assemblyName));
}
string typeName = assemblyName.Name + ".UIAutomationClientSideProviders";
Type t = a.GetType( typeName );
if( t == null )
{
throw new ProxyAssemblyNotLoadedException(SR.Format(SR.CouldNotFindType0InAssembly1, typeName, assemblyName));
}
FieldInfo fi = t.GetField("ClientSideProviderDescriptionTable", BindingFlags.Static | BindingFlags.Public);
if (fi == null || fi.FieldType != typeof(ClientSideProviderDescription[]))
{
throw new ProxyAssemblyNotLoadedException(SR.Format(SR.CouldNotFindRegisterMethodOnType0InAssembly1, typeName, assemblyName));
}
ClientSideProviderDescription[] table = fi.GetValue(null) as ClientSideProviderDescription[];
if (table != null)
{
ClientSettings.RegisterClientSideProviders(table);
}
}
// register specified proxies
internal static void RegisterWindowHandlers(ClientSideProviderDescription[] proxyInfo)
{View on GitHub (pinned to 81131a70a4)