Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SqliteParameter.SqliteType throws InvalidOperationException for DateOnly/TimeOnly #27484

Closed
inosik opened this issue Feb 21, 2022 · 3 comments
Closed

Comments

@inosik
Copy link

inosik commented Feb 21, 2022

The SqliteParameter.SqliteType Property throws an InvalidOperationException when the value is a DateOnly or TimeOnly.

var p = new SqliteParameter { ParameterName = "date", Value = new DateOnly() };
_ = p.SqliteType;
System.InvalidOperationException: No mapping exists from object type System.DateOnly to a known managed provider native type.
   at Microsoft.Data.Sqlite.SqliteValueBinder.GetSqliteType(Object value)
   at Microsoft.Data.Sqlite.SqliteParameter.get_SqliteType()

DateOnly and TimeOnly are missing here:

private static readonly Dictionary<Type, SqliteType> _sqliteTypeMapping =

Version information

Microsoft.Data.Sqlite version: 6.0.2, 7.0.0-preview.1.22076.6
Target framework: .NET 6.0
Operating system: n/a

@inosik inosik changed the title SqliteParameter.SqliteType throw InvalidOperationException for DateOnly/TimeOnly SqliteParameter.SqliteType throws InvalidOperationException for DateOnly/TimeOnly Feb 21, 2022
@roji
Copy link
Member

roji commented Feb 23, 2022

Duplicate of #27213

@roji roji marked this as a duplicate of #27213 Feb 23, 2022
@roji
Copy link
Member

roji commented Feb 23, 2022

This is already fixed in PR #27291, which closes #27213.

@inosik
Copy link
Author

inosik commented Feb 23, 2022

Thanks for pointing this out. Somehow I overlooked the open PR.

@inosik inosik closed this as completed Feb 23, 2022
@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants