diff --git a/AutoRest/Generators/CSharp/CSharp/ClientModelExtensions.cs b/AutoRest/Generators/CSharp/CSharp/ClientModelExtensions.cs index ff5f118022781..028322670e583 100644 --- a/AutoRest/Generators/CSharp/CSharp/ClientModelExtensions.cs +++ b/AutoRest/Generators/CSharp/CSharp/ClientModelExtensions.cs @@ -136,9 +136,14 @@ private static bool ShouldValidate(this IType model) /// checks for special cases such as acronyms and article words. /// /// The given property documentation to format - /// A reference of the property documentation + /// A reference to the property documentation public static string GetFormattedPropertyDocumentation(this Property property) { + if (property == null) + { + throw new ArgumentNullException("property"); + } + if (string.IsNullOrEmpty(property.Documentation)) { return property.Documentation.EscapeXmlComment(); @@ -149,13 +154,13 @@ public static string GetFormattedPropertyDocumentation(this Property property) string firstWord = property.Documentation.TrimStart().Split(' ').First(); if (firstWord.Length <= 1) { - documentation += char.ToLower(property.Documentation[0]) + property.Documentation.Substring(1); + documentation += char.ToLower(property.Documentation[0], CultureInfo.InvariantCulture) + property.Documentation.Substring(1); } else { - documentation += firstWord.ToUpper() == firstWord + documentation += firstWord.ToUpper(CultureInfo.InvariantCulture) == firstWord ? property.Documentation - : char.ToLower(property.Documentation[0]) + property.Documentation.Substring(1); + : char.ToLower(property.Documentation[0], CultureInfo.InvariantCulture) + property.Documentation.Substring(1); } return documentation.EscapeXmlComment();