{"record":{"id":"70e4be71a0fe9cf2","repo":"github/copilot-sdk","slug":"copilotclientoptions-telemetry-is-not-supported-wi","errorCode":null,"errorMessage":"CopilotClientOptions.Telemetry is not supported with RuntimeConnection.ForInProcess(): telemetry configuration is lowered to environment variables read by native runtime code running in the shared host process, so per-client telemetry cannot be honored in-process. Configure telemetry via the host process environment, or use a child-process transport.","messagePattern":"CopilotClientOptions\\.Telemetry is not supported with RuntimeConnection\\.ForInProcess\\(\\): telemetry configuration is lowered to environment variables read by native runtime code running in the shared host process, so per-client telemetry cannot be honored in-process\\. Configure telemetry via the host process environment, or use a child-process transport\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Client.cs","lineNumber":242,"sourceCode":"    /// telemetry options that lower to environment variables are rejected there.\n    /// </summary>\n    private static void ValidateEnvironmentOptions(CopilotClientOptions options, RuntimeConnection connection)\n    {\n        if (connection is InProcessRuntimeConnection)\n        {\n            if (options.Environment is not null)\n            {\n                throw new ArgumentException(\n                    $\"{nameof(CopilotClientOptions)}.{nameof(CopilotClientOptions.Environment)} is not supported with \" +\n                    $\"{nameof(RuntimeConnection)}.{nameof(RuntimeConnection.ForInProcess)}(): the in-process transport \" +\n                    \"loads the native runtime into the shared host process, whose single environment block cannot carry \" +\n                    \"per-client values. Set the variables on the host process environment instead.\",\n                    nameof(options));\n            }\n\n            if (options.Telemetry is not null)\n            {\n                throw new ArgumentException(\n                    $\"{nameof(CopilotClientOptions)}.{nameof(CopilotClientOptions.Telemetry)} is not supported with \" +\n                    $\"{nameof(RuntimeConnection)}.{nameof(RuntimeConnection.ForInProcess)}(): telemetry configuration is \" +\n                    \"lowered to environment variables read by native runtime code running in the shared host process, so \" +\n                    \"per-client telemetry cannot be honored in-process. Configure telemetry via the host process \" +\n                    \"environment, or use a child-process transport.\",\n                    nameof(options));\n            }\n\n            if (options.WorkingDirectory is not null)\n            {\n                throw new ArgumentException(\n                    $\"{nameof(CopilotClientOptions)}.{nameof(CopilotClientOptions.WorkingDirectory)} is not supported with \" +\n                    $\"{nameof(RuntimeConnection)}.{nameof(RuntimeConnection.ForInProcess)}(): the in-process transport hosts \" +\n                    \"the native runtime in the shared host process and spawns the worker without a working-directory \" +\n                    \"parameter, so a per-client working directory cannot be honored in-process. Use a child-process \" +\n                    \"transport, or set the process working directory before creating the client.\",\n                    nameof(options));\n            }","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/dotnet/src/Client.cs#L224-L260","documentation":"CopilotClient throws this ArgumentException when CopilotClientOptions.Telemetry is set with RuntimeConnection.ForInProcess(). Telemetry configuration is lowered to environment variables read by the native runtime; in-process that native code runs in the shared host process, so per-client telemetry cannot be honored. The constructor rejects the combination instead of silently misapplying settings.","triggerScenarios":"new CopilotClient(options, RuntimeConnection.ForInProcess()) where options.Telemetry is non-null. Checked by ValidateEnvironmentOptions during CopilotClient construction.","commonSituations":"Reusing the same options object for stdio and in-process connections; copying configuration that included telemetry settings when migrating to in-process transport.","solutions":["Set options.Telemetry to null when using ForInProcess().","Configure telemetry via host process environment variables instead.","Use RuntimeConnection.ForStdio() (child-process transport) if per-client telemetry configuration is required."],"exampleFix":"// before\nvar options = new CopilotClientOptions { Telemetry = new TelemetryOptions { Enabled = true } };\nvar client = new CopilotClient(options, RuntimeConnection.ForInProcess());\n// after\nvar options = new CopilotClientOptions { Telemetry = null };\n// configure telemetry via host env vars instead\nvar client = new CopilotClient(options, RuntimeConnection.ForInProcess());","handlingStrategy":"validation","validationCode":"if (connection is InProcessRuntimeConnection && options.Telemetry is not null)\n    throw new InvalidOperationException(\"Configure telemetry via host process env for in-process transport.\");","typeGuard":"static bool AllowsOptionsTelemetry(RuntimeConnection c) => c is not InProcessRuntimeConnection;","tryCatchPattern":"try { client = new CopilotClient(options, connection); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"Telemetry\")) { options.Telemetry = null; client = new CopilotClient(options, connection); }","preventionTips":["Null out telemetry settings when switching to in-process","Centralize telemetry config in host environment","Document transport restrictions next to options construction"],"tags":["dotnet","configuration","in-process","telemetry"],"backgroundTag":"conflicting-config-options","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}