Openiddict-core: Cannot serialize ImmutableArray<T> by MongoDb.Driver

Created on 9 Oct 2020  路  3Comments  路  Source: openiddict/openiddict-core

MongoDb.Driver cannot serialize ImmutableArray <T>.

.AddCore(options =>
    {
        options.UseMongoDb(/* ... */);
   });

I get an exception when I run the application.

System.ArgumentException
GenericArguments[0], 'System.Collections.Immutable.ImmutableArray`1[System.String]', on 'MongoDB.Bson.Serialization.Serializers.EnumerableInterfaceImplementerSerializer`2[TValue,TItem]' violates the constraint of type 'TValue'.
   at MongoDB.Driver.Core.Connections.BinaryConnection.SendMessagesAsync(IEnumerable`1 messages, MessageEncoderSettings messageEncoderSettings, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.WireProtocol.CommandUsingCommandMessageWireProtocol`1.ExecuteAsync(IConnection connection, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Servers.Server.ServerChannel.ExecuteProtocolAsync[TResult](IWireProtocol`1 protocol, ICoreSession session, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.RetryableWriteOperationExecutor.ExecuteAsync[TResult](IRetryableWriteOperation`1 operation, RetryableWriteContext context, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.BulkUnmixedWriteOperationBase`1.ExecuteBatchAsync(RetryableWriteContext context, Batch batch, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.BulkUnmixedWriteOperationBase`1.ExecuteBatchesAsync(RetryableWriteContext context, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.BulkMixedWriteOperation.ExecuteBatchAsync(RetryableWriteContext context, Batch batch, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.BulkMixedWriteOperation.ExecuteAsync(IWriteBinding binding, CancellationToken cancellationToken)
   at MongoDB.Driver.OperationExecutor.ExecuteWriteOperationAsync[TResult](IWriteBinding binding, IWriteOperation`1 operation, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionImpl`1.ExecuteWriteOperationAsync[TResult](IClientSessionHandle session, IWriteOperation`1 operation, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionImpl`1.BulkWriteAsync(IClientSessionHandle session, IEnumerable`1 requests, BulkWriteOptions options, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionImpl`1.UsingImplicitSessionAsync[TResult](Func`2 funcAsync, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionBase`1.InsertOneAsync(TDocument document, InsertOneOptions options, Func`3 bulkWriteAsync)
   at OpenIddict.MongoDb.OpenIddictMongoDbApplicationStore`1.CreateAsync(TApplication application, CancellationToken cancellationToken) in /_/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbApplicationStore.cs:line 87
   at OpenIddict.Core.OpenIddictApplicationManager`1.CreateAsync(TApplication application, String secret, CancellationToken cancellationToken) in /_/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs:line 186
   at OpenIddict.Core.OpenIddictApplicationManager`1.CreateAsync(OpenIddictApplicationDescriptor descriptor, CancellationToken cancellationToken) in /_/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs:line 238
   at OpenIddict.Core.OpenIddictApplicationManager`1.OpenIddict.Abstractions.IOpenIddictApplicationManager.CreateAsync(OpenIddictApplicationDescriptor descriptor, CancellationToken cancellationToken) in /_/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs:line 1515

...
bug important

Most helpful comment

A new nightly build with a potential fix was pushed to MyGet.org. Give it a try when you have a moment.

All 3 comments

A new nightly build with a potential fix was pushed to MyGet.org. Give it a try when you have a moment.

Just tried the nightly build, the serialization issue is fixed 馃憣

I tried 3.0.0-beta.6. OK!

Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Belaroth picture Belaroth  路  4Comments

igorklimenko picture igorklimenko  路  5Comments

pealmeid picture pealmeid  路  4Comments

biapar picture biapar  路  5Comments

mattwcole picture mattwcole  路  3Comments