We have a .net 6.0 server app and the MS docs don’t give absolute clarity on how to set up our gen 2 garbage collection so it doesn’t suspend all our application threads.
We’ve put this in our .csproj file:
<PropertyGroup>
<ServerGarbageCollection>true</ServerGarbageCollection>
<ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
</PropertyGroup>
We build with dotnet publish -c release -r win-x86 --self-contained false ...
(rather than msbuild
, for info) …
But it doesn’t seem to have any effect – we still get suspended threads periodically that correspond to GC.
The docs suggest setting an environment variable and also a runtime json file setting, but just wondering if anybody has the gospel, proven word on how to implement this in .net 6.0 (or upwards)?