-
Notifications
You must be signed in to change notification settings - Fork 773
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
NotSupportedException: 'Cancellation of stream writes is not supported by this gRPC implementation.' #1747
Comments
Grpc.Core doesn't support |
That means the cancellation token would silently be ignored which isn't good. |
IAsyncStreamWriter.WriteAsync(CancellationToken) is defined in Grpc.Core is visible to developers and code analyzer.
Forcing the user to catch "NotSupportedException" is not good either. What about the alternative "bool CanCancelWriteAsync"? |
A property like that is only useful if you have code that could run on either implementation. That doesn't seem like it would be common. But if more people ask for this, then it could be considered. If you know WriteAsync with a cancellation token isn't supported then just don't call it. |
Thank you for your feedback. We're closing this issue as the behavior discussed is by design. |
This sadly also did bite us... ReSharper is creating warnings that there is a variant with cancellation token support. Our users just applied it (as it's usually useful) and found out later that this is throwing an exception. So I'm also not too happy with the solution. In my opinion, the macro checking for |
I’d personally be fine with the current state if ReSharper isn’t suggesting filling in the cancellation token from context. What about adding a setting that would suppress the exception? It’s unwatchable that no team member always ignores this overload (and the suggestion). |
@NorekZ We nowadays pass Since |
Thanks for suggestion. I now realized this issue is for deprecated Grpc.Core. We use Grpc.AspNetCore, where we are observing the same problem. Eventually I've found problem in our Interceptor, where I missed the new method. I generated |
Grpc.Net 2.46.0, Grpc.Core 2.46.1
Is your feature request related to a problem? Please describe.
As an API user, i want to know if IAsyncStreamWriter supports WriteAsync(message, CancellationToken).
I don't want to guess or to catch NotSupportedException thrown by the default implementation.
Describe the solution you'd like
change the default implementation, remove NotSupportedException:
Describe alternatives you've considered
add indicator whether the current AsyncStreamWriter supports WriteAsync(message, CancellationToken)
Additional context
Few examples of WriteAsync in context of Grpc.Net and Grpc.Core WriteAsyncChallenge.zip.
The text was updated successfully, but these errors were encountered: