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

Stream Cancel doesn't work with Grpc.Net.Client.Web #1726

Closed
HausBJB opened this issue May 6, 2022 · 4 comments
Closed

Stream Cancel doesn't work with Grpc.Net.Client.Web #1726

HausBJB opened this issue May 6, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@HausBJB
Copy link

HausBJB commented May 6, 2022

Hello, I have the problem that if I want to cancel the ResponseStream with a CancellationTokenSource.Token, an exception occurs.

What version of gRPC and what language are you using?

2.45.0

What operating system (Linux, Windows,...) and version?

Android & Windows

What runtime / compiler are you using (e.g. .NET Core SDK version dotnet --info)

OS Name: Windows
OS Version: 10.0.22000
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.300-preview.22204.3\

Host (useful for support):
Version: 6.0.4
Commit: be98e88c76

.NET SDKs installed:
6.0.202 [C:\Program Files\dotnet\sdk]
6.0.300-preview.22204.3 [C:\Program Files\dotnet\sdk]

What did you do?

I have an ASP core server that has full code

public override Task GetReadStream(WriteData request, IServerStreamWriter<StateResponse> responseStream, ServerCallContext context)
        {
                while (!context.CancellationToken.IsCancellationRequested)
                {
                    await Task.Delay(1000);
                }

                StopReadMessageFromClient();

            return ResponseStreamTask;
        }

Then I have a NET MAUI application that has complete code

DataReadStream = dataClient.GetReadStream(new WriteData(), headers);
await foreach (StateResponse data in DataReadStream.ResponseStream.ReadAllAsync(StreamCancellationTokenSource.Token))
                        {
                            //TODO
                        }

If I now want to cancel the stream on the client (NET MAUI) side, I do the following

StreamCancellationTokenSource?.Cancel();

So and here comes the difference I use the Grpc.Net.Client.Web because unfortunately Android only supports that then there is an error.
If I use the Grpc.Net.Client with Windows Application it works as desired

What did you expect to see?

It would be nice if both worked the same way

What did you see instead?

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

