DapperLib / DapperLib/DapperAOT
SQL Analyser failure for order by count
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 472
- Forks
- 43
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 18
Description
Describe the bug
I get DAP200 - "SQL error: Object reference not set to an instance of an object." for the following Query below.
Where are you seeing this?
- what Dapper/Dapper.StrongName version?
<PackageReference Include="Dapper" Version="2.1.35" /> - what Dapper.AOT/Dapper.Advisor version?
<PackageReference Include="Dapper.AOT" Version="1.0.31" /> - if relevant: what database backend?
Microsoft Sql Server,<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.2" />
To Reproduce
public async Task<object> MyMethod(SqlConnection connection)
{
return await connection.QueryFirst(@"
select top 1
t1.val
from Tbl1 t1
join Tbl2 t2 on t1.Id = t2.Id
group by t1.col
order by count(*) desc");
}
Expected behavior
No Error from the analyser
Additional context
As the explanation page says "I’d love to hear about it", I added this issue.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied C# reproducer using Dapper.AOT 1.0.31 and Microsoft SQL Server, then trace the DAP200 analyzer failure for the GROUP BY and ORDER BY COUNT(*) query. Confirm that the analyzer no longer reports an object-reference error while preserving the expected query analysis behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sql
- Domain
- databases, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100