When trying to create a connection to event store: System.Reflection.CustomAttributeFormatException: 'Value' property specified was not found

Hello,

Since last night we are getting this exception on our PROD environment:

   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes)
   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 C:\projects\protobuf-net\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 C:\projects\protobuf-net\src\protobuf-net\Meta\MetaType.cs:line 956
   at ProtoBuf.Meta.MetaType.ApplyDefaultBehaviour_AddMembers(AttributeFamily family, Boolean isEnum, List`1 partialMembers, Int32 dataMemberOffset, Boolean inferTagByName, ImplicitFields implicitMode, List`1 members, MemberInfo member, Boolean& forced, Boolean isPublic, Boolean isField, Type& effectiveType, List`1 enumMembers, MemberInfo backingMember) in C:\projects\protobuf-net\src\protobuf-net\Meta\MetaType.cs:line 791
   at ProtoBuf.Meta.MetaType.ApplyDefaultBehaviour() in C:\projects\protobuf-net\src\protobuf-net\Meta\MetaType.cs:line 721
   at ProtoBuf.Meta.RuntimeTypeModel.FindOrAddAuto(Type type, Boolean demand, Boolean addWithContractOnly, Boolean addEvenIfAutoDisabled) in C:\projects\protobuf-net\src\protobuf-net\Meta\RuntimeTypeModel.cs:line 616
   at ProtoBuf.Meta.RuntimeTypeModel.get_Item(Type type) in C:\projects\protobuf-net\src\protobuf-net\Meta\RuntimeTypeModel.cs:line 472
   at EventStore.ClientAPI.Messages.ClientMessage.InitializeSerializers()
--- End of stack trace from previous location where exception was thrown ---
   at EventStore.ClientAPI.EventStoreConnection.Create(ConnectionSettings connectionSettings, Uri uri, String connectionName)
   at EventStore.ClientAPI.EventStoreConnection.Create(String connectionString, ConnectionSettingsBuilder builder, String connectionName)
   at Plexe.Library.Infrastructure.EventStore.EventStoreOrgStore.GetAggregateEvents(Guid aggregateId, String aggregatTypeName)
   at Plexe.Library.Infrastructure.EventStore.EventStoreOrgStore.GetById[T](Guid aggregateId)
   at Plexe.Origination.Backend.Context.Events.ApplicationEventHandler.ChangeStatus(Func`2 test, Guid applicationId, String newStatus) in D:\a\1\s\src\Plexe.Origination.Backend.Context\Events\ApplicationEventHandler.cs:line 678
   at Plexe.Origination.Backend.Context.Events.ApplicationEventHandler.Handle(AccountingSystemConnectNotification event) in D:\a\1\s\src\Plexe.Origination.Backend.Context\Events\ApplicationEventHandler.cs:line 365

This is code that we’ve had running for almost 1 year now, nothing changed on our side (until proven otherwise of course but this is an ongoing investigation … ) , I’ve looked in the EventStor Client repositroy (version 5.0.1) , also in the ProtoBuf repository, and didn’t see anything suspicious.

We are running this inside an Azure Function with .NET Core 2.2 … at this point i am suspecting it’s the Azure Function’s Runtime version that has changed, and causing some kind of DLL Conflict. ( I also created a ticket for them here: https://github.com/Azure/Azure-Functions/issues/1463 and I mentioend in the past other people have had this similar exception and was cused by the AF runtime)

However I decided to post this here and ask for your feedback / opinion, maybe this indeed has something to do with EventStore.Oorg and ProtoBuf , so maybe the EventStore development team can share their opinion, or if they ever have had this in the past.

Thanks a lot,
Vlad

Adding to this post, one weird thing I found out, though is the following:

Just to clarify, we are using the EventStore.Client, version 5.0.1 which uses the Protobuf-net **version 2.4.0.0 . **

In the Exception’s Log, I also see the following:

loggg.PNG

Please remark the namespace: **Protobuf-net.Core ** .This doesn’t make sense. Protobuf-net version 2.4.0.0 doesn’t even have the namespace for NET Core, also to confirm that we are using 2.4.0.0 I downloaded the production Azure Function’s content, decompiled the protobuf-net DLL From the bin folder, and here it is, no code in ProtoEnumAttribute that could cause the exception:

proto.PNG

On the other hand, the exact code that could cause that exception in the ProtoEnumAttribute class, is in the master branch of the Proto NET repository, exactly Line number 23 as shown in our log:

https://github.com/protobuf-net/protobuf-net/blob/master/src/protobuf-net.Core/ProtoEnumAttribute.cs

In the 2.4.0 Tag of the Proto repository there is no protobuf-net.Core .

https://github.com/protobuf-net/protobuf-net/tree/2.4.0/src

So: how is it that we are seeing in the log code that’s in the master branch of protobuf-net, but not in the Actual DLL that I’ve decompiled and looked into

I know it’s a litte bit late, but just for others might running in the same Problem

Solved it using Paket ( https://fsprojects.github.io/Paket/ ) by pinning to specific Version of Dependencies

framework: auto-detect
nuget protobuf-net ~> 2
nuget EventStore.Client ~> 5