Skip to content

[browser] deprecate setEnvironmentVariable for mono, drop it for coreclr - #126087

Merged
pavelsavara merged 3 commits into
dotnet:mainfrom
pavelsavara:browser_remove_set_env
Mar 26, 2026
Merged

pavelsavara merged 3 commits into
dotnet:mainfrom
pavelsavara:browser_remove_set_env

Conversation

@pavelsavara

Copy link
Copy Markdown
Member

setEnvironmentVariable is injecting env variables into "running process" so to speak.
There is no equivalent on other targets.

Contributes to #120226

@pavelsavara pavelsavara added this to the 11.0.0 milestone Mar 25, 2026
@pavelsavara
pavelsavara requested a review from maraf March 25, 2026 12:53
@pavelsavara pavelsavara self-assigned this Mar 25, 2026
Copilot AI review requested due to automatic review settings March 25, 2026 12:53
@pavelsavara pavelsavara added arch-wasm WebAssembly architecture area-System.Runtime.InteropServices.JavaScript os-browser Browser variant of arch-wasm labels Mar 25, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the setEnvironmentVariable runtime API from the CoreCLR browser (dotnet.js) surface area and deprecates it for the Mono browser runtime, steering callers toward host-builder-based environment configuration.

Changes:

  • Removed setEnvironmentVariable from the CoreCLR-facing JS/TS public API (RunAPIType) and generated .d.ts.
  • Removed the (unimplemented) setEnvironmentVariable stub and wiring from System.Native.Browser browser utils.
  • Updated the Mono browser runtime types to mark setEnvironmentVariable as deprecated, and adjusted the browser-shutdown sample usage.

Reviewed changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/native/libs/System.Native.Browser/utils/index.ts Stops importing/exposing setEnvironmentVariable via the BrowserUtils RuntimeAPI wiring.
src/native/libs/System.Native.Browser/utils/host.ts Removes the unimplemented setEnvironmentVariable stub from browser utils host helpers.
src/native/libs/Common/JavaScript/types/public-api.ts Drops setEnvironmentVariable from the CoreCLR RunAPIType public surface.
src/native/libs/Common/JavaScript/loader/dotnet.d.ts Updates generated typings to match removal of setEnvironmentVariable in CoreCLR.
src/mono/sample/wasm/browser-shutdown/wwwroot/main.js Removes sample usage of setEnvironmentVariable and related click handler.
src/mono/browser/runtime/types/index.ts Deprecates setEnvironmentVariable in Mono RunAPIType docs in favor of withEnvironmentVariable().
src/mono/browser/runtime/dotnet.d.ts Mirrors Mono deprecation in the .d.ts documentation.

Copilot AI review requested due to automatic review settings March 25, 2026 20:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 8 changed files in this pull request and generated no new comments.

@pavelsavara

Copy link
Copy Markdown
Member Author

/ba-g unrelated infra issues

@pavelsavara
pavelsavara merged commit 2bc2996 into dotnet:main Mar 26, 2026
129 of 138 checks passed
@pavelsavara
pavelsavara deleted the browser_remove_set_env branch March 26, 2026 08:35
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-wasm WebAssembly architecture area-System.Runtime.InteropServices.JavaScript os-browser Browser variant of arch-wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants