Upgraded protobuf.net causes exception

My solution was working fine until I upgraded an unrelated library which references a newer version protobuf.net (3.0.29).

When I try to connect to EventStore (5.0.8) I now get this exception…

System.Reflection.CustomAttributeFormatException

  • HResult=0x80131605*
  • Message=‘Value’ property specified was not found.*
  • Source=System.Private.CoreLib*
  • StackTrace:*
  • at System.Reflection.CustomAttribute.AddCustomAttributes(ListBuilder1& attributes, RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder1 derivedAttributes)*
  • at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType)*
  • at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeFieldInfo field, RuntimeType caType)*
  • at System.Reflection.RuntimeFieldInfo.GetCustomAttributes(Boolean inherit)*
  • at ProtoBuf.Meta.AttributeMap.Create(MemberInfo member, Boolean inherit) in /_/src/protobuf-net/Meta/AttributeMap.cs:line 32*
  • at ProtoBuf.Meta.MetaType.NormalizeProtoMember(MemberInfo member, AttributeFamily family, Boolean forced, Boolean isEnum, List`1 partialMembers, Int32 dataMemberOffset, Boolean inferByTagName, EnumMember& enumMember, MemberInfo backingMember) in /_/src/protobuf-net/Meta/MetaType.cs:line 1036*
  • at ProtoBuf.Meta.MetaType.ApplyDefaultBehaviour_AddMembers(AttributeFamily family, Boolean isEnum, List1 partialMembers, Int32 dataMemberOffset, Boolean inferTagByName, ImplicitFields implicitMode, List1 members, MemberInfo member, Boolean& forced, Boolean isPublic, Boolean isField, Type& effectiveType, List`1 enumMembers, MemberInfo backingMember) in /_/src/protobuf-net/Meta/MetaType.cs:line 868*
  • at ProtoBuf.Meta.MetaType.ApplyDefaultBehaviourImpl(CompatibilityLevel ambient) in /_/src/protobuf-net/Meta/MetaType.cs:line 790*
  • at ProtoBuf.Meta.MetaType.ApplyDefaultBehaviour(CompatibilityLevel ambient) in /_/src/protobuf-net/Meta/MetaType.cs:line 601*
  • at ProtoBuf.Meta.RuntimeTypeModel.FindOrAddAuto(Type type, Boolean demand, Boolean addWithContractOnly, Boolean addEvenIfAutoDisabled, CompatibilityLevel ambient) in /_/src/protobuf-net/Meta/RuntimeTypeModel.cs:line 716*
  • at ProtoBuf.Meta.RuntimeTypeModel.get_Item(Type type) in /_/src/protobuf-net/Meta/RuntimeTypeModel.cs:line 561*
  • at EventStore.ClientAPI.Messages.ClientMessage.InitializeSerializers()*
  • at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()*
  • at EventStore.ClientAPI.EventStoreConnection.Create(ConnectionSettings connectionSettings, Uri uri, String connectionName)*
  • at EventStore.ClientAPI.EventStoreConnection.Create(String connectionString, ConnectionSettingsBuilder builder, String connectionName)*
  • at EventStore.ClientAPI.EventStoreConnection.Create(String connectionString, String connectionName)*
  • at AEA.GarthApp.Service1.Application.Configuration.EventStore.EventStoreModule…ctor(ConfigurationSettings configurationSettings) in C:\src\applications\archives\GarthApp\BoundedContexts\Service1\Application\Configuration\EventStore\EventStoreModule.cs:line 20*
  • at AEA.GarthApp.Service1.Application.Configuration.Service1Startup.ConfigureCompositionRoot(ConfigurationSettings configSettings, ContainerBuilder& containerBuilder) in C:\src\applications\archives\GarthApp\BoundedContexts\Service1\Application\Configuration\Service1Startup.cs:line 77*
  • at AEA.GarthApp.Service1.Application.Configuration.Service1Startup.Initialize(ConfigurationSettings configSettings, ContainerBuilder& containerBuilder) in C:\src\applications\archives\GarthApp\BoundedContexts\Service1\Application\Configuration\Service1Startup.cs:line 41*
  • at AEA.GarthApp.Service1.API.Startup.CreateAutofacServiceProvider(IServiceCollection services) in C:\src\applications\archives\GarthApp\BoundedContexts\Service1\API\Startup.cs:line 314*
  • at AEA.GarthApp.Service1.API.Startup.ConfigureServices(IServiceCollection services) in C:\src\applications\archives\GarthApp\BoundedContexts\Service1\API\Startup.cs:line 140*
  • at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)*
  • at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)*
  • at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)*
  • at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.g__Startup|0(IServiceCollection serviceCollection)*
  • at Microsoft.AspNetCore.Hosting.StartupLoader.ConfigureServicesDelegateBuilder`1.<>c__DisplayClass15_0.g__RunPipeline|0(IServiceCollection services)*
  • at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services)*
  • at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.b__0(IServiceCollection services)*
  • at Microsoft.AspNetCore.Hosting.StartupLoader.ConfigureServicesDelegateBuilder`1.<>c__DisplayClass14_0.g__ConfigureServicesWithContainerConfiguration|0(IServiceCollection services)*
  • at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)*

Inner Exception 1:
TargetInvocationException: Exception has been thrown by the target of an invocation.

Inner Exception 2:
NotSupportedException: Specified method is not supported.

Wondering if by switching to EventStore 20.x.x would I still have this exception?

Unfortunately, due to ilmerge not working on dotnet core, we can no longer internalize our dependencies. I would just remove the reference to protobuf.net from your project entirely. If you really do need this version of protobuf.net, you can try upgrading to 20.6.x. It comes with a new gRPC transport, and since the client for this (found here: https://www.nuget.org/packages/EventStore.Client.Grpc.Streams/) uses google’s implementation, it won’t conflict with yours. The TCP client will still break in this situation however.

Thank you for your reply. We are fortunate to be in a position to migrate over the 20.6.x and so we will try to setup 20.6.x again. We recently tried to stand-up a single instance dev instance of 20.6.x on an Azure VM and while it seemed to be running, it was not creating the database in the folder we specified nor could we connect via EventStore Dashboard on the the local VM. The logs were generating in the folder we specified and we followed the installation instructions. Will try again.

How different is the API on the new client from the old? Is there any migration guidance?

The API attempts to be as similar as possible, while taking advantage of c# 8 language features. The main difference is that paging is eliminated client side - IAsyncEnumerable is used instead.