{"record":{"id":"907bbc006b9696ce","repo":"stride3d/stride","slug":"the-passthrough-mode-needs-to-be-enabled-at-device-creation","errorCode":null,"errorMessage":"The passthrough mode needs to be enabled at device creation","messagePattern":"The passthrough mode needs to be enabled at device creation","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.VirtualReality/OpenXR/OpenXRHmd.cs","lineNumber":386,"sourceCode":"                CountActionSets = 1,\n                ActionSets = &gameplay_actionset\n            };\n\n            Xr.AttachSessionActionSets(session, &actionset_attach_info).CheckResult();\n\n            // figure out what interaction profile we are using, and determine if it has a touchpad/thumbstick or both\n            handProfileState = new InteractionProfileState()\n            {\n                Type = StructureType.InteractionProfileState,\n                Next = null\n            };\n            Xr.StringToPath(Instance, \"/user/hand/left\", ref leftHandPath);\n        }\n\n        public override IDisposable StartPassthrough()\n        {\n            if (!passthroughRequested)\n                throw new InvalidOperationException(\"The passthrough mode needs to be enabled at device creation\");\n\n            if (!SupportsPassthrough)\n                throw new NotSupportedException(\"The device does not support passthrough mode\");\n\n            if (passthroughExt is null)\n                passthroughExt = new OpenXRExt_FB_Passthrough(Xr, globalSession, Instance);\n\n            if (passthroughExt.Enabled)\n                throw new InvalidOperationException(\"Passthrough already started\");\n\n            passthroughExt.Enabled = true;\n\n            return new AnonymousDisposable(() => passthroughExt.Enabled = false);\n        }\n\n        private void EndNullFrame()\n        {\n            FrameEndInfo frame_end_info = new FrameEndInfo()","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.VirtualReality/OpenXR/OpenXRHmd.cs#L368-L404","documentation":"OpenXRHmd.StartPassthrough() throws this InvalidOperationException when passthrough was never requested at device creation (passthroughRequested is false). Passthrough requires the FB passthrough extension to be initialized during HMD creation, so it cannot be turned on lazily afterwards. The library deliberately fails fast because the extension setup cannot be retrofitted on an already-created OpenXR session.","triggerScenarios":"Calling StartPassthrough() on an OpenXR HMD that was created without enabling/requesting passthrough support in the device-creation settings.","commonSituations":"Adding passthrough to an existing VR app without touching the VR device configuration; toggling passthrough at runtime on a headset that was initialized with passthrough disabled; copying sample code that assumes passthrough was requested up front.","solutions":["Enable passthrough at device creation: set the passthrough request flag in the VR device / OpenXR device description before the HMD is created.","If the device was already created, recreate it with passthrough requested, then call StartPassthrough().","Check SupportsPassthrough first and degrade gracefully when the device cannot do passthrough at all."],"exampleFix":"// before\nvar hmd = game.VRDevice; // created without passthrough\nhmd.StartPassthrough(); // throws InvalidOperationException\n// after\nvar deviceDescription = new VRDeviceDescription { RequestPassthrough = true };\nvar hmd = (OpenXRHmd)game.CreateVRDevice(deviceDescription);\nhmd.StartPassthrough();","handlingStrategy":"validation","validationCode":"if (hmd is OpenXRHmd ox && !ox.SupportsPassthrough) throw new SkipPassthroughException();\n// ensure passthrough was requested at device creation before calling StartPassthrough","typeGuard":"bool CanStartPassthrough(OpenXRHmd hmd) => hmd.SupportsPassthrough;","tryCatchPattern":null,"preventionTips":["Set the passthrough request flag in the VR device description before device creation.","Never call StartPassthrough on an HMD created with passthrough disabled; recreate the device instead."],"tags":["openxr","vr","passthrough","invalid-operation"],"backgroundTag":"feature-not-enabled","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}