cefsharp/CefSharp · error · PlatformNotSupportedException

Native access to touch keyboard APIs not supported on this O

Error message

Native access to touch keyboard APIs not supported on this OS!

What it means

Thrown by TouchKeyboardEventManager.GetInputPane() when touchKeyboardSupported is false, i.e. the WinRT InputPane interop factory could not be obtained. The touch keyboard APIs are Win10+ WinRT features; on older Windows (Win7/8/Server) or non-Windows platforms the IInputPaneInterop cast returns null and the manager marks itself unsupported. Calling GetInputPane on such a system is rejected with PlatformNotSupportedException.

Source

Thrown at CefSharp.Wpf.Example/Controls/TouchKeyboard/TouchKeyboardEventManager.cs:72

            touchKeyboardSupported = inputPaneInterop != null;

            if (touchKeyboardSupported)
            {
                // Get the actual input pane for this HWND
                inputPanel = inputPaneInterop.GetForWindow(handle, typeof(IInputPane2).GUID);
            }
        }

        /// <summary>
        /// Returns an instance of the InputPane
        /// </summary>
        /// <returns>The InputPane</returns>
        internal IInputPane2 GetInputPane()
        {
            if (!touchKeyboardSupported)
            {
                throw new PlatformNotSupportedException("Native access to touch keyboard APIs not supported on this OS!");
            }

            return inputPanel;
        }

        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                    if (inputPanel != null)
                    {
                        Marshal.FinalReleaseComObject(inputPanel);

                        inputPanel = null;
                    }

View on GitHub (pinned to 16bc6e0711)

Solutions

  1. Check `Environment.OSVersion` / the manager's supported flag before calling GetInputPane, and degrade gracefully on unsupported OS.
  2. Guard the call site with a try/catch for PlatformNotSupportedException and skip touch-keyboard integration.
  3. Only construct/use TouchKeyboardEventManager on Windows 10+ where the InputPane is available.
  4. Verify the Windows SDK target and that the app manifest targets a supported Windows version.

Example fix

// before
var pane = touchKeyboardEventManager.GetInputPane(); // throws on Win7/8

// after
IInputPane2 pane;
try { pane = touchKeyboardEventManager.GetInputPane(); }
catch (PlatformNotSupportedException) { pane = null; /* touch keyboard unavailable */ }
Defensive patterns

Strategy: try-catch

Validate before calling

// Check OS support before relying on touch keyboard.
if (Environment.OSVersion.Version >= new Version(10, 0))
{
    var pane = touchKeyboardEventManager.GetInputPane();
}

Try / catch

IInputPane2 pane = null;
try { pane = manager.GetInputPane(); }
catch (PlatformNotSupportedException) { /* touch keyboard unavailable on this OS */ }

Prevention

When it happens

Trigger: Instantiating TouchKeyboardEventManager and calling GetInputPane on Windows 7/8/Server Core, in a session without the WinRT InputPane registered, or when the app does not target a Windows SDK that exposes the interop. Also if the constructor's `WindowsRuntimeMarshal.GetActivationFactory` returned null for the InputPane type.

Common situations: Running the WPF example app on a non-Win10 machine; deploying to a Server Core or LTSC image without touch-optional features; CI/test environments on older Windows.

Related errors


AI-assisted analysis of cefsharp/CefSharp@16bc6e0711 (2026-08-13). Data as JSON: /api/errors/6f4df3ec81605467. Report an issue: GitHub.