Skip to content

GCSettings not being honored #92458

@TVAUGHN2

Description

@TVAUGHN2

Description

Looks like the issue from #84198 is reintroduced. Verified by outputting GC configs the same way as mentioned in that ticket.

My generated runtime config:

{
  "runtimeOptions": {
    "tfm": "net7.0",
    "frameworks": [
      {
        "name": "Microsoft.NETCore.App",
        "version": "7.0.0"
      },
      {
        "name": "Microsoft.AspNetCore.App",
        "version": "7.0.0"
      }
    ],
    "configProperties": {
      "System.GC.HighMemoryPercent": 75,
      "System.GC.Server": true,
      "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
    }
  }
}

Output generated:

ServerGC:False
ConcurrentGC:True
RetainVM:False
NoAffinitize:False
GCCpuGroup:False
GCLargePages:False
HeapCount:1
GCHeapAffinitizeMask:0
GCHeapAffinitizeRanges:
GCHighMemPercent:0
GCHeapHardLimit:0
GCHeapHardLimitPercent:0
GCHeapHardLimitSOH:0
GCHeapHardLimitLOH:0
GCHeapHardLimitPOH:0
GCHeapHardLimitSOHPercent:0
GCHeapHardLimitLOHPercent:0
GCHeapHardLimitPOHPercent:0
GCConserveMem:0

Verified the runtime was being picked up by toggling the System.GC.Server to false.

When I toggled that to false, it was recognized

Output when setting System.GC.Server to false

ServerGC:False
ConcurrentGC:True
RetainVM:False
NoAffinitize:False
GCCpuGroup:False
GCLargePages:False
HeapCount:1
GCHeapAffinitizeMask:0
GCHeapAffinitizeRanges:
GCHighMemPercent:0
GCHeapHardLimit:0
GCHeapHardLimitPercent:0
GCHeapHardLimitSOH:0
GCHeapHardLimitLOH:0
GCHeapHardLimitPOH:0
GCHeapHardLimitSOHPercent:0
GCHeapHardLimitLOHPercent:0
GCHeapHardLimitPOHPercent:0
GCConserveMem:0

Reproduction Steps

  1. An app that generates a runtime config with System.GC.Server = true
  2. Add logging a la:
foreach (var kvp in System.GC.GetConfigurationVariables())
{
    System.Console.WriteLine(kvp.Key + ":" + kvp.Value);
}
  1. Create a runtimeconfig.template.json file setting System.GC.HighMemoryPercent = 75
  2. Run dotnet build and check the runtimeconfig.json file (it should have the variable)
  3. Run the app and check the output results

Expected behavior

Expect the config value to be honored

Actual behavior

Config value is not being honored

Regression?

Not certain, the related fi from before was here: #84201

But not certain what version was before that fix to text

Known Workarounds

No response

Configuration

My sdk:
7.0.401 [/usr/local/share/dotnet/x64/sdk]

My runtime:
Microsoft.NETCore.App 7.0.11 [/usr/local/share/dotnet/x64/shared/Microsoft.NETCore.App]

OS
MacOS Ventura 13.5.1

Architecture
Apple M1 Pro, but running via x64 architecture

Other information

Also verified not working in Linux environment, so if unable to reproduce can grab some more info

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions