GC.Collect is called explicitly
What it finds
The garbage collector tunes itself to the program's allocations; a forced collection interrupts all threads and promotes live objects, which usually makes later collections slower. Code that needs it, such as benchmarks and memory tests, says so in a suppression.
From the rule's source, gc_collect.rs.
using System; class Memory{ void Free() { GC.Collect();tx0 reports: a garbage collection is forced here GC.KeepAlive(this); }} Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/csharp:gc-collect" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/csharp:gc-collect] reason="..."tx0 explain tx0/csharp:gc-collect shows the same in the terminal. Found a false positive? Report it.