tugberkugurlu / AspNetCore.Identity.MongoDB

MongoDB Data Store Adaptor for ASP.NET Core Identity
MIT License
229 stars 69 forks source link

Fix serialization of Occurance and FutureOccurance #41

Closed tugberkugurlu closed 7 years ago

tugberkugurlu commented 7 years ago

Fixes #36.

tugberkugurlu commented 7 years ago

bc5790e is the repro of this, fails with below error:

AspNetCore.Identity.MongoDB.Tests.MongoIdentityUserTests.MongoIdentityUser_ShouldSaveAndRetrieveTheFutureOccuranceCorrectly

Assert.Equal() Failure
Expected: FutureOccurrence { Instant = 2017-02-01T00:00:00.8996910Z }
Actual:   FutureOccurrence { Instant = 2017-02-01T00:00:00.8990000Z }
   at Xunit.Assert.Equal[T](T expected, T actual, IEqualityComparer`1 comparer)
   at AspNetCore.Identity.MongoDB.Tests.MongoIdentityUserTests.<MongoIdentityUser_ShouldSaveAndRetrieveTheFutureOccuranceCorrectly>d__1.MoveNext() in /Users/tugberk/apps/AspNetCore.Identity.MongoDB/tests/AspNetCore.Identity.MongoDB.Tests/MongoIdentityUserTests.cs:line 71
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Xunit.Sdk.TestInvoker`1.<>c__DisplayClass48_1.<<InvokeTestMethodAsync>b__1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Xunit.Sdk.ExecutionTimer.<AggregateAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Xunit.Sdk.ExceptionAggregator.<RunAsync>d__9.MoveNext()

see https://travis-ci.org/tugberkugurlu/AspNetCore.Identity.MongoDB/builds/196766190#L2409

tugberkugurlu commented 7 years ago

have a look: https://alexmg.com/datetime-precision-with-mongodb-and-the-c-driver/

tugberkugurlu commented 7 years ago

Also see http://stackoverflow.com/questions/6036433/datetime-issues-with-mongo-and-c-sharp

tugberkugurlu commented 7 years ago

see http://mongodb.github.io/mongo-csharp-driver/2.4/reference/bson/mapping/

tugberkugurlu commented 7 years ago

I am not sure why the build is hanging for this, could be related to using multiple MongoClient per app (not entirely sure). LGTM and worry about it on master if it keeps happening.