{"record":{"id":"6f4df3ec81605467","repo":"cefsharp/CefSharp","slug":"native-access-to-touch-keyboard-apis-not-supported","errorCode":null,"errorMessage":"Native access to touch keyboard APIs not supported on this OS!","messagePattern":"Native access to touch keyboard APIs not supported on this OS!","errorType":"exception","errorClass":"PlatformNotSupportedException","httpStatus":null,"severity":"error","filePath":"CefSharp.Wpf.Example/Controls/TouchKeyboard/TouchKeyboardEventManager.cs","lineNumber":72,"sourceCode":"\n            touchKeyboardSupported = inputPaneInterop != null;\n\n            if (touchKeyboardSupported)\n            {\n                // Get the actual input pane for this HWND\n                inputPanel = inputPaneInterop.GetForWindow(handle, typeof(IInputPane2).GUID);\n            }\n        }\n\n        /// <summary>\n        /// Returns an instance of the InputPane\n        /// </summary>\n        /// <returns>The InputPane</returns>\n        internal IInputPane2 GetInputPane()\n        {\n            if (!touchKeyboardSupported)\n            {\n                throw new PlatformNotSupportedException(\"Native access to touch keyboard APIs not supported on this OS!\");\n            }\n\n            return inputPanel;\n        }\n\n        protected virtual void Dispose(bool disposing)\n        {\n            if (!disposed)\n            {\n                if (disposing)\n                {\n                    if (inputPanel != null)\n                    {\n                        Marshal.FinalReleaseComObject(inputPanel);\n\n                        inputPanel = null;\n                    }\n","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/cefsharp/CefSharp/blob/16bc6e0711a4945be17e8bc4bc7ccf9469f3fdec/CefSharp.Wpf.Example/Controls/TouchKeyboard/TouchKeyboardEventManager.cs#L54-L90","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check `Environment.OSVersion` / the manager's supported flag before calling GetInputPane, and degrade gracefully on unsupported OS.","Guard the call site with a try/catch for PlatformNotSupportedException and skip touch-keyboard integration.","Only construct/use TouchKeyboardEventManager on Windows 10+ where the InputPane is available.","Verify the Windows SDK target and that the app manifest targets a supported Windows version."],"exampleFix":"// before\nvar pane = touchKeyboardEventManager.GetInputPane(); // throws on Win7/8\n\n// after\nIInputPane2 pane;\ntry { pane = touchKeyboardEventManager.GetInputPane(); }\ncatch (PlatformNotSupportedException) { pane = null; /* touch keyboard unavailable */ }","handlingStrategy":"try-catch","validationCode":"// Check OS support before relying on touch keyboard.\nif (Environment.OSVersion.Version >= new Version(10, 0))\n{\n    var pane = touchKeyboardEventManager.GetInputPane();\n}","typeGuard":null,"tryCatchPattern":"IInputPane2 pane = null;\ntry { pane = manager.GetInputPane(); }\ncatch (PlatformNotSupportedException) { /* touch keyboard unavailable on this OS */ }","preventionTips":["Only construct TouchKeyboardEventManager on Windows 10+.","Guard GetInputPane with PlatformNotSupportedException handling.","Degrade gracefully (skip touch keyboard) on unsupported OS images."],"tags":["cefwsharp","wpf","platform","touchkeyboard","windows"],"backgroundTag":null,"analyzedSha":"16bc6e0711a4945be17e8bc4bc7ccf9469f3fdec","analyzedAt":"2026-08-13T19:57:05.828Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}