Skip to content

ServerGarbageCollection is not honored in SDK project and TargetFramework net47 #2896

@Tornhoof

Description

@Tornhoof

The setting server garbage collection in the new SDK project format is not honored for TargetFramework net47, it works for netcoreapp 2.0

<ServerGarbageCollection>true</ServerGarbageCollection>

Steps to repreoduce

  1. Create Console project
  2. TargetFramework net47
  3. Change project format to new format
  4. Add setting from above to property group
  5. Put in the main method:
var latencyMode = System.Runtime.GCSettings.LatencyMode;
var isServerGC = System.Runtime.GCSettings.IsServerGC;
Console.WriteLine($"Server: {isServerGC}, Mode: {latencyMode}");

Expected result

  1. Output: Server: True, Mode: Interactive

Actual result

  1. Output is: Server: False, Mode: Interactive

Note: if you multi target the project with <TargetFrameworks>net47;netcoreapp2.0</TargetFrameworks
you can see that the setting is properly used in .net core 2.0

This bug is kinda annoying since it means my Web App for ASP.NET Core 2.0 on .NET 4.7 is running on workstation GC and not on server background gc as it's usually done.

All my attempts to set complus_gcServer=true didn't make any difference.

Repro:
ServerGcRepro.zip

For reference:

.NET-Befehlszeilentools (2.0.2)

Product Information:
 Version:            2.0.2
 Commit SHA-1 hash:  a04b4bf512

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.14393
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.0.2\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0
  Build    : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

VS version is VS 2017 15.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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