Bug 10206 - Bug in UpdateAutoIncrementValue
Summary: Bug in UpdateAutoIncrementValue
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Data ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2013-02-11 08:34 UTC by Allie Miller
Modified: 2013-08-23 09:50 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Allie Miller 2013-02-11 08:34:00 UTC
We found a bug in System.Data.DataColumn.

The method

internal void UpdateAutoIncrementValue (long value64)
if (_autoIncrementStep > 0) {
if (value64 >= _nextAutoIncrementValue) {
_nextAutoIncrementValue = value64;
AutoIncrementValue ();
} else if (value64 <= _nextAutoIncrementValue) {
AutoIncrementValue ();

is missing _nextAutoIncrementValue = value64. So if value64 is -6 and _nextAutoIncrementValue is -2, then it goes to -3 instead of -7 as expected.
Comment 1 PJ 2013-08-23 09:50:19 UTC
Looks like this is applied in https://github.com/mono/mono/blob/master/mcs/class/System.Data/System.Data/DataColumn.cs:294

Done by msafar 6 months ago: https://github.com/mono/mono/commit/81c5020bea6f023f5a81df998c5b36dba7544ee7

This is fix is applied in all available mono versions.