praeclarum / praeclarum/sqlite-net

timespan parsing from older version exception

Open
#910 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
4.5k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

Hello
My Xamarin.Android solution is using version 1.5.231, I have a table with TimeSpan column. When I upgraded to version 1.6.292, the application crashed with the following exception when trying to read objects from the table.
System.OverflowException: The TimeSpan could not be parsed because at least one of the numeric components is out of range or contains too many digits.
at System.Globalization.TimeSpanParse+TimeSpanResult.SetFailure (System.Globalization.TimeSpanParse+ParseFailureKind kind, System.String resourceKey, System.Object messageArgument, System.String argumentName) [0x00041] in <10be834c8e6b440dad35c7b03c353d9a>:0
at System.Globalization.TimeSpanParse+TimeSpanRawInfo.ProcessToken (System.Globalization.TimeSpanParse+TimeSpanToken& tok, System.Globalization.TimeSpanParse+TimeSpanResult& result) [0x00059] in <10be834c8e6b440dad35c7b03c353d9a>:0
at System.Globalization.TimeSpanParse.TryParseTimeSpan (System.ReadOnlySpan1[T] input, System.Globalization.TimeSpanParse+TimeSpanStandardStyles style, System.IFormatProvider formatProvider, System.Globalization.TimeSpanParse+TimeSpanResult& result) [0x00047] in <10be834c8e6b440dad35c7b03c353d9a>:0 at System.Globalization.TimeSpanParse.Parse (System.ReadOnlySpan1[T] input, System.IFormatProvider formatProvider) [0x00008] in <10be834c8e6b440dad35c7b03c353d9a>:0
at System.TimeSpan.Parse (System.String s) [0x00010] in <10be834c8e6b440dad35c7b03c353d9a>:0
at SQLite.SQLiteCommand.ReadCol (SQLitePCL.sqlite3_stmt stmt, System.Int32 index, SQLite.SQLite3+ColType type, System.Type clrType) [0x0010a] in <84b9c9e630fa45bd8ac799333976ebbf>:0
at SQLite.SQLiteCommand+d__121[T].MoveNext () [0x0010f] in <84b9c9e630fa45bd8ac799333976ebbf>:0 at System.Collections.Generic.List1[T].AddEnumerable (System.Collections.Generic.IEnumerable1[T] enumerable) [0x00059] in <10be834c8e6b440dad35c7b03c353d9a>:0 at System.Collections.Generic.List1[T]..ctor (System.Collections.Generic.IEnumerable1[T] collection) [0x00062] in <10be834c8e6b440dad35c7b03c353d9a>:0 at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable1[T] source) [0x00018] in <6d1458e655e44745ba53a48a4a71a5ea>:0
at SQLite.SQLiteCommand.ExecuteQuery[T] () [0x0001c] in <84b9c9e630fa45bd8ac799333976ebbf>:0
at SQLite.TableQuery`1[T].ToList () [0x0000b] in <84b9c9e630fa45bd8ac799333976ebbf>:0

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at SQLite.SQLiteCommand.ReadCol, where the stack trace shows TimeSpan.Parse failing while ExecuteQuery reads a table. Reproduce the Xamarin.Android read across versions 1.5.231 and 1.6.292 with the existing TimeSpan column, then determine how older stored values should be handled. Done means those legacy rows can be read without the reported OverflowException.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sqlite
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.