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.

RpcException causes "Infinite recursion during resource lookup within System.Private.CoreLib." and terminates process

See original GitHub issue

What version of gRPC and what language are you using?

C# net5.0 Grpc.Net.Client 2.34.0

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

Win 10 x64 - 10.0.19041

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

5.0.102

What did you do?

Made an AsyncUnary client call and awaited the response headers and then response, the server immediately writes response headers and then after a short delay intentionally throws an RpcException.

        static async Task Main()
        {
            using var channel = GrpcChannel.ForAddress("http://localhost:5001");
            var client =  new Greeter.GreeterClient(channel);
            var helloCall =  client.SayHelloAsync(new HelloRequest { Name = "GreeterClient" });
            Console.WriteLine(string.Join(", ", await helloCall.ResponseHeadersAsync));
            Console.WriteLine(await helloCall.ResponseAsync);
        }

What did you expect to see?

An RpcException thrown while awaiting response.

What did you see instead?

Response headers are printed and then the process terminates when it should be throwing RpcException.

[Entry: key=date, value=Sat, 06 Feb 2021 06:59:37 GMT], [Entry: key=server, value=Kestrel]
Process terminated. Infinite recursion during resource lookup within System.Private.CoreLib.  This may be a bug in System.Private.CoreLib, or potentially in certain extensibility points such as assembly resolve events or CultureInfo names.  Resource name: Exception_EndOfInnerExceptionStack
   at System.Environment.FailFast(System.String)
   at System.SR.InternalGetResourceString(System.String)
   at System.SR.GetResourceString(System.String, System.String)
   at System.SR.GetResourceString(System.String)
   at System.SR.get_Exception_EndOfInnerExceptionStack()
   at System.Exception.ToString()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(System.Threading.Tasks.Task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at MyProject.Program.<Main>(System.String[])

When running this under Rider it suggests the following: Target process has exited during evaluation of instance method System.Exception.ToString() with actual parameters Grpc.Core.RpcException. This may possibly happen due to StackOverflowException.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:17 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
alexrosenfeld10commented, Mar 3, 2021
1reaction
invidious9000commented, Feb 9, 2021

Thank you @jkotas and @tarekgh

I have no watches defined; I have not yet been able to reproduce without a debugger attached but even with Rider debugger attached it has been difficult to reproduce with Greeter example. I will try to reproduce without debugger and in VS, but I think I need to file an issue with Rider.

Read more comments on GitHub >

github_iconTop Results From Across the Web

When an exception is thrown while debugging it ...
Process terminated. Infinite recursion during resource lookup within System.Private.CoreLib. This may be a bug in System.Private.
Read more >
C# infinite recursion during resource lookup
I was just trying to figure out an issue where we intended to retrieve something from isolated storage, and it got stuck in...
Read more >
Has the mscorlib recursive resource lookup bug been fixed?
Recently I have been getting this fatal error sporadically and it crashes the computer so that it displays a black screen.
Read more >
Finite and Infinite Recursion with examples
Finite Recursion occurs when the recursion terminates after a finite number of recursive calls. A recursion terminates only when a base ...
Read more >
Infinite recursion during resource lookup within System. ...
Recursive resource lookup bug - Infinite recursion during resource lookup within System.Private.CoreLib.
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