Skip to content

Commit e2193e6

Browse files
committed
dispose controller
1 parent cdfeab2 commit e2193e6

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/BrowserHttpHandler.cs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -253,17 +253,20 @@ private static async Task<WasmFetchResponse> CallFetch(HttpRequestMessage reques
253253
view = buffer ??= new byte[65536];
254254
}
255255

256-
try
256+
using (controller)
257257
{
258-
int length = await stream.ReadAsync(view, cancellationToken).ConfigureAwait(true);
259-
using (Buffers.MemoryHandle handle = view.Pin())
258+
try
260259
{
261-
ReadableStreamControllerEnqueueUnsafe(controller, handle, length);
260+
int length = await stream.ReadAsync(view, cancellationToken).ConfigureAwait(true);
261+
using (Buffers.MemoryHandle handle = view.Pin())
262+
{
263+
ReadableStreamControllerEnqueueUnsafe(controller, handle, length);
264+
}
265+
}
266+
catch (Exception ex)
267+
{
268+
BrowserHttpInterop.ReadableStreamControllerError(controller, ex);
262269
}
263-
}
264-
catch (Exception ex)
265-
{
266-
BrowserHttpInterop.ReadableStreamControllerError(controller, ex);
267270
}
268271
};
269272

0 commit comments

Comments
 (0)