Skip to content

Commit 5a0a7aa

Browse files
benaadamshalter73
authored andcommitted
Capture Edi at Abort not throw (#11875)
1 parent e6a4d9f commit 5a0a7aa

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Servers/Kestrel/Core/src/Internal/Http/HttpRequestPipeReader.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal sealed class HttpRequestPipeReader : PipeReader
1717
{
1818
private MessageBody _body;
1919
private HttpStreamState _state;
20-
private Exception _error;
20+
private ExceptionDispatchInfo _error;
2121

2222
public HttpRequestPipeReader()
2323
{
@@ -92,7 +92,10 @@ public void Abort(Exception error = null)
9292
if (_state != HttpStreamState.Closed)
9393
{
9494
_state = HttpStreamState.Aborted;
95-
_error = error;
95+
if (error != null)
96+
{
97+
_error = ExceptionDispatchInfo.Capture(error);
98+
}
9699
}
97100
}
98101

@@ -112,7 +115,7 @@ private void ValidateState(CancellationToken cancellationToken = default)
112115
{
113116
if (_error != null)
114117
{
115-
ExceptionDispatchInfo.Capture(_error).Throw();
118+
_error.Throw();
116119
}
117120
else
118121
{

0 commit comments

Comments
 (0)