dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.26k stars 4.73k forks source link

Question/request for documentation on .NET WASM runtime env vars #98225

Open guardrex opened 9 months ago

guardrex commented 9 months ago

In documenting runtime environment variable configuration for the .NET WebAssembly runtime in the Blazor documentation ...

Blazor.start({
  webAssembly: {
    configureRuntime: dotnet => {
      dotnet.withEnvironmentVariable("{NAME}", "{VALUE}");
    }
  }
});

... I don't think that a documented list of the relevant environment variables (e.g., MONO_*, DOTNET_*, COMPlus_*) with descriptions exists in the https://github.com/dotnet/runtime/tree/main/docs coverage.

If such coverage doesn't exist in one spot (i.e., I'd like to cross-link to it from the Blazor docs), is it possible to place such coverage? ... or is it possible for one of the engineers to provide me a list with brief descriptions that I can publish in the Blazor docs? Alternatively, I'm left having to tell readers that a list isn't available at this time or say nothing and leave devs searching for such content on their own only to never find it.

guardrex commented 9 months ago

It also occurs to me that if it's decided that no list will ever exist ... for example due to too much churn in the runtime to make it stable enough to publish ... then I don't think we should have the public coverage in the Blazor docs. It seems to me that we'd take the section that we have (and that I'm currently updating on https://github.com/dotnet/AspNetCore.Docs/pull/31747/files) out of the Blazor docs and have the guidance over here in the dotnet/runtime docs.

lambdageek commented 8 months ago

@guardrex while the most obvious use for withEnvironmentVariable is to set variables that affect the runtime, there are also other uses. for example if an app is built with a NativeFileReference in order to include some C library, the environment variable setting could be used to affect the behavior of that C library.

That said, mono envrionment variables were documented in the mono manpage at one point, although we never moved the manpage to the dotnet/runtime repo. I guess ideally we should turn it into some kind of markdown file. /cc @akoeplinger https://github.com/mono/mono/blob/main/man/mono.1

DOTNET_ (aka COMPlus_) environment variables are "documented" in https://github.com/dotnet/runtime/blob/f582c0b66b2b91b626ccce62ea0e37496446e79f/src/coreclr/inc/clrconfigvalues.h

although nearly all of them do not apply to Mono