markjprice / apps-services-net8

Repository for the Packt Publishing book titled "Apps and Services with .NET 8" by Mark J. Price
119 stars 55 forks source link

gRPC Error in Chapter13 #17

Open DocVD opened 5 months ago

DocVD commented 5 months ago

Self-healing code apparently is the new paradigm. I wanted to give you my steps on this and let you decide if it is an issue (or bug in gRPC).

After getting to step-10 on page 580 I received an error that I could not resolve. After revisiting the code from the beginning, I could still not resolve it, so I tore everything down and restarted, but again got the same error message. Page-580 Step-10: "In Program.cs, in the section for configuring services, write a statement to add the GreeterClient as a named gRPC client that will be communicating with a service that is listening on port 5131, as shown in the following code: builder.Services.AddGrpcClient("Greeter", options => { options.Address = new Uri("https://localhost:5131"); });" ISSUE: When I looked at [GreetGrp.cs] generated file in step-8 (same page), I found the following instead: using grpc = global::Grpc.Core; I am using VS2022, version 17.10.0. _STEP-10ERROR: The line beginning, { builder.Services.AddGrpcClient("Greeter"...} could not find the Greeter.GreeterClient class. So I removed the "GreeterClient" dot-searched for "GreeterBase" that iniitially was found and did a build again. Then it too, was not found after a while. I again restored the greeter.GreeterClient and then it was found! RESULT: I was then able to successfully complete the remainder of the steps without issue.

Other notes: A) On Page-574, Step-3, it was stated to "note" the following:

However, the initial code generated with the project was using: Version = "2.57.0" So I changed it to Version = "2.59.0".

B) I am using CoPilot; trying to annotate my files is sometimes spot-on, and sometimes useless. Nevertheless, it seems that gRPC is attempting to self-heal the code in this situation. I did not ever do a "clean".