Search code examples
c#asp.net-identityazure-cosmosdb

getting error after updatet documentDB sdk .net to 1.10.0 or latest


I have a project and it was working ppropely but due to the older version of Microsoft DocumentDB I can't use all the query like between and etc. So, I have updated the packages.

Below is my current package version.

Microsoft.Azure.DocumentDB : Version - 1.12.2
DocumentDB.AspNet.Identity : Version - 1.0.10-beta

Older Verion of Package.

Microsoft.Azure.Documents.Client 0.9.0-preview
Microsoft.AspNet.Identity.Core 2.1.0

Exception:

Method not found: 'System.Threading.Tasks.Task1<Microsoft.Azure.Documents.Client.FeedResponse1> Microsoft.Azure.Documents.Linq.IDocumentQuery`1.ExecuteNextAsync()'.

Stacktrace:

at DocumentDB.AspNet.Identity.UserStore1.<GetUsers>d__9.MoveNext()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder
1.Start[TStateMachine](TStateMachine& stateMachine) at DocumentDB.AspNet.Identity.UserStore1.GetUsers(Expression1 predicate) at DocumentDB.AspNet.Identity.UserStore1.<FindByNameAsync>d__17.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNet.Identity.TaskExtensions.CultureAwaiter1.GetResult() at Microsoft.AspNet.Identity.UserManager2.<FindAsync>d__12.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at Cherish.Api.Controllers.LoginController.d__9.MoveNext() in E:\Chandresh\MVC Projects\Cherish\Experiment\Cherish.Api\Controllers\LoginController.cs:line 90

Code Snippet:

 var Client = new DocumentClient(new
 Uri(ConfigurationManager.AppSettings["DocumentDbEndpointUrl"]),
 ConfigurationManager.AppSettings["DocumentDbAuthKey"]);
 var manager = new ApplicationUserManager(new
 UserStore<ApplicationUser>(Client, ConfigurationManager.AppSettings["DocumentDbDatabaseName"], "UserDetail"));

Error Line:

await UserManager.FindAsync(model.Email, model.Password);

Solution

  • It seems the SDK compatibility issue. It seems that there is an issue that DocumentDB.AspNet.Identity 1.0.10-beta SDK works with Microsoft.Azure.DocumentDB : Version >= 1.10.

    Please have a try to use the following 2 ways to resolve this issue.

    1.If downgrade Microsoft.Azure.DocumentDB is possible, please use the Microsoft.Azure.DocumentDB 1.9.5 version SDK in your other project.

    2.Please have a try to download the DocumentDB.AspNet.Identity source code. And update the Microsoft.Azure.DocumentDB version to the lastest(1.14.1) in the source code project. Then recompile to generate a new dll to reference in your other projects, then it should work perfectly. I have tested it on my side.