DapperLib / DapperLib/Dapper

Microsoft.Data.Sqlite and Guid column

Open
#718 20 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:typehandlers db:sqlite
Dominant language
C#
Stars
18.4k
Forks
3.7k
Avg merge
5h 8m
Merged PRs (30d)
1

Description

Hi there! I'm using dapper in my .net core library and have previously tested with SqlServer & LocalDb. I just switched to Sqllite and Guid id columns seem to not be working with the message:

Unable to cast object of type 'System.Byte[]' to type 'System.Guid'

See full stack trace below:

InvalidOperationException: Error parsing column 0 (Id=System.Byte[] - Object)
  Dapper.SqlMapper.ThrowDataException(Exception ex, int index, IDataReader reader, object value)
  Deserialize45afa75f-34ca-4996-b0bd-653743fbf96d(IDataReader )
  Dapper.SqlMapper+<QueryImpl>d__124.MoveNext()
  System.Collections.Generic.List..ctor(IEnumerable<T> collection)
  System.Linq.Enumerable.ToList<TSource>(IEnumerable<TSource> source)
  Dapper.SqlMapper.Query<T>(IDbConnection cnn, string sql, object param, IDbTransaction transaction, bool buffered, Nullable<int> commandTimeout, Nullable<CommandType> commandType)

Regards

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 by reproducing the reported Guid-column query with Microsoft.Data.Sqlite and the Dapper usage described in the issue, then inspect the full stack trace and existing SQLite handling. Done means Guid ID columns can be read without the reported Byte[]-to-Guid cast failure.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.