From c69d722aa2156c31c63039146652606ed46b8db6 Mon Sep 17 00:00:00 2001 From: Christopher Currens Date: Thu, 10 Dec 2015 15:55:26 -0800 Subject: [PATCH] Fix race condition in DateTimeOffsetPattern --- src/mscorlib/src/System/Globalization/DateTimeFormatInfo.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mscorlib/src/System/Globalization/DateTimeFormatInfo.cs b/src/mscorlib/src/System/Globalization/DateTimeFormatInfo.cs index 440fff5..9ce02ea 100644 --- a/src/mscorlib/src/System/Globalization/DateTimeFormatInfo.cs +++ b/src/mscorlib/src/System/Globalization/DateTimeFormatInfo.cs @@ -1244,7 +1244,7 @@ namespace System.Globalization { get { if (dateTimeOffsetPattern == null) { - dateTimeOffsetPattern = ShortDatePattern + " " + LongTimePattern; + string dateTimePattern = ShortDatePattern + " " + LongTimePattern; /* LongTimePattern might contain a "z" as part of the format string in which case we don't want to append a time zone offset */ @@ -1280,8 +1280,10 @@ namespace System.Globalization { } if (!foundZ) { - dateTimeOffsetPattern = dateTimeOffsetPattern + " zzz"; - } + dateTimePattern = dateTimePattern + " zzz"; + } + + dateTimeOffsetPattern = dateTimePattern; } return (dateTimeOffsetPattern); } -- 2.7.4