File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed
src/Servers/Kestrel/Core/test Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,11 @@ public Http1ConnectionTests()
53
53
var connectionFeatures = new FeatureCollection ( ) ;
54
54
connectionFeatures . Set ( Mock . Of < IConnectionLifetimeFeature > ( ) ) ;
55
55
56
- _serviceContext = new TestServiceContext ( ) ;
56
+ _serviceContext = new TestServiceContext ( )
57
+ {
58
+ Scheduler = PipeScheduler . Inline
59
+ } ;
60
+
57
61
_timeoutControl = new Mock < ITimeoutControl > ( ) ;
58
62
_http1ConnectionContext = new HttpConnectionContext
59
63
{
@@ -724,6 +728,27 @@ public async Task RequestAbortedTokenIsResetBeforeLastWriteWithChunkedEncoding()
724
728
Assert . False ( _http1Connection . RequestAborted . IsCancellationRequested ) ;
725
729
}
726
730
731
+ [ Fact ]
732
+ public void RequestAbortedTokenIsUsableAfterCancellation ( )
733
+ {
734
+ var originalToken = _http1Connection . RequestAborted ;
735
+ var originalRegistration = originalToken . Register ( ( ) => { } ) ;
736
+
737
+ _http1Connection . Abort ( new ConnectionAbortedException ( ) ) ;
738
+
739
+ // The following line will throw an ODE because the original CTS backing the token has been diposed.
740
+ // See https://github.com/aspnet/AspNetCore/pull/4447 for the history behind this test.
741
+ //Assert.True(originalToken.WaitHandle.WaitOne(TestConstants.DefaultTimeout));
742
+ Assert . True ( _http1Connection . RequestAborted . WaitHandle . WaitOne ( TestConstants . DefaultTimeout ) ) ;
743
+
744
+ #if NETCOREAPP2_2
745
+ Assert . Equal ( originalToken , originalRegistration . Token ) ;
746
+ #elif NET461
747
+ #else
748
+ #error Target framework needs to be updated
749
+ #endif
750
+ }
751
+
727
752
[ Fact ]
728
753
public async Task ExceptionDetailNotIncludedWhenLogLevelInformationNotEnabled ( )
729
754
{
You can’t perform that action at this time.
0 commit comments