Use Task.Run with capture for AsyncCallback APM calls
ProprietaryOpt-in port of ignored bound AsyncCallback.BeginInvoke(result,null,null) statements. The attested BCL signature permits by-value IAsyncResult capture without a source delegate declaration. A typed private void helper preserves receiver/result evaluation order and immediate receiver/argument/null failures, then schedules Task.Run with Invoke. Adopt Task scheduling, child-task/unobserved-exception behavior and helper/closure frames. Leave observed results, callbacks/state, named calls, other delegate signatures and shared unsupported contexts unchanged. Separate from custom-delegate recipes and version upgrades; original IAsyncResult state/completion ownership remains with the application.
OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net3_0. UseTaskRunForCapturedAsyncCallbackBeginInvokemod run . --recipe= OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net3_0. UseTaskRunForCapturedAsyncCallbackBeginInvokeInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.