|
8 | 8 | using Microsoft.AspNetCore.Connections;
|
9 | 9 | using Microsoft.AspNetCore.Connections.Features;
|
10 | 10 | using Microsoft.AspNetCore.Internal;
|
11 |
| -using Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Internal; |
12 | 11 | using Microsoft.AspNetCore.InternalTesting;
|
| 12 | +using Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Internal; |
13 | 13 | using Microsoft.Extensions.Logging;
|
14 | 14 | using Microsoft.Extensions.Time.Testing;
|
15 | 15 |
|
@@ -280,6 +280,41 @@ public async Task AcceptAsync_ServerStartsAndStopsUnidirectionStream_ClientAccep
|
280 | 280 | Assert.Equal(0, readCount);
|
281 | 281 | }
|
282 | 282 |
|
| 283 | + [Fact] |
| 284 | + public void DoubleCatch() |
| 285 | + { |
| 286 | + try |
| 287 | + { |
| 288 | + Logger.LogInformation("Try"); |
| 289 | + throw new QuicException(QuicError.ConnectionAborted, applicationErrorCode: null, "Message"); |
| 290 | + } |
| 291 | + catch (QuicException ex) when (ex.QuicError == QuicError.ConnectionAborted) |
| 292 | + { |
| 293 | + Logger.LogInformation("ConnectionAborted"); |
| 294 | + throw new Exception("Repro failed"); |
| 295 | + } |
| 296 | + catch (QuicException) |
| 297 | + { |
| 298 | + try |
| 299 | + { |
| 300 | + Assert.Fail("How did we get here?"); |
| 301 | + } |
| 302 | + finally // Required for repro |
| 303 | + { |
| 304 | + Assert.Fail("How did we get here?"); |
| 305 | + } |
| 306 | + } |
| 307 | + catch (Exception) |
| 308 | + { |
| 309 | + Logger.LogInformation("Exception"); |
| 310 | + Assert.Fail("Repro succeeded"); |
| 311 | + } |
| 312 | + finally |
| 313 | + { |
| 314 | + Logger.LogInformation("Finally"); |
| 315 | + } |
| 316 | + } |
| 317 | + |
283 | 318 | [ConditionalFact]
|
284 | 319 | [MsQuicSupported]
|
285 | 320 | public async Task AcceptAsync_ClientClosesConnection_ExceptionThrown()
|
|
0 commit comments