Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPA proxy to React development server throws #18470

Closed
loic-sharma opened this issue Jan 21, 2020 · 3 comments
Closed

SPA proxy to React development server throws #18470

loic-sharma opened this issue Jan 21, 2020 · 3 comments
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates question

Comments

@loic-sharma
Copy link
Contributor

loic-sharma commented Jan 21, 2020

Describe the bug

After upgrading to ASP.NET Core 3, the SPA Proxy to the React development server throws lots of exceptions:

System.IO.IOException: Unable to read data from the transport connection:
System.IO.IOException
  HResult=0x80131620
  Message=Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request..
  Source=System.Net.Sockets
  StackTrace:
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) in /_/src/System.Net.Sockets/src/System/Net/Sockets/Socket.Tasks.cs:line 1107

Inner Exception 1:
SocketException: The I/O operation has been aborted because of either a thread exit or an application request.

Call stack:

System.Net.Sockets.dll!System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(System.Net.Sockets.SocketError error, System.Threading.CancellationToken cancellationToken) Line 1107	C#
System.Net.Sockets.dll!System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.GetResult(short token) Line 1076	C#
System.Private.CoreLib.dll!System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable<int>.ConfiguredValueTaskAwaiter.GetResult() Line 159	C#
System.Net.Http.dll!System.Net.Http.HttpConnection.ReadBufferedAsyncCore(System.Memory<byte> destination) Line 1584	C#
[Resuming Async Method]	
System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AsyncStateMachineBox<System.Net.Http.HttpConnection.<ReadBufferedAsyncCore>d__93>.ExecutionContextCallback(object s) Line 580	C#
System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Line 172	C#
System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AsyncStateMachineBox<System.Net.Http.HttpConnection.<ReadBufferedAsyncCore>d__93>.MoveNext(System.Threading.Thread threadPoolThread) Line 618	C#
System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AsyncStateMachineBox<System.Net.Http.HttpConnection.<ReadBufferedAsyncCore>d__93>.MoveNext() Line 595	C#
System.Private.CoreLib.dll!System.Threading.ThreadPoolGlobals..cctor.AnonymousMethod__5_0(object state) Line 45	C#
System.Net.Sockets.dll!System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.InvokeContinuation(System.Action<object> continuation, object state, bool forceAsync, bool requiresExecutionContextFlow) Line 1051	C#
System.Net.Sockets.dll!System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.OnCompleted(System.Net.Sockets.SocketAsyncEventArgs _) Line 886	C#
System.Net.Sockets.dll!System.Net.Sockets.SocketAsyncEventArgs.HandleCompletionPortCallbackError(uint errorCode, uint numBytes, System.Threading.NativeOverlapped* nativeOverlapped) Line 1296	C#
System.Net.Sockets.dll!System.Net.Sockets.SocketAsyncEventArgs..cctor.AnonymousMethod__177_0(uint errorCode, uint numBytes, System.Threading.NativeOverlapped* nativeOverlapped) Line 1260	C#
System.Private.CoreLib.dll!System.Threading.ThreadPoolBoundHandleOverlapped.CompletionCallback(uint errorCode, uint numBytes, System.Threading.NativeOverlapped* nativeOverlapped) Line 50	C#
System.Private.CoreLib.dll!System.Threading._IOCompletionCallback.PerformIOCompletionCallback(uint errorCode, uint numBytes, System.Threading.NativeOverlapped* pNativeOverlapped) Line 78	C#
[Async Call Stack]	
[Async] System.Net.Http.dll!System.Net.Http.HttpConnection.RawConnectionStream.ReadAsync(System.Memory<byte> buffer, System.Threading.CancellationToken cancellationToken) Line 65	C#
[Async] System.Net.WebSockets.dll!System.Net.WebSockets.ManagedWebSocket.EnsureBufferContainsAsync(int minimumRequiredBytes, System.Threading.CancellationToken cancellationToken, bool throwOnPrematureClosure) Line 1209	C#
[Async] System.Net.WebSockets.dll!System.Net.WebSockets.ManagedWebSocket.ReceiveAsyncPrivate<System.Net.WebSockets.ManagedWebSocket.WebSocketReceiveResultGetter, System.Net.WebSockets.WebSocketReceiveResult>(System.Memory<byte> payloadBuffer, System.Threading.CancellationToken cancellationToken, System.Net.WebSockets.ManagedWebSocket.WebSocketReceiveResultGetter resultGetter) Line 651	C#
System.Threading.Tasks.TaskCanceledException: The operation was canceled.
System.Threading.Tasks.TaskCanceledException
  HResult=0x8013153B
  Message=The operation was canceled.
  Source=System.Net.Http
  StackTrace:
   at System.Net.Http.HttpConnection.RawConnectionStream.<ReadAsync>d__6.MoveNext() in /_/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/RawConnectionStream.cs:line 69

