Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 6db745c

Browse files
committed
Merge pull request #2470 from stephentoub/ctregister_closure_http
Avoid a closure/delegate allocation in WinHttpHandler
2 parents 800e7b7 + 2bddf6d commit 6db745c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,7 @@ private async void StartRequest(object obj)
10921092
return;
10931093
}
10941094

1095-
var cancellationTokenRegistration = state.CancellationToken.Register(() => { state.Tcs.TrySetCanceled(); });
1095+
var cancellationTokenRegistration = state.CancellationToken.Register(s => ((RequestState)s).Tcs.TrySetCanceled(), state);
10961096

10971097
try
10981098
{

0 commit comments

Comments
 (0)