-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
DateOnly "off by one" column error #2072
Comments
Well that sounds very bad; I'm hiding 2.1.44 while I investigate - hopefully should have a fix out today or tomorrow |
I'm running into the same issue. I stronly feel that it is related #2051 as I had my own Perhaps it's also worth talking about that specific behaviour. Wouldn't it make more sense for Dapper to still use my own mapper, which (probably) should not have made this bug show up in my code? |
I had almost the same problem. Tell me, do you use .NET 8 with Arm64? |
well, I'm going to assume it isn't as exotic as that and is simply a "Marc is an idiot" thing; hopefully should be able to look on Friday (I've been completely snowed under) |
This is the same issue I reported in #2071 |
I have been unable to get a repro of this failing; for now I guess I have no choice except to revert that change, but if anyone who was seeing this problem could show a runnable repro against 2.1.44 (or similar affected), I'd be very grateful |
I use 2.1.37 targeting .NET 8 with no problem for DateOnly for both records and classes. I use Microsoft.Data.SqlClient 5.1.3 (accepting the security risks and will stay on it until they split-out the basic client from Azure and Identity, mainly so it doesn't require .NET framework). I don't use any custom type mapping, and I use queries like:
So, I'll stay on .37. I also use Dapper.AOT, but it doesn't support DateOnly yet. |
If the db column is defined with a time component like |
Hi, Precision of DateTime2 has no impact Microsoft SQL Server 2019 (RTM-CU25-GDR) (KB5036335) - 15.0.4360.2 (X64) Mar 19 2024 00:23:01 Copyright (C) 2019 Microsoft Corporation Enterprise Edition (64-bit) on Windows Server 2016 Standard 10.0 (Build 14393: ) (Hypervisor) Program.cs
Project File
|
Any updates on this issue? This is blocking us from upgrading to the latest version. |
I need to revisit what went wrong here. |
Hi,
Using Microsoft.Data.SqlClient 5.2.0 and Dapper 2.1.44, we've noticed an issue with the new DateOnly type support from #2051.
Using a simple class such as
and a QueryAsync with
we get an error response of
The data, returned by MS SQL Server, as a varchar and DateTime type, are as follows:
The issue seems to be that it is trying to parse column 1 as the FromDate with the value of Ed, which is in column 0. Hence the "off by one" error.
Running this with Dapper 2.1.35, using the the previous custom solution from #1715, does not have this error.
Staying on 2.1.44, if we remove
FromDate
fromPersonTest
, it works fine with just the FirstName.Changing FromDate in PersonText to a more open type, such as string, also works fine.
Changing the SQL type, as e.g., as MS SQL Date, or an int or varchar in ISO8601 format, doesn't have any effect.
The text was updated successfully, but these errors were encountered: