Skip to content

protobuf-net.Core does not work with System.Collections.Immutable version 8.0.0 when targeting .NET Framework #1136

@mrubacky

Description

@mrubacky

We have a project targeting .NET Framework 4.7.1 that now depends on System.Collections.Immutable >= 8.0.0

We get a runtime error loading System.Collections.Immutable version 7.0.0.0 which no longer exists in our project as the dependency has been updated to version 8.0.0.0

System.TypeInitializationException: The type initializer for 'ProtoBuf.Serializers.RepeatedSerializers' threw an exception. ---> System.IO.FileLoadException: Could not load file or assembly 'System.Collections.Immutable, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
   at ProtoBuf.Serializers.RepeatedSerializers..cctor()
   --- End of inner exception stack trace ---
   at ProtoBuf.Serializers.RepeatedSerializers.TryGetRepeatedProvider(Type type, Hashtable externalProvders)
   at ProtoBuf.Meta.RuntimeTypeModel.TryGetRepeatedProvider(Type type, CompatibilityLevel ambient) in /_/src/protobuf-net/Meta/RuntimeTypeModel.cs:line 1512
   at ProtoBuf.Meta.RuntimeTypeModel.<GetServicesSlow>g__GetServicesImpl|88_0(RuntimeTypeModel model, Type type, CompatibilityLevel ambient) in /_/src/protobuf-net/Meta/RuntimeTypeModel.cs:line 1022
   at ProtoBuf.Meta.RuntimeTypeModel.GetServicesSlow(Type type, CompatibilityLevel ambient) in /_/src/protobuf-net/Meta/RuntimeTypeModel.cs:line 999
   at ProtoBuf.Meta.RuntimeTypeModel.GetServices[T](CompatibilityLevel ambient) in /_/src/protobuf-net/Meta/RuntimeTypeModel.cs:line 975
   at ProtoBuf.Meta.RuntimeTypeModel.GetSerializer[T]() in /_/src/protobuf-net/Meta/RuntimeTypeModel.cs:line 962
   at ProtoBuf.Meta.TypeModel.TryGetSerializer[T](TypeModel model) in /_/src/protobuf-net.Core/Meta/TypeModel.cs:line 1485
   at ProtoBuf.Meta.TypeModel.SerializeImpl[T](State& state, T value) in /_/src/protobuf-net.Core/Meta/TypeModel.cs:line 375
   at ProtoBuf.Serializer.Serialize[T](Stream destination, T instance, Object userState) in /_/src/protobuf-net/Serializer.Serialize.cs:line 33
   at ProtoBuf.Serializer.Serialize[T](Stream destination, T instance) in /_/src/protobuf-net/Serializer.Serialize.cs:line 20

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions