You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Grpc.Net.ClientFactory in unit test causing exception after upgrade to .Net 6.0: The type 'ServiceCollection' exists in both 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' and 'Microsoft.Extensions.DependencyInjection, Version=3.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' #1481
What operating system (Linux, Windows,...) and version?
Windows 10
What runtime / compiler are you using (e.g. .NET Core SDK version dotnet --info)
.NET 6.0.100
What did you do?
We had a Unit Test project that we upgraded from .Net 5.0 to .Net 6.0 where we were unit testing a IServiceCollection extension method to inject a gRPC client to the dependency injection container. The unit test in question looks like the following:
The issue is that Grpc.Net.Clientfactory 2.40.0 has a reference to Microsoft.Extensions.Http 3.0.3 which causes the following error when building.
The type 'ServiceCollection' exists in both 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' and 'Microsoft.Extensions.DependencyInjection, Version=3.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
What did you expect to see?
I expected to be able to compile and run the unit test.
What did you see instead?
When building the project, I get the following build error:
The type 'ServiceCollection' exists in both 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' and 'Microsoft.Extensions.DependencyInjection, Version=3.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
Anything else we should know about your project / environment?