Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Globalization: Potential bugs due to not specifying culture in string.Format() #5765

Closed
bricelam opened this issue Jun 14, 2016 · 2 comments
Closed
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@bricelam
Copy link
Contributor

I'm running some static analysis on our codebase, and it looks like we may have some potential globalization bugs:

src\Microsoft.EntityFrameworkCore.Design.Core\Design\MigrationsOperations.cs(95): warning CA1307: Microsoft.Globalization : Because the behavior of 'string.StartsWith(string)' could vary based on the current user's locale settings, replace this call in 'MigrationsOperations.SubnamespaceFromOutputPath(string)' with a call to 'string.StartsWith(string, StringComparison)'. If the result of 'string.StartsWith(string, StringComparison)' will be displayed to the user, such as when sorting a list of items for display in a list box, specify 'StringComparison.CurrentCulture' or 'StringComparison.CurrentCultureIgnoreCase' as the 'StringComparison' parameter. If comparing case-insensitive identifiers, such as file paths, environment variables, or registry keys and values, specify 'StringComparison.OrdinalIgnoreCase'. Otherwise, if comparing case-sensitive identifiers, specify 'StringComparison.Ordinal'.
src\Microsoft.EntityFrameworkCore.Design.Core\Migrations\Design\CSharpHelper.cs(306): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, params object[])' could vary based on the current user's locale settings, replace this call in 'CSharpHelper.Literal(DateTime)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.Design.Core\Migrations\Design\CSharpHelper.cs(316): warning CA1305: Microsoft.Globalization : Because the behavior of 'int.ToString()' could vary based on the current user's locale settings, replace this call in 'CSharpHelper.Literal(int)' with a call to 'int.ToString(IFormatProvider)'. If the result of 'int.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'.
src\Microsoft.EntityFrameworkCore.Design.Core\Migrations\Design\CSharpHelper.cs(322): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, params object[])' could vary based on the current user's locale settings, replace this call in 'CSharpHelper.Literal(TimeSpan)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.Design.Core\Scaffolding\Configuration\Internal\ModelConfiguration.cs(204): warning CA1305: Microsoft.Globalization : Because the behavior of 'long.ToString()' could vary based on the current user's locale settings, replace this call in 'ModelConfiguration.AddSequenceConfigurations()' with a call to 'long.ToString(IFormatProvider)'. If the result of 'long.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'.
src\Microsoft.EntityFrameworkCore.Design.Core\Scaffolding\Configuration\Internal\ModelConfiguration.cs(212): warning CA1305: Microsoft.Globalization : Because the behavior of 'int.ToString()' could vary based on the current user's locale settings, replace this call in 'ModelConfiguration.AddSequenceConfigurations()' with a call to 'int.ToString(IFormatProvider)'. If the result of 'int.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'.
src\Microsoft.EntityFrameworkCore.Design.Core\Utilities\Internal\JsonUtility.cs(73): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object, object)' could vary based on the current user's locale settings, replace this call in 'JsonUtility.SerializeObject(object, IndentedStringBuilder)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.InMemory\ValueGeneration\Internal\InMemoryIntegerValueGenerator.cs(23): warning CA1305: Microsoft.Globalization : Because the behavior of 'Convert.ChangeType(object, Type)' could vary based on the current user's locale settings, replace this call in 'InMemoryIntegerValueGenerator<TValue>.Next(EntityEntry)' with a call to 'Convert.ChangeType(object, Type, IFormatProvider)'. If the result of 'Convert.ChangeType(object, Type, IFormatProvider)' will be based on input from the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will based on input stored and accessed by software, such as when it is loaded from disk or from a database, specify 'CultureInfo.InvariantCulture'.
src\Microsoft.EntityFrameworkCore.Relational\Extensions\RelationalLoggerExtensions.cs(65): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'RelationalLoggerExtensions.LogCommandExecuted(this ISensitiveDataLogger, DbCommand, long, long)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.Relational\Extensions\RelationalLoggerExtensions.cs(65): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, params object[])' could vary based on the current user's locale settings, replace this call in 'RelationalLoggerExtensions.LogCommandExecuted(this ISensitiveDataLogger, DbCommand, long, long)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.Relational\Extensions\RelationalLoggerExtensions.cs(68): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object, object)' could vary based on the current user's locale settings, replace this call in 'RelationalLoggerExtensions.LogCommandExecuted(this ISensitiveDataLogger, DbCommand, long, long)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.Relational\Metadata\RelationalPropertyAnnotations.cs(271): warning CA1305: Microsoft.Globalization : Because the behavior of 'Convert.ChangeType(object, Type)' could vary based on the current user's locale settings, replace this call in 'RelationalPropertyAnnotations.SetDefaultValue(object)' with a call to 'Convert.ChangeType(object, Type, IFormatProvider)'. If the result of 'Convert.ChangeType(object, Type, IFormatProvider)' will be based on input from the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will based on input stored and accessed by software, such as when it is loaded from disk or from a database, specify 'CultureInfo.InvariantCulture'.
src\Microsoft.EntityFrameworkCore.Relational\Migrations\Internal\MigrationsIdGenerator.cs(30): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'MigrationsIdGenerator.IsValidId(string)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.Relational\Migrations\Internal\MigrationsIdGenerator.cs(51): warning CA1305: Microsoft.Globalization : Because the behavior of 'DateTime.ToString(string)' could vary based on the current user's locale settings, replace this call in 'MigrationsIdGenerator.GenerateId(string)' with a call to 'DateTime.ToString(string, IFormatProvider)'. If the result of 'DateTime.ToString(string, 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'.
src\Microsoft.EntityFrameworkCore.Relational\Query\Expressions\IsNullExpression.cs(47): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'IsNullExpression.ToString()' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.Relational\Query\Expressions\PropertyParameterExpression.cs(30): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object, object)' could vary based on the current user's locale settings, replace this call in 'PropertyParameterExpression.PropertyParameterName.get()' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.Relational\Query\ExpressionVisitors\Internal\IncludeExpressionVisitor.cs(204): warning CA1304: Microsoft.Globalization : Because the behavior of 'string.ToLower()' could vary based on the current user's locale settings, replace this call in 'IncludeExpressionVisitor.CreateRelatedEntitiesLoaders<TRelatedEntitiesLoader>(IQuerySource, IEnumerable<INavigation>)' with a call to 'string.ToLower(CultureInfo)'. If the result of 'string.ToLower(CultureInfo)' will be displayed to the user, specify 'CultureInfo.CurrentCulture' as the 'CultureInfo' 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'.
src\Microsoft.EntityFrameworkCore.Relational\Query\ResultOperators\Internal\FromSqlResultOperator.cs(58): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'FromSqlResultOperator.ToString()' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.Relational\Query\Sql\DefaultQuerySqlGenerator.cs(428): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, params object[])' could vary based on the current user's locale settings, replace this call in 'DefaultQuerySqlGenerator.GenerateFromSql(string, Expression, IReadOnlyDictionary<string, object>)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.Relational\Storage\Internal\RawSqlCommandBuilder.cs(79): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, params object[])' could vary based on the current user's locale settings, replace this call in 'RawSqlCommandBuilder.Build(string, IReadOnlyList<object>)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.Relational\Storage\IRelationalParameterBuilder.cs(77,13,77,44): warning SA1614: Element parameter documentation must have text
src\Microsoft.EntityFrameworkCore.Relational\Storage\ParameterNameGenerator.cs(23): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'ParameterNameGenerator.GenerateNext()' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.Relational\Storage\RelationalCommandBuilderExtensions.cs(205,13,205,44): warning SA1614: Element parameter documentation must have text
src\Microsoft.EntityFrameworkCore.Relational\Storage\RelationalSqlGenerationHelper.cs(205): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'RelationalSqlGenerationHelper.DelimitIdentifier(string)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.Relational\Storage\RelationalSqlGenerationHelper.cs(258): warning CA1305: Microsoft.Globalization : Because the behavior of 'int.ToString()' could vary based on the current user's locale settings, replace this call in 'RelationalSqlGenerationHelper.GenerateLiteralValue(int)' with a call to 'int.ToString(IFormatProvider)'. If the result of 'int.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'.
src\Microsoft.EntityFrameworkCore.Relational\Storage\RelationalSqlGenerationHelper.cs(274): warning CA1305: Microsoft.Globalization : Because the behavior of 'short.ToString()' could vary based on the current user's locale settings, replace this call in 'RelationalSqlGenerationHelper.GenerateLiteralValue(short)' with a call to 'short.ToString(IFormatProvider)'. If the result of 'short.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'.
src\Microsoft.EntityFrameworkCore.Relational\Storage\RelationalSqlGenerationHelper.cs(290): warning CA1305: Microsoft.Globalization : Because the behavior of 'long.ToString()' could vary based on the current user's locale settings, replace this call in 'RelationalSqlGenerationHelper.GenerateLiteralValue(long)' with a call to 'long.ToString(IFormatProvider)'. If the result of 'long.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'.
src\Microsoft.EntityFrameworkCore.Relational\Storage\RelationalSqlGenerationHelper.cs(306): warning CA1305: Microsoft.Globalization : Because the behavior of 'byte.ToString()' could vary based on the current user's locale settings, replace this call in 'RelationalSqlGenerationHelper.GenerateLiteralValue(byte)' with a call to 'byte.ToString(IFormatProvider)'. If the result of 'byte.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'.
src\Microsoft.EntityFrameworkCore.Relational\Storage\RelationalSqlGenerationHelper.cs(386): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'RelationalSqlGenerationHelper.GenerateLiteralValue(char)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.Relational\Storage\RelationalSqlGenerationHelper.cs(403): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'RelationalSqlGenerationHelper.GenerateLiteralValue(string, RelationalTypeMapping)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.Relational\Storage\RelationalSqlGenerationHelper.cs(503): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'RelationalSqlGenerationHelper.GenerateLiteralValue(Guid)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.Relational\Storage\RelationalSqlGenerationHelper.cs(519): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'RelationalSqlGenerationHelper.GenerateLiteralValue(DateTime)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.Relational\Storage\RelationalSqlGenerationHelper.cs(535): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'RelationalSqlGenerationHelper.GenerateLiteralValue(DateTimeOffset)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.Relational\Storage\RelationalSqlGenerationHelper.cs(551): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'RelationalSqlGenerationHelper.GenerateLiteralValue(TimeSpan)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.Relational\Storage\RelationalTypeMapping.cs(149,13,149,32): warning SA1616: Element return value documentation must have text
src\Microsoft.EntityFrameworkCore.Sqlite.Design\Internal\SqliteDatabaseModelFactory.cs(100): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'SqliteDatabaseModelFactory.GetTables()' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.Sqlite.Design\Internal\SqliteDatabaseModelFactory.cs(140): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'SqliteDatabaseModelFactory.GetColumns()' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.Sqlite.Design\Internal\SqliteDatabaseModelFactory.cs(183): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'SqliteDatabaseModelFactory.GetIndexes()' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.Sqlite.Design\Internal\SqliteDatabaseModelFactory.cs(206): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'SqliteDatabaseModelFactory.GetIndexes()' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.Sqlite.Design\Internal\SqliteDatabaseModelFactory.cs(248): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'SqliteDatabaseModelFactory.GetForeignKeys()' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.Sqlite\Storage\Internal\SqliteSqlGenerationHelper.cs(65): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'SqliteSqlGenerationHelper.GenerateLiteralValue(DateTime)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.Sqlite\Storage\Internal\SqliteSqlGenerationHelper.cs(72): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'SqliteSqlGenerationHelper.GenerateLiteralValue(DateTimeOffset)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.SqlServer.Design\Internal\SqlServerDatabaseModelFactory.cs(219): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'SqlServerDatabaseModelFactory.GetTables()' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.SqlServer.Design\Internal\SqlServerScaffoldingModelFactory.cs(177): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object, object)' could vary based on the current user's locale settings, replace this call in 'SqlServerScaffoldingModelFactory.VisitTypeMapping(PropertyBuilder, ColumnModel)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.SqlServer.Design\Internal\SqlServerScaffoldingModelFactory.cs(226): warning CA1305: Microsoft.Globalization : Because the behavior of 'int.ToString()' could vary based on the current user's locale settings, replace this call in 'SqlServerScaffoldingModelFactory.MaxLengthQualifiedDataType(string, int?)' with a call to 'int.ToString(IFormatProvider)'. If the result of 'int.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'.
src\Microsoft.EntityFrameworkCore.SqlServer\Storage\Internal\SqlServerSqlGenerationHelper.cs(113): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'SqlServerSqlGenerationHelper.GenerateLiteralValue(string, RelationalTypeMapping)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.SqlServer\Storage\Internal\SqlServerSqlGenerationHelper.cs(113): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'SqlServerSqlGenerationHelper.GenerateLiteralValue(string, RelationalTypeMapping)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.SqlServer\Storage\Internal\SqlServerSqlGenerationHelper.cs(133): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'SqlServerSqlGenerationHelper.GenerateLiteralValue(DateTime)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.SqlServer\Storage\Internal\SqlServerSqlGenerationHelper.cs(140): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'SqlServerSqlGenerationHelper.GenerateLiteralValue(DateTimeOffset)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.SqlServer\Storage\Internal\SqlServerSqlGenerationHelper.cs(77): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'SqlServerSqlGenerationHelper.DelimitIdentifier(string)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore.SqlServer\Update\Internal\SqlServerUpdateSqlGenerator.cs(149): warning CA1305: Microsoft.Globalization : Because the behavior of 'int.ToString()' could vary based on the current user's locale settings, replace this call in 'SqlServerUpdateSqlGenerator.AppendBulkInsertWithServerValues(StringBuilder, IReadOnlyList<ModificationCommand>, int, List<ColumnModification>, List<ColumnModification>)' with a call to 'int.ToString(IFormatProvider)'. If the result of 'int.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'.
src\Microsoft.EntityFrameworkCore\Internal\InterceptingLogger.cs(61): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object, object)' could vary based on the current user's locale settings, replace this call in 'InterceptingLogger<T>.Log<TState>(LogLevel, EventId, TState, Exception, Func<TState, Exception, string>)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore\Internal\InterceptingLogger.cs(70): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object, object)' could vary based on the current user's locale settings, replace this call in 'InterceptingLogger<T>.Log<TState>(LogLevel, EventId, TState, Exception, Func<TState, Exception, string>)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore\Internal\TypeExtensions.cs(108): warning CA1305: Microsoft.Globalization : Because the behavior of 'int.Parse(string)' could vary based on the current user's locale settings, replace this call in 'TypeExtensions.ProcessNestedGenericTypes(Type, StringBuilder, bool)' with a call to 'int.Parse(string, IFormatProvider)'. If the result of 'int.Parse(string, IFormatProvider)' will be based on input from the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will based on input stored and accessed by software, such as when it is loaded from disk or from a database, specify 'CultureInfo.InvariantCulture'.
src\Microsoft.EntityFrameworkCore\Internal\TypeExtensions.cs(120): warning CA1305: Microsoft.Globalization : Because the behavior of 'int.Parse(string)' could vary based on the current user's locale settings, replace this call in 'TypeExtensions.ProcessNestedGenericTypes(Type, StringBuilder, bool)' with a call to 'int.Parse(string, IFormatProvider)'. If the result of 'int.Parse(string, IFormatProvider)' will be based on input from the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will based on input stored and accessed by software, such as when it is loaded from disk or from a database, specify 'CultureInfo.InvariantCulture'.
src\Microsoft.EntityFrameworkCore\Metadata\Internal\ForeignKey.cs(547): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, params object[])' could vary based on the current user's locale settings, replace this call in 'ForeignKey.ToString()' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore\Metadata\Internal\InternalEntityTypeBuilder.cs(1577): warning CA1305: Microsoft.Globalization : Because the behavior of 'int.ToString()' could vary based on the current user's locale settings, replace this call in 'InternalEntityTypeBuilder.CreateUniqueProperty(string, Type, InternalEntityTypeBuilder, bool?)' with a call to 'int.ToString(IFormatProvider)'. If the result of 'int.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'.
src\Microsoft.EntityFrameworkCore\Query\EntityQueryModelVisitor.cs(1078): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object)' could vary based on the current user's locale settings, replace this call in 'EntityQueryModelVisitor.IntroduceTransparentScope(IQuerySource, QueryModel, int, Type)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore\Query\ExpressionVisitors\Internal\NavigationRewritingExpressionVisitor.cs(1030): warning CA1304: Microsoft.Globalization : Because the behavior of 'string.ToLower()' could vary based on the current user's locale settings, replace this call in 'NavigationRewritingExpressionVisitor.NavigationRewritingQueryModelVisitor.SubqueryInjector.InjectSubquery(Expression, INavigation)' with a call to 'string.ToLower(CultureInfo)'. If the result of 'string.ToLower(CultureInfo)' will be displayed to the user, specify 'CultureInfo.CurrentCulture' as the 'CultureInfo' 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'.
src\Microsoft.EntityFrameworkCore\Query\ExpressionVisitors\Internal\NavigationRewritingExpressionVisitor.cs(822): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object, object)' could vary based on the current user's locale settings, replace this call in 'NavigationRewritingExpressionVisitor.BuildJoinFromNavigation(QuerySourceReferenceExpression, INavigation, IEntityType, bool, out QuerySourceReferenceExpression)' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore\Query\IncludeSpecification.cs(67): warning CA1305: Microsoft.Globalization : Because the behavior of 'string.Format(string, object, object)' could vary based on the current user's locale settings, replace this call in 'IncludeSpecification.ToString()' with a call to 'string.Format(IFormatProvider, string, params object[])'. If the result of 'string.Format(IFormatProvider, string, params object[])' 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'.
src\Microsoft.EntityFrameworkCore\ValueGeneration\HiLoValueGeneratorState.cs(76): warning CA1305: Microsoft.Globalization : Because the behavior of 'Convert.ChangeType(object, Type)' could vary based on the current user's locale settings, replace this call in 'HiLoValueGeneratorState.Next<TValue>(Func<long>)' with a call to 'Convert.ChangeType(object, Type, IFormatProvider)'. If the result of 'Convert.ChangeType(object, Type, IFormatProvider)' will be based on input from the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will based on input stored and accessed by software, such as when it is loaded from disk or from a database, specify 'CultureInfo.InvariantCulture'.
@ErikEJ
Copy link
Contributor

ErikEJ commented Jun 14, 2016

Some ??? 😄

@bricelam
Copy link
Contributor Author

bricelam commented Jun 14, 2016

I skimmed through them and most weren't too concerning. A lot were simply string interpolation used to concatenate strings. Some you'd have to add like 1,000 (or 1.000 😉) parameters with the same name to a query. But we should definitely look into them all.

@rowanmiller rowanmiller modified the milestones: 1.0.1, 1.1.0 Jun 15, 2016
ajcvickers added a commit that referenced this issue Jun 27, 2016
@rowanmiller rowanmiller changed the title Potential Globalization Bugs Potential globalization bugs (due to not specifying culture in string.Format) Jun 29, 2016
AndriySvyryd pushed a commit that referenced this issue Jul 2, 2016
@ajcvickers ajcvickers added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Jul 6, 2016
@divega divega changed the title Potential globalization bugs (due to not specifying culture in string.Format) Globalization: Potential globalization bugs due to not specifying culture in string.Format() Sep 13, 2016
@divega divega changed the title Globalization: Potential globalization bugs due to not specifying culture in string.Format() Globalization: Potential bugs due to not specifying culture in string.Format() Sep 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

No branches or pull requests

5 participants