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

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

Open
rfiori opened this issue Oct 17, 2023 · 6 comments

Comments

@rfiori
Copy link

rfiori commented Oct 17, 2023

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!;
}

@mgravell
Copy link
Member

I thought guid parsed - I'll check when I get a second. What runtime/framework is this, out of curiosity?

@rfiori
Copy link
Author

rfiori commented Oct 17, 2023

I use ASP Net Core 7 / EF Core 7

Thanks for your time.

@Gondlir
Copy link

Gondlir commented Mar 24, 2024

I get the same error but using DateTime in my class and using Postgree to do the query. Th error is parsing my column that is a DateTime and when particularly i do a pagination in the query to bring 100 registers. From 10 to 50 at least it works fine, but then when I search for 100 register it breaks whit this same error.
.NET 8 with arm64

@rlrecalde
Copy link

This guid problem is still present on last version 2.1.44 no matter the database provider.

By the way, is it possible that QueryAsync() method does not have "buffered" parameter? Is this an issue?
(Sorry, it has nothing to do with guid but I didn't want to open a new issue. Just asking)

@mgravell
Copy link
Member

It is not possible to unify the async buffered/unbuffered API efficiently; see: QueryUnbufferedAsync

@rlrecalde
Copy link

Ok, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants