Comments (17)
I would expect your code to work (based on some existing tests) but it's quite possible there's some edge case not being correctly handled yet. Thanks for supplying a concise repro; I'll try to use it to repro the bug you describe soon.
What version of MySQL Server are you running, and on what OS?
from mysqlconnector.
OS: Mac OSX 10.11.6
MySQL 5.7.13 (current GA) running locally
dotnet core 1.0.0-preview2-003121
I will try on MySQL 5.6 shortly.
from mysqlconnector.
I just validated that I'm getting the issue with 5.6.31 as well:
https://dev.mysql.com/downloads/file/?id=463211
from mysqlconnector.
I validated a couple other things just to weed out some possibilities:
- it happens when I only select the currency column and retrieve it via ordinal 0 (such as your test)
- it happens when I change the column order to force select * to return it as ordinal 0.
from mysqlconnector.
I installed MySQL Server 5.7.13 on Mac OS X 10.10.5 but couldn't reproduce with a similar (not exactly the same) test case: 909990c (also passed on Linux).
Are you inserting the row with this connector? Using a literal statement, or using a parameterised insert? Can you verify that the DB does actually contain 85.3
(e.g., with MySQL Workbench)?
It definitely seems consistent with your currency column, but I can't figure out yet what's different.
from mysqlconnector.
It's not consistent but it's always wrong and always a really big number.
Can you give some more examples of the other bad values you get? There may be some kind of pattern in them that gives a clue to the cause of the bug.
from mysqlconnector.
It appears that the values I get back are all the same for a given run but change each run without me changing or adding anything to the database.
First run:
Second run:
Here's Workbench with the three values:
from mysqlconnector.
If you change your table creation to currency decimal(13,3) DEFAULT NULL
do you start getting larger "random" numbers, e.g., 4534471829.345?
from mysqlconnector.
I don't get larger whole numbers but the mantissa does increase to 3 digits:
from mysqlconnector.
Is it possible you could share the whole ConsoleApplication.Test
solution (e.g., attach a ZIP to this issue)?
from mysqlconnector.
Certainly!
Here's the code I'm using. I also included the SQL.
tester.zip
from mysqlconnector.
Is it possible the use of invariant culture when parsing the decimal is the problem? Mine is en-US, are you using the same? I'm just spit-balling here.
from mysqlconnector.
Thanks. I can reproduce your problem now, and I think it's a bug in the VS Code debugger.
If I add the following two lines before testItems.Add(t)
:
var currency = t.currency;
var currencyString = t.currency.ToString();
then I get the following output in the Variables window:
t.currency
has the correct value if I store it in another variable, but the property value isn't displayed accurately in VS Code. (Additionally, System.Console.WriteLine(t.currency)
also prints the expected value.) This may also explain why the value changes each time but is consistent for one run of the program (if it depends on something in the current debugging session).
from mysqlconnector.
I can reproduce the problem with one line of code: var t = new Test { id = 1, name = "Sarah", currency = 85.3m };
. (All the MySQL-related code can be deleted.)
In the Variables pane in the debugger, t.currency
shows the wrong value.
I searched vscode issues for decimal but didn't find anything. You may need to report this as a new issue to the VS Code team.
from mysqlconnector.
BTW, you can work around the bug by making currency
a public field (i.e., public decimal currency;
) instead of a property (public decimal currency {get;set;}
). This indicates to me that it might be a problem with Code correctly reading the compiler-generated backing field for the property.
Indeed, if we write the property out in full:
public decimal currency
{
get { return _currency; }
set { _currency = value; }
}
private decimal _currency;
we get the following Variable output:
from mysqlconnector.
I've filed this as microsoft/vscode#9929.
from mysqlconnector.
Thank you very much!
from mysqlconnector.
Related Issues (20)
- System.Diagnostics.DiagnosticSource HOT 1
- Transaction isolation level should not default to `REPEATABLE READ` regardless of server configuration if left unspecified HOT 3
- Use performance schema `processlist` table
- Can't obtain results from stored procedure with version 2.3.0+ and Mysql 5.1.73 HOT 2
- SSL Authentication error thrown when opening many connections in parallel HOT 7
- DbUpdateException Entries Behaves Differently When First Fails vs Others Fail HOT 3
- Read `DATE` as `DateOnly` value HOT 3
- [Question] I would like to know from which version started supporting TLS 1.3 HOT 1
- Add `MySqlDataReader.GetUtf8JsonReader` method HOT 1
- `UsePeriodicPasswordProvider` causes intermittent access denied errors HOT 1
- MySqlBulkCopy should have a BatchSize setting HOT 1
- WriteToServer throw Exception using a particular table name HOT 1
- NullReferenceException in MySqlConnector.MySqlDataReader.ActivateResultSet HOT 25
- MySqlBulkCopy Column Mappings Set HOT 6
- Cannot connect to AWS RDS Aurora 3 (Mysql8) using SslCa=<file> and SslMode=VerifyCA HOT 6
- `CommandBehavior.SchemaOnly` not working as expected. HOT 3
- Some of the "sjis" characters are not returned correctly HOT 4
- MySqlConnector.MySqlProtocolException: Packet received out-of-order. Expected 2; got 1. HOT 1
- Cannot connect to AWS RDS with new CA certs using VerifyFull HOT 4
- Rows count difference between SELECT QUERY using STRAIGHT_JOIN and not using this kind of join HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mysqlconnector.