Inner Exception 1:
IOException: Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request..

Inner Exception 2:
SocketException: The I/O operation has been aborted because of either a thread exit or an application request.

Call stack:

System.Net.Http.dll!System.Net.Http.HttpConnection.RawConnectionStream.ReadAsync(System.Memory<byte> buffer, System.Threading.CancellationToken cancellationToken) Line 69	C#
[Resuming Async Method]	
System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AsyncStateMachineBox<System.Net.Http.HttpConnection.RawConnectionStream.<ReadAsync>d__6>.ExecutionContextCallback(object s) Line 580	C#
System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Line 172	C#
System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AsyncStateMachineBox<System.Net.Http.HttpConnection.RawConnectionStream.<ReadAsync>d__6>.MoveNext(System.Threading.Thread threadPoolThread) Line 618	C#
System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AsyncStateMachineBox<System.Net.Http.HttpConnection.RawConnectionStream.<ReadAsync>d__6>.MoveNext() Line 595	C#
System.Private.CoreLib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__12_0(System.Action innerContinuation, System.Threading.Tasks.Task innerTask) Line 304	C#
System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.ContinuationWrapper.Invoke() Line 1131	C#
System.Private.CoreLib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining) Line 742	C#
System.Private.CoreLib.dll!System.Threading.Tasks.Task.RunContinuations(object continuationObject) Line 3326	C#
System.Private.CoreLib.dll!System.Threading.Tasks.Task.FinishContinuations() Line 3291	C#
System.Private.CoreLib.dll!System.Threading.Tasks.Task.FinishStageThree() Line 2176	C#
System.Private.CoreLib.dll!System.Threading.Tasks.Task.FinishStageTwo() Line 2145	C#
System.Private.CoreLib.dll!System.Threading.Tasks.Task.FinishSlow(bool userDelegateExecute) Line 2076	C#
System.Private.CoreLib.dll!System.Threading.Tasks.Task.TrySetException(object exceptionObject) Line 3226	C#
System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception exception) Line 784	C#
System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder<int>.SetException(System.Exception exception) Line 164	C#
System.Net.Http.dll!System.Net.Http.HttpConnection.ReadBufferedAsyncCore(System.Memory<byte> destination) Line 1592	C#
System.Net.Http.dll!System.Net.Http.HttpConnection.ReadBufferedAsyncCore(System.Memory<byte> destination) Line 1592	C#
[Resuming Async Method]	
System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AsyncStateMachineBox<System.Net.Http.HttpConnection.<ReadBufferedAsyncCore>d__93>.ExecutionContextCallback(object s) Line 580	C#
System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Line 172	C#
System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AsyncStateMachineBox<System.Net.Http.HttpConnection.<ReadBufferedAsyncCore>d__93>.MoveNext(System.Threading.Thread threadPoolThread) Line 618	C#
System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AsyncStateMachineBox<System.Net.Http.HttpConnection.<ReadBufferedAsyncCore>d__93>.MoveNext() Line 595	C#
System.Private.CoreLib.dll!System.Threading.ThreadPoolGlobals..cctor.AnonymousMethod__5_0(object state) Line 45	C#
System.Net.Sockets.dll!System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.InvokeContinuation(System.Action<object> continuation, object state, bool forceAsync, bool requiresExecutionContextFlow) Line 1051	C#
System.Net.Sockets.dll!System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.OnCompleted(System.Net.Sockets.SocketAsyncEventArgs _) Line 886	C#
System.Net.Sockets.dll!System.Net.Sockets.SocketAsyncEventArgs.HandleCompletionPortCallbackError(uint errorCode, uint numBytes, System.Threading.NativeOverlapped* nativeOverlapped) Line 1296	C#
System.Net.Sockets.dll!System.Net.Sockets.SocketAsyncEventArgs..cctor.AnonymousMethod__177_0(uint errorCode, uint numBytes, System.Threading.NativeOverlapped* nativeOverlapped) Line 1260	C#
System.Private.CoreLib.dll!System.Threading.ThreadPoolBoundHandleOverlapped.CompletionCallback(uint errorCode, uint numBytes, System.Threading.NativeOverlapped* nativeOverlapped) Line 50	C#
System.Private.CoreLib.dll!System.Threading._IOCompletionCallback.PerformIOCompletionCallback(uint errorCode, uint numBytes, System.Threading.NativeOverlapped* pNativeOverlapped) Line 78	C#
[Async Call Stack]	
[Async] System.Net.WebSockets.dll!System.Net.WebSockets.ManagedWebSocket.EnsureBufferContainsAsync(int minimumRequiredBytes, System.Threading.CancellationToken cancellationToken, bool throwOnPrematureClosure) Line 1209	C#
[Async] System.Net.WebSockets.dll!System.Net.WebSockets.ManagedWebSocket.ReceiveAsyncPrivate<System.Net.WebSockets.ManagedWebSocket.WebSocketReceiveResultGetter, System.Net.WebSockets.WebSocketReceiveResult>(System.Memory<byte> payloadBuffer, System.Threading.CancellationToken cancellationToken, System.Net.WebSockets.ManagedWebSocket.WebSocketReceiveResultGetter resultGetter) Line 651	C#

