Use Trace flushing with the original Debug compile gate

Proprietary

Opt-in port of bound parameterless Debug.Flush calls, whose modern implementation is empty. A private Conditional(DEBUG) helper invokes the real Trace.Flush entry point through MethodInfo.CreateDelegate, bypassing Trace's different TRACE call-site gate while retaining the caller's DEBUG condition. Adopt per-flush reflection/delegate creation and an additional helper frame. Do not change output methods, settings, compile symbols or Framework CAS policy. Leave other overloads/owners, discarded selector comments, lambda/query bodies, partial/generic owners and snapshots unchanged. Not composed into version upgrades; reflection deployment/trimming policy requires application review.

OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net3_0.UseTraceForLegacyDebugFlush
mod run . --recipe=OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net3_0.UseTraceForLegacyDebugFlush

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.