From: Jan Kotas Date: Wed, 18 Jan 2017 16:58:03 +0000 (-0800) Subject: Rollback parameter name change to fix failing corefx tests (dotnet/coreclr#8985) X-Git-Tag: submit/tizen/20210909.063632~11030^2~8421 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7c4f9c7c4f2e0a98427c765319d30c7524c25de2;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Rollback parameter name change to fix failing corefx tests (dotnet/coreclr#8985) Commit migrated from https://github.com/dotnet/coreclr/commit/d3c7ce0c11eb79e33195ab9c1bee94bfe2f6738e --- diff --git a/src/coreclr/src/mscorlib/src/System/DateTime.cs b/src/coreclr/src/mscorlib/src/System/DateTime.cs index 7216047..2834825 100644 --- a/src/coreclr/src/mscorlib/src/System/DateTime.cs +++ b/src/coreclr/src/mscorlib/src/System/DateTime.cs @@ -461,7 +461,12 @@ namespace System { // parts of the result are the same as those of this DateTime. // public DateTime AddYears(int value) { - if (value < -10000 || value > 10000) throw new ArgumentOutOfRangeException(nameof(value), Environment.GetResourceString("ArgumentOutOfRange_DateTimeBadYears")); + if (value < -10000 || value > 10000) + { + // DateTimeOffset.AddYears(int years) is implemented on top of DateTime.AddYears(int value). Use the more appropriate + // parameter name out of the two for the exception. + throw new ArgumentOutOfRangeException("years", Environment.GetResourceString("ArgumentOutOfRange_DateTimeBadYears")); + } Contract.EndContractBlock(); return AddMonths(value * 12); }