[DOTNET] System.AggregateException: One or more errors occurred. (Unbalanced enter/exit)
[DOTNET]  ---> Java.Lang.IllegalStateException: Unbalanced enter/exit
[DOTNET]    at Java.Interop.JniEnvironment.InstanceMethods.CallVoidMethod(JniObjectReference instance, JniMethodInfo method, JniArgumentValue* args) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniEnvironment.g.cs:line 11884
[DOTNET]    at Java.Interop.JniPeerMembers.JniInstanceMethods.InvokeVirtualVoidMethod(String encodedMember, IJavaPeerable self, JniArgumentValue* parameters) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods_Invoke.cs:line 29
[DOTNET]    at Java.IO.InputStream.Close() in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net6.0/android-32/mcw/Java.IO.InputStream.cs:line 106
[DOTNET]    at Android.Runtime.InputStreamInvoker.Close() in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/InputStreamInvoker.cs:line 62
[DOTNET]    at System.IO.Stream.Dispose()
[DOTNET]    at System.IO.BufferedStream.Dispose(Boolean disposing)
[DOTNET]    at System.IO.Stream.Close()
[DOTNET]    at System.IO.Stream.Dispose()
[DOTNET]    at System.Net.Http.StreamContent.Dispose(Boolean disposing)
[DOTNET]    at System.Net.Http.HttpContent.Dispose()
[DOTNET]    at Grpc.Net.Client.Web.Internal.GrpcWebResponseContent.Dispose(Boolean disposing) in /_/src/Grpc.Net.Client.Web/Internal/GrpcWebResponseContent.cs:line 86
[DOTNET]    at System.Net.Http.HttpContent.Dispose()
[DOTNET]    at System.Net.Http.HttpResponseMessage.Dispose(Boolean disposing)
[DOTNET]    at Xamarin.Android.Net.AndroidHttpResponseMessage.Dispose(Boolean disposing) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Xamarin.Android.Net/AndroidHttpResponseMessage.cs:line 55
[DOTNET]    at System.Net.Http.HttpResponseMessage.Dispose()
[DOTNET]    at Grpc.Net.Client.Internal.GrpcCall`2[[GRPCMagicalSmartHomeServices.WriteData, MagicalSmartHome.gRPC.proto, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[GRPCMagicalSmartHomeServices.StateResponse, MagicalSmartHome.gRPC.proto, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].CancelCall(Status status) in /_/src/Grpc.Net.Client/Internal/GrpcCall.cs:line 429
[DOTNET]    at Grpc.Net.Client.Internal.GrpcCall`2[[GRPCMagicalSmartHomeServices.WriteData, MagicalSmartHome.gRPC.proto, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[GRPCMagicalSmartHomeServices.StateResponse, MagicalSmartHome.gRPC.proto, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].CancelCallFromCancellationToken() in /_/src/Grpc.Net.Client/Internal/GrpcCall.cs:line 402
[DOTNET]    at Grpc.Net.Client.Internal.GrpcCall`2.<>c[[GRPCMagicalSmartHomeServices.WriteData, MagicalSmartHome.gRPC.proto, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[GRPCMagicalSmartHomeServices.StateResponse, MagicalSmartHome.gRPC.proto, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].<TryRegisterCancellation>b__69_0(Object state) in /_/src/Grpc.Net.Client/Internal/GrpcCall.cs:line 389
[DOTNET]    at System.Threading.CancellationTokenSource.Invoke(Delegate d, Object state, CancellationTokenSource source)
[DOTNET]    at System.Threading.CancellationTokenSource.CallbackNode.<>c.<ExecuteCallback>b__9_0(Object s)
[DOTNET]    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
[DOTNET] --- End of stack trace from previous location ---
[DOTNET]    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
[DOTNET]    at System.Threading.CancellationTokenSource.CallbackNode.ExecuteCallback()
[DOTNET]    at System.Threading.CancellationTokenSource.ExecuteCallbackHandlers(Boolean throwOnFirstException)
[DOTNET]   --- End of managed Java.Lang.IllegalStateException stack trace ---
[DOTNET] java.lang.IllegalStateException: Unbalanced enter/exit
[DOTNET] 	at com.android.okhttp.okio.AsyncTimeout.enter(AsyncTimeout.java:64)
[DOTNET] 	at com.android.okhttp.okio.AsyncTimeout$2.read(AsyncTimeout.java:211)
[DOTNET] 	at com.android.okhttp.okio.RealBufferedSource.indexOf(RealBufferedSource.java:307)
[DOTNET] 	at com.android.okhttp.okio.RealBufferedSource.indexOf(RealBufferedSource.java:301)
[DOTNET] 	at com.android.okhttp.okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:197)
[DOTNET] 	at com.android.okhttp.internal.http.Http1xStream$ChunkedSource.readChunkSize(Http1xStream.java:453)
[DOTNET] 	at com.android.okhttp.internal.http.Http1xStream$ChunkedSource.read(Http1xStream.java:437)
[DOTNET] 	at com.android.okhttp.internal.Util.skipAll(Util.java:165)
[DOTNET] 	at com.android.okhttp.internal.Util.discard(Util.java:147)
[DOTNET] 	at com.android.okhttp.internal.http.Http1xStream$ChunkedSource.close(Http1xStream.java:474)
[DOTNET] 	at com.android.okhttp.okio.RealBufferedSource.close(RealBufferedSource.java:397)
[DOTNET] 	at com.android.okhttp.okio.RealBufferedSource$1.close(RealBufferedSource.java:385)
[DOTNET] 	at crc64338477404e88479c.InnerGestureListener.n_onSingleTapUp(Native Method)
[DOTNET] 	at crc64338477404e88479c.InnerGestureListener.onSingleTapUp(InnerGestureListener.java:79)
[DOTNET] 	at android.view.GestureDetector.onTouchEvent(GestureDetector.java:748)
[DOTNET] 	at mono.android.view.View_OnTouchListenerImplementor.n_onTouch(Native Method)
[DOTNET] 	at mono.android.view.View_OnTouchListenerImplementor.onTouch(View_OnTouchListenerImplementor.java:30)
[DOTNET] 	at android.view.View.dispatchTouchEvent(View.java:14536)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3114)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2787)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at crc6452ffdc5b34af3a0f.LayoutViewGroup.n_dispatchTouchEvent(Native Method)
[DOTNET] 	at crc6452ffdc5b34af3a0f.LayoutViewGroup.dispatchTouchEvent(LayoutViewGroup.java:56)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at crc6452ffdc5b34af3a0f.LayoutViewGroup.n_dispatchTouchEvent(Native Method)
[DOTNET] 	at crc6452ffdc5b34af3a0f.LayoutViewGroup.dispatchTouchEvent(LayoutViewGroup.java:56)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at crc6452ffdc5b34af3a0f.WrapperView.n_dispatchTouchEvent(Native Method)
[DOTNET] 	at crc6452ffdc5b34af3a0f.WrapperView.dispatchTouchEvent(WrapperView.java:98)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at crc6452ffdc5b34af3a0f.LayoutViewGroup.n_dispatchTouchEvent(Native Method)
[DOTNET] 	at crc6452ffdc5b34af3a0f.LayoutViewGroup.dispatchTouchEvent(LayoutViewGroup.java:56)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at crc6452ffdc5b34af3a0f.LayoutViewGroup.n_dispatchTouchEvent(Native Method)
[DOTNET] 	at crc6452ffdc5b34af3a0f.LayoutViewGroup.dispatchTouchEvent(LayoutViewGroup.java:56)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at crc6452ffdc5b34af3a0f.LayoutViewGroup.n_dispatchTouchEvent(Native Method)
[DOTNET] 	at crc6452ffdc5b34af3a0f.LayoutViewGroup.dispatchTouchEvent(LayoutViewGroup.java:56)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:502)
[DOTNET] 	at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1890)
[DOTNET] 	at android.app.Activity.dispatchTouchEvent(Activity.java:4196)
[DOTNET] 	at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69)
[DOTNET] 	at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:460)
[DOTNET] 	at android.view.View.dispatchPointerEvent(View.java:14799)
[DOTNET] 	at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:6347)
[DOTNET] 	at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6148)
[DOTNET] 	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5626)
[DOTNET] 	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5683)
[DOTNET] 	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5649)
[DOTNET] 	at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5814)
[DOTNET] 	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5657)
[DOTNET] 	at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5871)
[DOTNET] 	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5630)
[DOTNET] 	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5683)
[DOTNET] 	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5649)
[DOTNET] 	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5657)
[DOTNET] 	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5630)
[DOTNET] 	at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:8562)
[DOTNET] 	at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:8513)
[DOTNET] 	at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:8482)
[DOTNET] 	at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:8685)
[DOTNET] 	at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:259)
[DOTNET] 	at android.os.MessageQueue.nativePollOnce(Native Method)
[DOTNET] 	at android.os.MessageQueue.next(MessageQueue.java:335)
[DOTNET] 	at android.os.Looper.loopOnce(Looper.java:161)
[DOTNET] 	at android.os.Looper.loop(Looper.java:288)
[DOTNET] 	at android.app.ActivityThread.main(ActivityThread.java:7839)
[DOTNET] 	at java.lang.reflect.Method.invoke(Native Method)
[DOTNET] 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
[DOTNET] 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
[DOTNET]   --- End of managed Java.Lang.IllegalStateException stack trace ---
[DOTNET] java.lang.IllegalStateException: Unbalanced enter/exit
[DOTNET] 	at com.android.okhttp.okio.AsyncTimeout.enter(AsyncTimeout.java:64)
[DOTNET] 	at com.android.okhttp.okio.AsyncTimeout$2.read(AsyncTimeout.java:211)
[DOTNET] 	at com.android.okhttp.okio.RealBufferedSource.indexOf(RealBufferedSource.java:307)
[DOTNET] 	at com.android.okhttp.okio.RealBufferedSource.indexOf(RealBufferedSource.java:301)
[DOTNET] 	at com.android.okhttp.okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:197)
[DOTNET] 	at com.android.okhttp.internal.http.Http1xStream$ChunkedSource.readChunkSize(Http1xStream.java:453)
[DOTNET] 	at com.android.okhttp.internal.http.Http1xStream$ChunkedSource.read(Http1xStream.java:437)
[DOTNET] 	at com.android.okhttp.internal.Util.skipAll(Util.java:165)
[DOTNET] 	at com.android.okhttp.internal.Util.discard(Util.java:147)
[DOTNET] 	at com.android.okhttp.internal.http.Http1xStream$ChunkedSource.close(Http1xStream.java:474)
[DOTNET] 	at com.android.okhttp.okio.RealBufferedSource.close(RealBufferedSource.java:397)
[DOTNET] 	at com.android.okhttp.okio.RealBufferedSource$1.close(RealBufferedSource.java:385)
[DOTNET] 	at crc64338477404e88479c.InnerGestureListener.n_onSingleTapUp(Native Method)
[DOTNET] 	at crc64338477404e88479c.InnerGestureListener.onSingleTapUp(InnerGestureListener.java:79)
[DOTNET] 	at android.view.GestureDetector.onTouchEvent(GestureDetector.java:748)
[DOTNET] 	at mono.android.view.View_OnTouchListenerImplementor.n_onTouch(Native Method)
[DOTNET] 	at mono.android.view.View_OnTouchListenerImplementor.onTouch(View_OnTouchListenerImplementor.java:30)
[DOTNET] 	at android.view.View.dispatchTouchEvent(View.java:14536)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3114)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2787)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at crc6452ffdc5b34af3a0f.LayoutViewGroup.n_dispatchTouchEvent(Native Method)
[DOTNET] 	at crc6452ffdc5b34af3a0f.LayoutViewGroup.dispatchTouchEvent(LayoutViewGroup.java:56)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at crc6452ffdc5b34af3a0f.LayoutViewGroup.n_dispatchTouchEvent(Native Method)
[DOTNET] 	at crc6452ffdc5b34af3a0f.LayoutViewGroup.dispatchTouchEvent(LayoutViewGroup.java:56)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at crc6452ffdc5b34af3a0f.WrapperView.n_dispatchTouchEvent(Native Method)
[DOTNET] 	at crc6452ffdc5b34af3a0f.WrapperView.dispatchTouchEvent(WrapperView.java:98)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at crc6452ffdc5b34af3a0f.LayoutViewGroup.n_dispatchTouchEvent(Native Method)
[DOTNET] 	at crc6452ffdc5b34af3a0f.LayoutViewGroup.dispatchTouchEvent(LayoutViewGroup.java:56)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at crc6452ffdc5b34af3a0f.LayoutViewGroup.n_dispatchTouchEvent(Native Method)
[DOTNET] 	at crc6452ffdc5b34af3a0f.LayoutViewGroup.dispatchTouchEvent(LayoutViewGroup.java:56)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at crc6452ffdc5b34af3a0f.LayoutViewGroup.n_dispatchTouchEvent(Native Method)
[DOTNET] 	at crc6452ffdc5b34af3a0f.LayoutViewGroup.dispatchTouchEvent(LayoutViewGroup.java:56)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3120)
[DOTNET] 	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2801)
[DOTNET] 	at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:502)
[DOTNET] 	at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1890)
[DOTNET] 	at android.app.Activity.dispatchTouchEvent(Activity.java:4196)
[DOTNET] 	at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69)
[DOTNET] 	at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:460)
[DOTNET] 	at android.view.View.dispatchPointerEvent(View.java:14799)
[DOTNET] 	at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:6347)
[DOTNET] 	at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6148)
[DOTNET] 	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5626)
[DOTNET] 	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5683)
[DOTNET] 	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5649)
[DOTNET] 	at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5814)
[DOTNET] 	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5657)
[DOTNET] 	at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5871)
[DOTNET] 	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5630)
[DOTNET] 	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5683)
[DOTNET] 	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5649)
[DOTNET] 	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5657)
[DOTNET] 	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5630)
[DOTNET] 	at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:8562)
[DOTNET] 	at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:8513)
[DOTNET] 	at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:8482)
[DOTNET] 	at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:8685)
[DOTNET] 	at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:259)
[DOTNET] 	at android.os.MessageQueue.nativePollOnce(Native Method)
[DOTNET] 	at android.os.MessageQueue.next(MessageQueue.java:335)
[DOTNET] 	at android.os.Looper.loopOnce(Looper.java:161)
[DOTNET] 	at android.os.Looper.loop(Looper.java:288)
[DOTNET] 	at android.app.ActivityThread.main(ActivityThread.java:7839)
[DOTNET] 	at java.lang.reflect.Method.invoke(Native Method)
[DOTNET] 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
[DOTNET] 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
[DOTNET] 
[DOTNET]    --- End of inner exception stack trace ---
[DOTNET]    at System.Threading.CancellationTokenSource.ExecuteCallbackHandlers(Boolean throwOnFirstException)
[DOTNET]    at System.Threading.CancellationTokenSource.NotifyCancellation(Boolean throwOnFirstException)
[DOTNET]    at System.Threading.CancellationTokenSource.Cancel(Boolean throwOnFirstException)
[DOTNET]    at System.Threading.CancellationTokenSource.Cancel()
[DOTNET]    at MagicalSmartHome.gRPC.Client.Lib.Services.ClientService.DisposeAsync()

Anything else we should know about your project / environment?

@HausBJB HausBJB added the bug Something isn't working label May 6, 2022
@HausBJB
Copy link
Author

HausBJB commented May 6, 2022

IMPORTANT: An exception only occurs if the server has already sent data and you then cancel

@BrennanConroy
Copy link
Contributor

BrennanConroy commented May 10, 2022

Android testing with gRPC isn't well tested yet, we are working on improving this for .NET 7.

You can use standard unary calls instead of streaming for now to workaround this.

@halter73
Copy link

We're using dotnet/runtime#69095 to track better support on mobile platforms. Thanks for the bug report.

@JamesNK
Copy link
Member

JamesNK commented May 18, 2022

Btw, this issue isn't in grpc-dotnet. I've also created an issue in dotnet/runtime to fix it in .NET Android's HttpClient - dotnet/runtime#69464

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants