Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.IO.FileNotFoundException: Could not load file or assembly 'System.ServiceModel.Primitives, Version=4.5.0.3 #337

Open
rudidlo opened this issue Oct 1, 2024 · 0 comments

Comments

@rudidlo
Copy link

rudidlo commented Oct 1, 2024

When trying to deliver message using unary call getting following exception on net4.8
using GrpcWebHandler to connect with service on Http1

GrpcWebHandler grpcWebHandler = new GrpcWebHandler(GrpcWebMode.GrpcWebText, (HttpMessageHandler) new HttpClientHandler());
     return GrpcChannel.ForAddress(this.serviceUri, new GrpcChannelOptions()
     {
       HttpHandler = (HttpMessageHandler) grpcWebHandler
     });

I get following missing reference error

System.TypeInitializationException: The type initializer for 'DefaultProxyCache1' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.ServiceModel.Primitives, Version=4.5.0.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit) at System.Attribute.GetCustomAttributes(MemberInfo element, Type type, Boolean inherit) at System.Attribute.GetCustomAttribute(MemberInfo element, Type attributeType, Boolean inherit) at ProtoBuf.Grpc.Internal.ProxyEmitter.CreateFactory[TService](BinderConfiguration binderConfig) in /_/src/protobuf-net.Grpc/Internal/ProxyEmitter.cs:line 120 at ProtoBuf.Grpc.Configuration.ClientFactory.DefaultProxyCache1..cctor() in //src/protobuf-net.Grpc/Configuration/ClientFactory.cs:line 81
--- End of inner exception stack trace ---
at ProtoBuf.Grpc.Configuration.ClientFactory.DefaultClientFactory.CreateClient[TService](CallInvoker channel) in /
/src/protobuf-net.Grpc/Configuration/ClientFactory.cs:line 91

I have fixed it by adding System.ServiceModel.Primitives as my nuget package dependency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant