{"record":{"id":"94eb8775da7ea828","repo":"dotnet/runtime","slug":"urlsearchparams-is-supported","errorCode":null,"errorMessage":"URLSearchParams is supported","messagePattern":"URLSearchParams is supported","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/mono/browser/runtime/loader/run.ts","lineNumber":182,"sourceCode":"        try {\n            deep_merge_config(monoConfig, {\n                mainAssemblyName\n            });\n            return this;\n        } catch (err) {\n            mono_exit(1, err);\n            throw err;\n        }\n    }\n\n    withApplicationArgumentsFromQuery (): DotnetHostBuilder {\n        try {\n            if (!globalThis.window) {\n                throw new Error(\"Missing window to the query parameters from\");\n            }\n\n            if (typeof globalThis.URLSearchParams == \"undefined\") {\n                throw new Error(\"URLSearchParams is supported\");\n            }\n\n            const params = new URLSearchParams(globalThis.window.location.search);\n            const values = params.getAll(\"arg\");\n            return this.withApplicationArguments(...values);\n        } catch (err) {\n            mono_exit(1, err);\n            throw err;\n        }\n    }\n\n    withApplicationEnvironment (applicationEnvironment?: string): DotnetHostBuilder {\n        try {\n            deep_merge_config(monoConfig, {\n                applicationEnvironment,\n            });\n            return this;\n        } catch (err) {","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/dotnet/runtime/blob/290d5ab72cc1102813fbc0406fb186ceadabc340/src/mono/browser/runtime/loader/run.ts#L164-L200","documentation":"Thrown by HostBuilder.withApplicationArgumentsFromQuery when globalThis.URLSearchParams is undefined. NOTE: the message text ('URLSearchParams is supported') is misleading — it actually indicates URLSearchParams is NOT available in the host. It guards the subsequent use of `new URLSearchParams(window.location.search)`.","triggerScenarios":"Produced when withApplicationArgumentsFromQuery runs (window exists) but globalThis.URLSearchParams is undefined — a very old browser/engine lacking the URLSearchParams constructor.","commonSituations":"Running in an extremely old browser or legacy WebView that predates URLSearchParams; a polyfill gap in a custom host.","solutions":["Upgrade to a modern browser/WebView that provides URLSearchParams.","Polyfill URLSearchParams on globalThis before booting (e.g. the 'url-search-params' polyfill).","Avoid withApplicationArgumentsFromQuery in such environments; use withApplicationArguments(...) with values parsed by your own code."],"exampleFix":"// before: legacy browser lacking URLSearchParams\n// builder.withApplicationArgumentsFromQuery(); // throws\n\n// after: polyfill first, or pass args directly\nimport 'url-search-params-polyfill';\nbuilder.withApplicationArgumentsFromQuery();\n// or:\nbuilder.withApplicationArguments(...myParsedArgs);","handlingStrategy":"validation","validationCode":"if (typeof globalThis.URLSearchParams === 'undefined') {\n  // polyfill or avoid withApplicationArgumentsFromQuery\n}","typeGuard":"function hasURLSearchParams(): boolean {\n  return typeof globalThis !== 'undefined' && typeof globalThis.URLSearchParams !== 'undefined';\n}","tryCatchPattern":null,"preventionTips":["Polyfill URLSearchParams in legacy browsers before boot.","Prefer withApplicationArguments(...) with values you parse yourself in old environments.","Target a modern browser baseline."],"tags":["startup","environment","browser","config"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}