dotnet/wpf · error · ProxyAssemblyNotLoadedException

new ProxyAssemblyNotLoadedException(description)

Error message

new ProxyAssemblyNotLoadedException(description)

What it means

UiaCoreApi throws ProxyAssemblyNotLoadedException when the native core returns UIA_E_PROXYASSEMBLYNOTLOADED, indicating a UIA proxy (provider-side) assembly could not be loaded for a legacy/custom control. The error description is obtained from UiaGetErrorDescription. This typically signals a provider/proxy registration problem, not a client logic bug.

Solutions

  1. Verify the target control's UIA proxy registration and that the UIA proxy assemblies (e.g. UIAutomationCore proxy components) are intact; repair the .NET Framework/SDK install
  2. Check bitness: run the client process with the same architecture the proxies are registered for
  3. If you own the control, implement a proper UIA provider instead of relying on proxies
  4. Catch ProxyAssemblyNotLoadedException and degrade gracefully or surface a clear diagnostic to the user

Example fix

// before
var item = listElement.FindFirst(...); // may throw ProxyAssemblyNotLoadedException
// after
try { var item = listElement.FindFirst(...); }
catch (ProxyAssemblyNotLoadedException ex)
{
    log.Error($"UIA proxy not loaded: {ex.Message}");
    RepairProxyRegistration();
}
Defensive patterns

Strategy: try-catch

Try / catch

try { /* UIA operation */ }
catch (ProxyAssemblyNotLoadedException ex) { log.Error(ex.Message); RepairProxyRegistration(); }

Prevention

When it happens

Trigger: Any wrapped native UIA call whose HRESULT is UIA_E_PROXYASSEMBLYNOTLOADED (0x80040203), usually when UIA attempts to use a Win32 proxy for a non-UIA control and the proxy assembly (UIAutomationClient-side proxies) fails to load.

Common situations: Automating legacy Win32/custom controls whose proxy registration is broken; corrupted or partially installed .NET/Windows SDK proxy assemblies; x86/x64 mismatch where the proxy assembly cannot be loaded into the process.

Related errors


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

Appendix: source

Thrown at src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/MS/Internal/Automation/UiaCoreApi.cs:1197

            || hr == UIA_E_PROXYASSEMBLYNOTLOADED)
            {
                string description;
                if (!UiaGetErrorDescription(out description))
                    description = SR.UnknownCoreAPIError;

                switch (hr)
                {
                    case UIA_E_ELEMENTNOTENABLED:
                        throw new ElementNotEnabledException(description);

                    case UIA_E_ELEMENTNOTAVAILABLE:
                        throw new ElementNotAvailableException(description);

                    case UIA_E_NOCLICKABLEPOINT:
                        throw new NoClickablePointException(description);

                    case UIA_E_PROXYASSEMBLYNOTLOADED:
                        throw new ProxyAssemblyNotLoadedException(description);
                }
            }

            // Not a UIA-specific exception - let COM Interop handle the rest.
            // (Marshal.ThrowExceptionForHR automatically calls GetErrorInfo to fill in the description
            // field - UIA sets the error info itself, so it will get propogated here.)
            Marshal.ThrowExceptionForHR(hr);
        }

        #endregion Private Methods

        #region Raw API methods

        //
        // Client-side methods...
        //

        [DllImport(DllImport.UIAutomationCore, EntryPoint = "UiaGetPropertyValue", CharSet = CharSet.Unicode)]

View on GitHub (pinned to 81131a70a4)