DapperLib / DapperLib/Dapper

Error parsing column 0 (Id=012eb03d-fa6c-4b00-a767-c3fef46a0325 - String) - SqlLite

Open
#1,985 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Dear,
I'm getting this error when using Dapper to retrieve data from a table that is in SqlLite, in SqlMapper.cs, line 3911


An unhandled exception occurred while processing the request.
AggregateException: One or more errors occurred. (Error parsing column 0 (Id=012eb03d-fa6c-4b00-a767-c3fef46a0325 - String))
System.Threading.Tasks.Task.ThrowIfExceptional(bool includeTaskCanceledExceptions)

DataException: Error parsing column 0 (Id=012eb03d-fa6c-4b00-a767-c3fef46a0325 - String)
Dapper.SqlMapper.ThrowDataException(Exception ex, int index, IDataReader reader, object value) in SqlMapper.cs, line 3911


Query

string q = "SELECT e.Id, e.Name, e.EmailAddress" +
" FROM EmailEmailList eel" +
" INNER JOIN Email e ON eel.EmailId = e.Id" +
" INNER JOIN EmailList el ON eel.EmailListId = el.Id" +
" WHERE el.Id = 1";

var x = _DBContext.Database.GetDbConnection().Query(q);


Class

public class Email
{
public Guid Id { get; set; } = Guid.NewGuid();
public String? Name { get; set; }
public string EmailAddress { get; set; } = null!;
public ICollection? EmailList { get; set; }
}

public class EmailEmailList
{
public Guid EmailId { get; set; }
public int EmailListId { get; set; }
}

public class EmailList
{
public int Id { get; set; }
public string Name { get; set; } = null!;
public string? Type { get; set; }
public virtual ICollection Email { get; set; } = null!;
}

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 SqlMapper.cs line 3911 and reproduce the reported Query call against the SQLite tables and Guid-valued Id. Trace how the first column is read and mapped, then check whether existing tests cover this conversion; done should identify a reproducible Dapper issue or establish that the behavior belongs to the SQLite provider or schema.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.