{"record":{"id":"a6c5f34805a80c28","repo":"dotnet/wpf","slug":"sr-couldnotfindregistermethodontype0inassembly1-formatted","errorCode":null,"errorMessage":"SR.CouldNotFindRegisterMethodOnType0InAssembly1 (formatted with typeName, assemblyName)","messagePattern":"SR\\.CouldNotFindRegisterMethodOnType0InAssembly1 \\(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":70,"sourceCode":"            {\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        {\n            // If a client registers a proxy before the defaults proxies are loaded because of use, \n            // we should load the defaults first.\n            LoadDefaultProxies();\n            \n            lock (_lockObj)\n            {","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/MS/Internal/Automation/ProxyManager.cs#L52-L88","documentation":"RegisterProxyAssembly expects the 'UIAutomationClientSideProviders' type to expose a public static field named ClientSideProviderDescriptionTable of type ClientSideProviderDescription[]. If the field is missing or has the wrong type, it throws ProxyAssemblyNotLoadedException with SR.CouldNotFindRegisterMethodOnType0InAssembly1 (message text notwithstanding, the check is the field lookup).","triggerScenarios":"Registering a proxy assembly whose provider type does not declare: public static ClientSideProviderDescription[] ClientSideProviderDescriptionTable; or declares it with a different element type / as a property or internal field.","commonSituations":"Hand-rolled proxy assemblies that renamed the field, used a property instead of a static public field, or typed the array incorrectly (e.g., object[]); partial copies of sample proxy code.","solutions":["Add the exact field: public static ClientSideProviderDescription[] ClientSideProviderDescriptionTable = new ClientSideProviderDescription[] { ... };","Ensure the field is public and static (BindingFlags.Static | BindingFlags.Public lookup fails for internal/instance members).","Ensure the field type is exactly ClientSideProviderDescription[] (not a derived/base array)."],"exampleFix":"// before\ninternal static object[] ClientSideProviderDescriptionTable = ...;\n// after\npublic static UIAutomationClientSideProviders.ClientSideProviderDescriptionTable =>\n    // actually a field, not a property:\npublic static ClientSideProviderDescription[] ClientSideProviderDescriptionTable =\n    new ClientSideProviderDescription[] { new ClientSideProviderDescription(FactoryCallback, null, \"MyClassName\", ClientSideProviderMatchFlags.None) };","handlingStrategy":"validation","validationCode":"var t = asm.GetType(asm.GetName().Name + \".UIAutomationClientSideProviders\");\nvar f = t?.GetField(\"ClientSideProviderDescriptionTable\", BindingFlags.Public | BindingFlags.Static);\nbool ok = f != null && f.FieldType == typeof(ClientSideProviderDescription[]);","typeGuard":"static bool HasProviderTable(Type t) =>\n  t?.GetField(\"ClientSideProviderDescriptionTable\", BindingFlags.Public | BindingFlags.Static) is FieldInfo fi && fi.FieldType == typeof(ClientSideProviderDescription[]);","tryCatchPattern":"try { ClientSettings.RegisterClientSideProviders(table); }\ncatch (ProxyAssemblyNotLoadedException ex) { log.Error($\"Provider table missing or wrong type: {ex.Message}\"); }","preventionTips":["Declare the field exactly as public static ClientSideProviderDescription[] ClientSideProviderDescriptionTable.","Do not substitute a property, internal field, or different array type.","Validate the provider assembly with reflection in a unit test before shipping."],"tags":["uiautomation","proxy","reflection"],"backgroundTag":"schema-validation-failed","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"}