DapperLib / DapperLib/Dapper

Wrong constructor signature detection when using Microsoft.Data.Sqlite

Open
#1,057 0 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

The types are not correctly identified when I use System.Data.Sqlite in my .NET Core project.
My code works when I use System.Data.Sqlite (which does not target .NET Standard 2.0, so won't work on any system)

According to the exception it expect a constructor with Int32 parameters. But my Sqlite table contains INTEGER and REAL values, not only integer.

Correct signature is : (long targetId, long id, long filterIndex, long binning, double duration, long number, long completed)

System.InvalidOperationException : A parameterless default constructor or one matching signature (System.Int32 TargetId, System.Int32 Id, System.Int32 FilterIndex, System.Int32 Binning, System.Int32 Duration, System.Int32 Number, System.Int32 Completed) is required for (...)Sequence materialization at Dapper.SqlMapper.GetTypeDeserializerImpl(Type type, IDataReader reader, Int32 startBound, Int32 length, Boolean returnNullIfFirstMissing) in C:\projects\dapper\Dapper\SqlMapper.cs:line 3157 at Dapper.SqlMapper.TypeDeserializerCache.GetReader(IDataReader reader, Int32 startBound, Int32 length, Boolean returnNullIfFirstMissing) in C:\projects\dapper\Dapper\SqlMapper.TypeDeserializerCache.cs:line 153 at Dapper.SqlMapper.TypeDeserializerCache.GetReader(Type type, IDataReader reader, Int32 startBound, Int32 length, Boolean returnNullIfFirstMissing) in C:\projects\dapper\Dapper\SqlMapper.TypeDeserializerCache.cs:line 50 at Dapper.SqlMapper.GetDeserializer(Type type, IDataReader reader, Int32 startBound, Int32 length, Boolean returnNullIfFirstMissing) in C:\projects\dapper\Dapper\SqlMapper.cs:line 1787 at Dapper.SqlMapper.GenerateDeserializers(Type[] types, String splitOn, IDataReader reader) in C:\projects\dapper\Dapper\SqlMapper.cs:line 1629 at Dapper.SqlMapper.<MultiMapImpl>d__153`8.MoveNext() in C:\projects\dapper\Dapper\SqlMapper.cs:line 1432 at System.Collections.Generic.List`1.AddEnumerable(IEnumerable`1 enumerable) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at Dapper.SqlMapper.MultiMap[TFirst,TSecond,TThird,TFourth,TFifth,TSixth,TSeventh,TReturn](IDbConnection cnn, String sql, Delegate map, Object param, IDbTransaction transaction, Boolean buffered, String splitOn, Nullable`1 commandTimeout, Nullable`1 commandType) in C:\projects\dapper\Dapper\SqlMapper.cs:line 1404 ...

I don't know if the problem come from Dapper or from Microsoft.Data.Sqlite

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 constructor-signature error with Microsoft.Data.Sqlite, then inspect SqlMapper.GetTypeDeserializerImpl and TypeDeserializerCache.GetReader in the stack trace. Compare the reported parameter types with the provider's reader metadata and determine whether the mismatch is in Dapper or Microsoft.Data.Sqlite. Done means a regression test covers the reported signature and the correct constructor types are detected.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sqlite
Domain
backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.