-
Notifications
You must be signed in to change notification settings - Fork 8
Closed
Description
I'm came across this library and as I'm using NodaTime, I wanted to run some uni tests to see how some of my components behave with Sqlite.
For this purpose, I'm storing and then retrieving a single record from a sqlite instance (in memory)
Appointment appointment = new(id: appointmentId,
subject: "Confidential",
location: "Wayne Tower",
startDate: 12.July(2013).Add(14.Hours().And(30.Minutes())).AsUtc().ToInstant(),
endDate: 12.July(2013).Add(14.Hours().And(45.Minutes())).AsUtc().ToInstant()
);
DbContext.Appointments.Add(appointment);
DbContext.Appointments.SaveChanges();
DbContext.Appointments.SingleOrDefault(x => x.Id == appointemntId); //
I get the following exception
Message:
NodaTime.Text.UnparsableValueException : The value string does not match a quoted string in the pattern. Value being parsed: '2013-07-12 14:30:00^'. (^ indicates error position.)
Arborescence des appels de procédure:
ParseResult`1.GetValueOrThrow()
lambda_method310(Closure , QueryContext , DbDataReader , ResultContext , SingleQueryResultCoordinator )
AsyncEnumerator.MoveNextAsync()
ShapedQueryCompilingExpressionVisitor.SingleAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken)
ShapedQueryCompilingExpressionVisitor.SingleAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken)
It seems that the date is not stored as expected in sqlite (without the milliseconds part) and so the plugin fails to read the data back from db.
That's the same exception I get when I run the following code on [Nodatime recipes]https://nodatime.org/3.0.x/userguide/recipes)
var pattern = InstantPattern.CreateWithInvariantCulture( "uuuu'-'MM'-'dd' 'HH':'mm':'ss'.'FFFFFFFFF"); // <- pattern from EFCore.Sqlite.NodaTime
var instant = pattern.Parse("2015-12-23 10:30:00");
Console.WriteLine(instant.GetValueOrThrow()); // <--- exception
Stack trace
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> NodaTime.Text.UnparsableValueException: The value string does not match a quoted string in the pattern. Value being parsed: '2015-12-23 10:30:00^'. (^ indicates error position.)
at NodaTime.Text.ParseResult`1[T].GetValueOrThrow () <0x3057d28 + 0x00032> in <97e1494ad14a4fde9bb08a9da3731ed3>:0
at TryNodaTime.Program.Main (System.String[] args) <0x308e650 + 0x00022> in <720a4b6afcc94af498ffb193899d4d81>:0
at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) <0x2426c28 + 0x000d2> in <d1a6e0f66f2d41eb828463169bc90c4c>:0
--- End of inner exception stack trace ---
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) <0x2426c28 + 0x000fe> in <d1a6e0f66f2d41eb828463169bc90c4c>:0
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) <0x24266a0 + 0x00016> in <d1a6e0f66f2d41eb828463169bc90c4c>:0
at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync (System.CommandLine.Invocation.InvocationContext context) <0x2e01668 + 0x000b6> in <6793e93bcbca41a69b5ad876f7ba42b9>:0
at System.CommandLine.Invocation.InvocationPipeline+<>c__DisplayClass2_0.<InvokeAsync>b__0 (System.CommandLine.Invocation.InvocationContext invocationContext, System.Func`2[T,TResult] next) <0x2e00a90 + 0x0018e> in <6793e93bcbca41a69b5ad876f7ba42b9>:0
at System.CommandLine.Invocation.InvocationPipeline.InvokeAsync (System.CommandLine.IConsole console) <0x2ded260 + 0x00216> in <6793e93bcbca41a69b5ad876f7ba42b9>:0
at System.CommandLine.Invocation.InvocationExtensions.InvokeAsync (System.CommandLine.Parser parser, System.CommandLine.ParseResult parseResult, System.CommandLine.IConsole console) <0x2dec070 + 0x000fc> in <6793e93bcbca41a69b5ad876f7ba42b9>:0
at System.CommandLine.Invocation.InvocationExtensions.InvokeAsync (System.CommandLine.Parser parser, System.String[] args, System.CommandLine.IConsole console) <0x2d89590 + 0x00110> in <6793e93bcbca41a69b5ad876f7ba42b9>:0
at MLS.WasmCodeRunner.CodeRunner.ExecuteRunRequest (MLS.WasmCodeRunner.WasmCodeRunnerRequest runRequest, System.Int32 sequence) <0x2cfbff0 + 0x0012c> in <6df86f2ebca54da5b31eaf28728bf915>:0
Metadata
Metadata
Assignees
Labels
No labels