Closed
Description
Describe the bug
Documentation mentions that user is able to change the default Server garbage collection to Workstation garbage collection via either COMPlus_gcServer
(pre .net6) or DOTNET_gcServer
(in .net6) Environment variable.
It was working (the COMPlus env) in .net5, but after project upgrade to .net6, both methods seems to be doing nothing, gcServer is always set to true.
MSBuild property is still functioning, we can add /p:ServerGarbageCollection=false
to the build parameters and we will achieve exactly that.
The problem seems to be asp.net related, Console application (with default gc set to Workstation) can be overridden by both of those env variables to Server.
To Reproduce
- Create webapi template
dotnet new webapi
in .net6 - Run that project with any of given env variables (COMPlus_gcServer=0 or DOTNET_gcServer=0)
- Check used garbage collection method (ie. print
System.Runtime.GCSettings.IsServerGC
on startup)
Further technical details
- ASP.NET Core version: 6.0
- The IDE: VS Code 1.62.2-1636665017_amd64
dotnet --info Output
NET SDK (reflecting any global.json):
Version: 6.0.100
Commit: 9e8b04bbff
Runtime Environment:
OS Name: ubuntu
OS Version: 20.04
OS Platform: Linux
RID: ubuntu.20.04-x64
Base Path: /usr/share/dotnet/sdk/6.0.100/
Host (useful for support):
Version: 6.0.0
Commit: 4822e3c3aa