{"record":{"id":"bfb2229803afb503","repo":"dotnet/wpf","slug":"sr-couldnotfindtype0inassembly1-formatted-with-typename","errorCode":null,"errorMessage":"SR.CouldNotFindType0InAssembly1 (formatted with typeName, assemblyName)","messagePattern":"SR\\.CouldNotFindType0InAssembly1 \\(formatted with typeName, assemblyName\\)","errorType":"exception","errorClass":"ProxyAssemblyNotLoadedException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/MS/Internal/Automation/ProxyManager.cs","lineNumber":64,"sourceCode":"\n        // load proxies from specified assembly\n        internal static void RegisterProxyAssembly ( AssemblyName assemblyName )\n        {\n            Assembly a = null;\n            try\n            {\n                a = Assembly.Load( assemblyName );\n            }\n            catch(System.IO.FileNotFoundException)\n            {\n                throw new ProxyAssemblyNotLoadedException(SR.Format(SR.Assembly0NotFound,assemblyName));\n            } \n            \n            string typeName = assemblyName.Name + \".UIAutomationClientSideProviders\";\n            Type t = a.GetType( typeName );\n            if( t == null )\n            {\n                throw new ProxyAssemblyNotLoadedException(SR.Format(SR.CouldNotFindType0InAssembly1, typeName, assemblyName));\n            }\n\n            FieldInfo fi = t.GetField(\"ClientSideProviderDescriptionTable\", BindingFlags.Static | BindingFlags.Public);\n            if (fi == null || fi.FieldType !=  typeof(ClientSideProviderDescription[]))\n            {\n                throw new ProxyAssemblyNotLoadedException(SR.Format(SR.CouldNotFindRegisterMethodOnType0InAssembly1, typeName, assemblyName));\n            }\n\n            ClientSideProviderDescription[] table = fi.GetValue(null) as ClientSideProviderDescription[];\n            if (table != null)\n            {\n                ClientSettings.RegisterClientSideProviders(table);\n            }\n        } \n        \n        // register specified proxies\n        internal static void RegisterWindowHandlers(ClientSideProviderDescription[] proxyInfo)\n        {","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/MS/Internal/Automation/ProxyManager.cs#L46-L82","documentation":"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.","triggerScenarios":"Registering a proxy assembly that lacks a public type named '<assembly root namespace>.UIAutomationClientSideProviders' — the default name derived from assemblyName.Name + \".UIAutomationClientSideProviders\".","commonSituations":"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.","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."],"exampleFix":"// before\nnamespace MyCompany.Proxies { class UIAutomationClientSideProviders { ... } } // type not found\n// after\nnamespace MyProxies { public class UIAutomationClientSideProviders { public static ClientSideProviderDescription[] ClientSideProviderDescriptionTable = ...; } }","handlingStrategy":"validation","validationCode":"var asm = Assembly.LoadFrom(proxyDllPath);\nstring expected = asm.GetName().Name + \".UIAutomationClientSideProviders\";\nbool ok = asm.GetType(expected, throwOnError: false) != null;","typeGuard":"static bool HasProviderType(Assembly asm) => asm.GetType(asm.GetName().Name + \".UIAutomationClientSideProviders\", false) != null;","tryCatchPattern":"try { ClientSettings.RegisterClientSideProviders(table); }\ncatch (ProxyAssemblyNotLoadedException ex) { log.Error($\"Invalid proxy assembly layout: {ex.Message}\"); }","preventionTips":["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."],"tags":["uiautomation","proxy","type-resolution"],"backgroundTag":"class-not-found","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-21T21:30:21.729Z"}