I cannot reproduce this issue on ASP.NET Core 2.2.

To Reproduce

  1. Install .NET Core SDK v3.1.101
  2. Run dotnet new react
  3. Open the .csproj file using Visual Studio Enterprise 2019 v16.4.3
  4. Start debugging by pressing F5
  5. Once your browser launches, refresh the page repeatedly
  6. Check Visual Studio. You should see glorious exception spew:

image

Further technical details

ASP.NET Core version: 3.1.1
IDE: VS Enterprise 2019 v16.4.3

Output of `dotnet --info`
.NET Core SDK (reflecting any global.json):
 Version:   3.1.101
 Commit:    b377529961

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.18362
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.1.101\

Host (useful for support):
  Version: 3.1.1
  Commit:  a1388f194c

.NET Core SDKs installed:
  1.0.0-preview4-004233 [C:\Program Files\dotnet\sdk]
  2.1.100 [C:\Program Files\dotnet\sdk]
  2.1.802 [C:\Program Files\dotnet\sdk]
  2.2.402 [C:\Program Files\dotnet\sdk]
  3.0.102 [C:\Program Files\dotnet\sdk]
  3.1.101 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 1.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
@javiercn javiercn added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Jan 21, 2020
@javiercn
Copy link
Member

@loic-sharma thanks for contacting us.

I would think that's expected as you are refreshing the page, that is causing the request to be aborted while in-flight which is typically signaled with an exception and that's likely what you are seeing there.

@loic-sharma
Copy link
Contributor Author

@javiercn Hi, thanks for the prompt reply! It looks like you're correct, but this seems like a regression in ASP.NET Core 3 as this issue does not seem to reproduce on ASP.NET Core 2.2. Repro steps:

  1. Install .NET Core SDK v2.2.401
  2. Run dotnet new react
  3. Open the .csproj file using Visual Studio Enterprise 2019 v16.4.3
  4. Start debugging by pressing F5
  5. Once your browser launches, refresh the page repeatedly
  6. Check Visual Studio. I had no exceptions thrown
Output of `dotnet --info`
.NET Core SDK (reflecting any global.json):
 Version:   2.2.401
 Commit:    729b316c13

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.18362
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.2.401\

Host (useful for support):
  Version: 3.1.0-preview3.19553.2
  Commit:  13f35c3d86

.NET Core SDKs installed:
  2.1.505 [C:\Program Files\dotnet\sdk]
  2.1.602 [C:\Program Files\dotnet\sdk]
  2.1.700-preview-009597 [C:\Program Files\dotnet\sdk]
  2.1.700-preview-009618 [C:\Program Files\dotnet\sdk]
  2.1.800-preview-009711 [C:\Program Files\dotnet\sdk]
  2.1.801 [C:\Program Files\dotnet\sdk]
  2.2.202 [C:\Program Files\dotnet\sdk]
  2.2.300-preview-010046 [C:\Program Files\dotnet\sdk]
  2.2.300-preview-010067 [C:\Program Files\dotnet\sdk]
  2.2.400-preview-010234 [C:\Program Files\dotnet\sdk]
  2.2.401 [C:\Program Files\dotnet\sdk]
  3.0.100 [C:\Program Files\dotnet\sdk]
  3.1.100-preview3-014645 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.0-preview3.19555.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.0-preview3.19553.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.0-preview3.19553.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

@mkArtakMSFT
Copy link
Member

@loic-sharma there's been many internal changes in the framework and first-chance exceptions is not something breaking the experience. These are just traces you can safely ignore.

@ghost ghost locked as resolved and limited conversation to collaborators Feb 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates question
Projects
None yet
Development

No branches or pull requests

3 participants