Confirm you've already contributed to this project or that you sponsor it
[X] I confirm I'm a sponsor or a contributor
Version
4.x
Question
Description
I am trying to upgrade OpenIdDict binaries for https://github.com/Nfactor26/pixel-identity to version 4.7. This requires me to also update MongoDB.Driver to a newer version [OpenIddict.MongoDb 4.7.0 -> MongoDB.Driver (>= 2.20.0)].
However, once I upgrade MondoDB.Driver to a newer version, ListAsync doesn't work anymore. This is not an issue with OpenIDDict but recent versions of Mongo driver . Please see issue https://jira.mongodb.org/browse/CSHARP-4535?attachmentOrder=desc .
ExceptionSystem.ArgumentException: ValueType 'OpenIddict.MongoDb.Models.OpenIddictMongoDbApplication' of parameterSerializer does not match parameter type 'System.Object'. (Parameter 'parameterSerializer') at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToFilterTranslators.ExpressionToFilterTranslator.TranslateLambda(TranslationContext context, LambdaExpression lambdaExpression, IBsonSerializer parameterSerializer, Boolean asRoot) at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToPipelineTranslators.WhereMethodToPipelineTranslator.Translate(TranslationContext context, MethodCallExpression expression) at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToPipelineTranslators.ExpressionToPipelineTranslator.Translate(TranslationContext context, Expression expression) at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToPipelineTranslators.SelectMethodToPipelineTranslator.Translate(TranslationContext context, MethodCallExpression expression) at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToPipelineTranslators.ExpressionToPipelineTranslator.Translate(TranslationContext context, Expression expression) at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToExecutableQueryTranslators.ExpressionToExecutableQueryTranslator.Translate[TDocument,TOutput](MongoQueryProvider1 provider, Expression expression)
at MongoDB.Driver.Linq.Linq3Implementation.MongoQuery2.ToCursorAsync(CancellationToken cancellationToken) at MongoDB.Driver.OpenIddictMongoDbHelpers.<ToAsyncEnumerable>g__ExecuteAsync|0_0[T](IAsyncCursorSource1 source, CancellationToken cancellationToken)+MoveNext()
at MongoDB.Driver.OpenIddictMongoDbHelpers.gExecuteAsync|0_0[T](IAsyncCursorSource1 source, CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult() at OpenIddict.MongoDb.OpenIddictMongoDbApplicationStore1.<>c__DisplayClass30_0`2.<gExecuteAsync|0>d.MoveNext()
--- End of stack trace from previous location ---
at OpenIddict.MongoDb.OpenIddictMongoDbApplicationStore1.<>c__DisplayClass30_02.<gExecuteAsync|0>d.MoveNext()
--- End of stack trace from previous location ---
at OpenIddict.MongoDb.OpenIddictMongoDbApplicationStore`1.<>cDisplayClass30_02.<<ListAsync>g__ExecuteAsync|0>d.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult(Int16 token) at Pixel.Identity.Store.Mongo.Worker.StartAsync(CancellationToken cancellationToken) in F:\Git\Pixel.Identity\src\Pixel.Identity.Store.Mongo\Worker.cs:line 145
Disclaimer
I am not a direct contributor to this project but maintain another helper project (https://github.com/Nfactor26/pixel-identity) on top of OpenIDDict to provide a UI for it.
Confirm you've already contributed to this project or that you sponsor it
Version
4.x
Question
Description I am trying to upgrade OpenIdDict binaries for https://github.com/Nfactor26/pixel-identity to version 4.7. This requires me to also update MongoDB.Driver to a newer version [OpenIddict.MongoDb 4.7.0 -> MongoDB.Driver (>= 2.20.0)]. However, once I upgrade MondoDB.Driver to a newer version, ListAsync doesn't work anymore. This is not an issue with OpenIDDict but recent versions of Mongo driver . Please see issue https://jira.mongodb.org/browse/CSHARP-4535?attachmentOrder=desc .
Suggested Workaround Set LinqProvider = LinqProvider.V2 on MongoClientSettings as suggested on https://jira.mongodb.org/browse/CSHARP-4535?attachmentOrder=desc
Question Do we have any other workaround for OpenIddict.MongoDb 4.7.0 to get this working ?
Example Code
https://github.com/Nfactor26/pixel-identity/blob/main/src/Pixel.Identity.Store.Mongo/Worker.cs
ExceptiongExecuteAsync|0_0[T](IAsyncCursorSourceg ExecuteAsync|0>d.MoveNext()
--- End of stack trace from previous location ---
at OpenIddict.MongoDb.OpenIddictMongoDbApplicationStoregExecuteAsync|0>d.MoveNext()
--- End of stack trace from previous location ---
at OpenIddict.MongoDb.OpenIddictMongoDbApplicationStore`1.<>cDisplayClass30_0
System.ArgumentException: ValueType 'OpenIddict.MongoDb.Models.OpenIddictMongoDbApplication' of parameterSerializer does not match parameter type 'System.Object'. (Parameter 'parameterSerializer') at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToFilterTranslators.ExpressionToFilterTranslator.TranslateLambda(TranslationContext context, LambdaExpression lambdaExpression, IBsonSerializer parameterSerializer, Boolean asRoot) at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToPipelineTranslators.WhereMethodToPipelineTranslator.Translate(TranslationContext context, MethodCallExpression expression) at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToPipelineTranslators.ExpressionToPipelineTranslator.Translate(TranslationContext context, Expression expression) at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToPipelineTranslators.SelectMethodToPipelineTranslator.Translate(TranslationContext context, MethodCallExpression expression) at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToPipelineTranslators.ExpressionToPipelineTranslator.Translate(TranslationContext context, Expression expression) at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToExecutableQueryTranslators.ExpressionToExecutableQueryTranslator.Translate[TDocument,TOutput](MongoQueryProvider
1 provider, Expression expression) at MongoDB.Driver.Linq.Linq3Implementation.MongoQuery2.ToCursorAsync(CancellationToken cancellationToken) at MongoDB.Driver.OpenIddictMongoDbHelpers.<ToAsyncEnumerable>g__ExecuteAsync|0_0[T](IAsyncCursorSource
1 source, CancellationToken cancellationToken)+MoveNext() at MongoDB.Driver.OpenIddictMongoDbHelpers.1 source, CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult() at OpenIddict.MongoDb.OpenIddictMongoDbApplicationStore
1.<>c__DisplayClass30_0`2.<1.<>c__DisplayClass30_0
2.<2.<<ListAsync>g__ExecuteAsync|0>d.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult(Int16 token) at Pixel.Identity.Store.Mongo.Worker.StartAsync(CancellationToken cancellationToken) in F:\Git\Pixel.Identity\src\Pixel.Identity.Store.Mongo\Worker.cs:line 145
Disclaimer I am not a direct contributor to this project but maintain another helper project (https://github.com/Nfactor26/pixel-identity) on top of OpenIDDict to provide a UI for it.