Description
What version of gRPC and what language are you using?
.NET8, c#
Grpc.Net.Client v2.67.0
What operating system (Linux, Windows,...) and version?
Windows 10
What runtime / compiler are you using (e.g. .NET Core SDK version dotnet --info
)
Visual Studio 2022
What did you do?
If possible, provide a recipe for reproducing the error. Try being specific and include code snippets if helpful.
when create channel with single url, ex:
var channel = GrpcChannel.ForAddress("http://localhost:5000"); Console.WriteLine($"grpc_address='{channel.Target}'"); // will be localhost:5000
but create channel with default StaticResolverFactory, the channel.Target returns null.
`var addrList = new List() {
new BalancerAddress("127.0.0.1", 5001),
new BalancerAddress("127.0.0.1", 5002)
};
var services = new ServiceCollection();
services.AddSingleton(new StaticResolverFactory(addr => addrList.ToArray()));
channel = GrpcChannel.ForAddress(
"static:///my-example-host",
new GrpcChannelOptions
{
ServiceProvider = services.BuildServiceProvider()
});
Console.WriteLine($"grpc_address='{channel.Target}'"); // return null`
What did you expect to see?
channel.Target return the original target used to create the channel.
What did you see instead?
channel.Target return null.
Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).
See TROUBLESHOOTING.md for how to diagnose problems better.