-
Notifications
You must be signed in to change notification settings - Fork 356
Closed
Description
Recent FxCop versions detect the following issues:
System.Web.Http.SelfHost -> C:\dd\AspNetWebStack\bin\CodeAnalysis\System.Web.Http.SelfHost.dll
Running Code Analysis...
C:\dd\AspNetWebStack\src\System.Web.Http.WebHost\HttpControllerTypeCacheSerializer.cs(103): error CA1305: Microsoft.Globalization : Because the behavior of 'DateTime.ToString()' could vary based on the current user's locale settings, replace this call in 'HttpControllerTypeCacheSerializer.SerializeTypes(IEnumerable<Type>, TextWriter)' with a call to 'DateTime.ToString(IFormatProvider)'. If the result of 'DateTime.ToString(IFormatProvider)' will be displayed to the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will be stored and accessed by software, such as when it is persisted to disk or to a database, specify 'CultureInfo.InvariantCulture'. [C:\dd\AspNetWebStack\src\System.Web.Http.WebHost\System.Web.Http.WebHost.csproj]
Code Analysis Complete -- 1 error(s), 0 warning(s)
and
System.Web.Mvc -> C:\dd\AspNetWebStack\bin\CodeAnalysis\System.Web.Mvc.dll
Running Code Analysis...
C:\dd\AspNetWebStack\src\System.Web.Mvc\TypeCacheSerializer.cs(98): error CA1305: Microsoft.Globalization : Because the behavior of 'DateTime.ToString()' could vary based on the current user's locale settings, replace this call in 'TypeCacheSerializer.SerializeTypes(IEnumerable<Type>, TextWriter)' with a call to 'DateTime.ToString(IFormatProvider)'. If the result of 'DateTime.ToString(IFormatProvider)' will be displayed to the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will be stored and accessed by software, such as when it is persisted to disk or to a database, specify 'CultureInfo.InvariantCulture'. [C:\dd\AspNetWebStack\src\System.Web.Mvc\System.Web.Mvc.csproj]
Code Analysis Complete -- 1 error(s), 0 warning(s)
This is a correctness issue and it breaks our builds. But it turns this is not a functional problem since the affected attribute in the saved XML is ignored when the info is read back. (I incorrectly thought it was a functional issue in PR #15 discussions.)
Recommend fixing the problem rather than suppressing it. Has an easy fix and suppressions are ugly.