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

Commit 2bddf6d

Browse files
committed
Avoid a closure/delegate allocation in WinHttpHandler
One-line change to avoid a closure and delegate allocation on each call.
1 parent 6ea3d21 commit 2bddf6d

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)