question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Status(StatusCode="Cancelled", Detail="No grpc-status found on response.")

See original GitHub issue

StackTrace:

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter``1.GetResult()
   at Web.WidgetManagement.HttpAggregator.Services.WidgetService.<<GetAppliedWidgetsAsync>b__4_0>d.MoveNext() in C:\Users\ivan.cekov\source\repos\Admin-v6-Services\ApiGateways\Web.WidgetManagement.HttpAggregator\Services\WidgetService.cs:line 36
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter``1.GetResult()
   at Web.WidgetManagement.HttpAggregator.Services.GrpcCallerService.<CallService>d__0``1.MoveNext() in C:\Users\ivan.cekov\source\repos\Admin-v6-Services\ApiGateways\Web.WidgetManagement.HttpAggregator\Services\GrpcCallerService.cs:line 38

client WidgetService.cs

//_urls.GrpcWidget = https://localhost:5051
 public async Task<IEnumerable<WidgetData>> GetAppliedWidgetsAsync()
        {
            try
            {
                var res = await GrpcCallerService.CallService(_urls.GrpcWidget, async channel =>
                {
                    var client = new WidgetManager.API.Protos.WidgetManagement.WidgetManagementClient(channel);
                    _logger.LogDebug("grpc client created, GetAppliedWidgets");
                    var response = await client.GetAppliedWidgetsAsync(new Empty { });
                    _logger.LogDebug("grpc response {@response}", response);

                    return MapToWidgetData(response);
                });
                return res;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return null;
        }

GrpcCallerService.cs

public static class GrpcCallerService
    {
        public static async Task<TResponse> CallService<TResponse>(string urlGrpc, Func<GrpcChannel, Task<TResponse>> func)
        {
            AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
            AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2Support", true);
            var channel = GrpcChannel.ForAddress(urlGrpc);

            Log.Information("Creating grpc client base address urlGrpc ={@urlGrpc}, BaseAddress={@BaseAddress} ", urlGrpc, channel.Target);

            try
            {
                return await func(channel);
            }
            catch (RpcException e)
            {
                Log.Error("Error calling via grpc: {Status} - {Message}", e.Status, e.Message);
                return default;
            }
            finally
            {
                AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", false);
                AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2Support", false);
            }
        }

The issue appears when grpc server returns data to the client.

Environment details OS: Windows 10 Package name and version: .NET Core v3.1.7 & Grpc.Core 2.31.0 & protobuf-net 3.13.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

7reactions
sshbiocommented, Jan 6, 2021

Any update/suggestion on this issue?

1reaction
inforzipcommented, Jan 20, 2022

I have the same problem in UWP aplication, here my code:

AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);

var handler = new HttpClientHandler();
handler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;

var channel = GrpcChannel.ForAddress("https://localhost:5001", new GrpcChannelOptions
                    {
                        HttpHandler = handler,
                        Credentials = Grpc.Core.ChannelCredentials.SecureSsl
                    });

var client = new Greeter.GreeterClient(channel);

var replay = await client.SayHelloAsync(
                 new HelloRequest
                  {
                      Name = "Jose Antonio"
                  };

After this always the same error: Status(StatusCode=“Cancelled”, Detail="No grpc-status found on response.

How can i solve this problem

Read more comments on GitHub >

github_iconTop Results From Across the Web

net core 3.0 grpc error statucode=canceled
I got an error when using grpc in .net core 3.0,. Here is error message: [Grpc.Core.RpcException:“Status(StatusCode=Cancelled, Detail="No grpc- ...
Read more >
GRPC Core: Status codes and their use in gRPC
Code Number Description OK 0 Not an error; returned on success. FAILED_PRECONDITION 9 OUT_OF_RANGE 11
Read more >
Grpc.Core.RpcException: Status(StatusCode="Cancelled ...
I'm getting this compiler error when I open my project (upgraded it from the previous version [2022.1.23f1] to the latest version ...
Read more >
GRPC issues between servers
A cancelled status typically means some sort of time out. ... Grpc.Core.RpcException: Status(StatusCode="Unknown", Detail="Stream removed", ...
Read more >
Troubleshoot gRPC on .NET
The following error message is returned when calling a gRPC service without a trusted certificate: Unhandled exception. System.Net.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found