dotnet/wpf · error · ProxyAssemblyNotLoadedException

SR.Assembly0NotFound (formatted with assemblyName)

Error message

SR.Assembly0NotFound (formatted with assemblyName)

What it means

RegisterProxyAssembly loads a proxy provider assembly via Assembly.Load(assemblyName); on FileNotFoundException it rethrows ProxyAssemblyNotLoadedException with SR.Assembly0NotFound formatted with the assembly name. It indicates the client-side UIA proxy assembly could not be located or loaded.

Solutions

  1. Ensure the proxy assembly exists at the expected probe location and the AssemblyName (name, version, culture, publicKeyToken) matches exactly.
  2. Add the assembly's directory to the application's probing path (App.config probing/privatePath or AppDomain.AssemblyResolve handler).
  3. Verify the assembly's dependencies are also deployed and loadable.
  4. Confirm the assembly targets a compatible CLR version and is loadable in-process (32/64-bit match).

Example fix

// before
ClientSettings.RegisterClientSideProviders(...); // assembly 'MyProxies' not found
// after
AppDomain.CurrentDomain.AssemblyResolve += (s, e) =>
    e.Name.StartsWith("MyProxies") ? Assembly.LoadFrom(@"C:\app\MyProxies.dll") : null;
Defensive patterns

Strategy: validation

Validate before calling

var path = @"C:\app\MyProxies.dll";
if (!System.IO.File.Exists(path)) throw new FileNotFoundException("Proxy assembly missing", path);

Type guard

static bool CanLoadAssembly(AssemblyName name) => AppDomain.CurrentDomain.GetAssemblies().Any(a => a.GetName().FullName == name.FullName);

Try / catch

try { ClientSettings.RegisterClientSideProviders(table); }
catch (ProxyAssemblyNotLoadedException ex) { log.Error($"Proxy assembly failed to load: {ex.Message}"); }

Prevention

When it happens

Trigger: Calling ClientSettings.RegisterClientSideProviders / LoadDefaultProxies path (proxy registration) with an AssemblyName whose DLL is not on the probe path (application directory, GAC, or probing paths).

Common situations: Custom UIA proxy assemblies not deployed next to the app, misnamed assembly (name/version/publicKeyToken mismatch), or missing dependency of the proxy assembly.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/MS/Internal/Automation/ProxyManager.cs:57

        //  Internal Methods
        //
        //------------------------------------------------------
 
        #region Internal Methods

        #region Proxy registration and table management

        // 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)
            {

View on GitHub (pinned to 81131a70a4)