Skip to content

Commit 6b2de39

Browse files
Merge pull request #15 from AzureAD/MacBuildWarnings
Fixed build warnings
2 parents 8d77bda + 62eb06d commit 6b2de39

File tree

11 files changed

+31
-13
lines changed

11 files changed

+31
-13
lines changed

Microsoft.SystemForCrossDomainIdentityManagement/Microsoft.SCIM.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
<NeutralLanguage>en</NeutralLanguage>
56
</PropertyGroup>
67

78
<ItemGroup>

Microsoft.SystemForCrossDomainIdentityManagement/Protocol/Filter.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ private set
134134
string encodedValue = this.comparisonValue;
135135
foreach (KeyValuePair<string, string> encoding in Filter.ReservedCharacterEncodingsPerRfc2396.Value)
136136
{
137-
encodedValue = encodedValue.Replace(encoding.Key, encoding.Value);
137+
encodedValue = encodedValue.Replace(encoding.Key, encoding.Value, StringComparison.InvariantCulture);
138138
}
139139
this.comparisonValueEncoded = encodedValue;
140140
}
@@ -185,7 +185,7 @@ private static IReadOnlyDictionary<string, string> InitializeReservedCharacter39
185185
new Dictionary<string, string>(Filter.ReservedCharactersPerRfc3986.Value.Length);
186186
foreach (char character in Filter.ReservedCharactersPerRfc3986.Value)
187187
{
188-
string from = character.ToString();
188+
string from = character.ToString(CultureInfo.InvariantCulture);
189189
string to = HttpUtility.UrlEncode(from);
190190
result.Add(from, to);
191191
}
@@ -299,7 +299,7 @@ public static string ToString(IReadOnlyCollection<IFilter> filters)
299299
Filter clone = new Filter(filter);
300300
clone.ComparisonValue = placeholder;
301301
string currentFilter = clone.Serialize();
302-
string encodedFilter = HttpUtility.UrlEncode(currentFilter).Replace(placeholder, filter.ComparisonValueEncoded);
302+
string encodedFilter = HttpUtility.UrlEncode(currentFilter).Replace(placeholder, filter.ComparisonValueEncoded, StringComparison.InvariantCulture);
303303
if (string.IsNullOrWhiteSpace(allFilters))
304304
{
305305
allFilters =
@@ -333,6 +333,10 @@ public static string ToString(IReadOnlyCollection<IFilter> filters)
333333

334334
public static bool TryParse(string filterExpression, out IReadOnlyCollection<IFilter> filters)
335335
{
336+
if(filterExpression == null)
337+
{
338+
throw new ArgumentNullException(nameof(filterExpression));
339+
}
336340
string expression = filterExpression.Trim().Unquote();
337341
try
338342
{

Microsoft.SystemForCrossDomainIdentityManagement/Protocol/FilterExpression.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,9 @@ private int Group
225225
CultureInfo.InvariantCulture,
226226
SystemForCrossDomainIdentityManagementProtocolResources.ExceptionInvalidFilterTemplate,
227227
this.Text);
228+
#pragma warning disable CA1303 // Do not pass literals as localized parameters
228229
throw new ArgumentOutOfRangeException(message, nameof(this.Group));
230+
#pragma warning restore CA1303 // Do not pass literals as localized parameters
229231
}
230232
this.groupValue = value;
231233
}
@@ -247,7 +249,9 @@ private int Level
247249
CultureInfo.InvariantCulture,
248250
SystemForCrossDomainIdentityManagementProtocolResources.ExceptionInvalidFilterTemplate,
249251
this.Text);
252+
#pragma warning disable CA1303 // Do not pass literals as localized parameters
250253
throw new ArgumentOutOfRangeException(message, nameof(this.Level));
254+
#pragma warning restore CA1303 // Do not pass literals as localized parameters
251255
}
252256
this.levelValue = value;
253257
}
@@ -604,7 +608,7 @@ private void Initialize(Group left, Group @operator, Group right)
604608
}
605609

606610
string nextExpression = remainder.Substring(indexNextFilter);
607-
int indexClosingBracket = remainder.IndexOf(FilterExpression.BracketClose);
611+
int indexClosingBracket = remainder.IndexOf(FilterExpression.BracketClose, StringComparison.InvariantCulture);
608612
int nextExpressionLevel;
609613
int nextExpressionGroup;
610614
if (indexClosingBracket >= 0 && indexClosingBracket < indexLogicalOperator)
@@ -738,7 +742,7 @@ private static bool TryParse(string input, out string comparisonValue)
738742
}
739743
else
740744
{
741-
int index = input.IndexOf(FilterExpression.Space);
745+
int index = input.IndexOf(FilterExpression.Space, StringComparison.InvariantCulture);
742746
if (index >= 0)
743747
{
744748
// If unquoted string comparison values were to be rejected,

Microsoft.SystemForCrossDomainIdentityManagement/Protocol/Path.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public static bool TryParse(string pathExpression, out IPath path)
157157
buffer.SchemaIdentifier = schemaIdentifier;
158158
}
159159

160-
int seperatorIndex = expression.IndexOf(Path.SeperatorAttributes);
160+
int seperatorIndex = expression.IndexOf(Path.SeperatorAttributes, StringComparison.InvariantCulture);
161161
if (seperatorIndex >= 0)
162162
{
163163
string valuePathExpression = expression.Substring(seperatorIndex + 1);

Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ProtocolExtensions.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,9 +1235,11 @@ public static async Task<string> SerializeAsync(this HttpRequestMessage request,
12351235
TextWriter textWriter = null;
12361236
try
12371237
{
1238-
#pragma warning disable IDE0068 // Use recommended dispose pattern
1238+
1239+
#pragma warning disable CA2000 // Dispose objects before losing scope
12391240
textWriter = new StringWriter(buffer);
1240-
#pragma warning restore IDE0068 // Use recommended dispose pattern
1241+
#pragma warning restore CA2000 // Dispose objects before losing scope
1242+
12411243
IHttpRequestMessageWriter requestWriter = null;
12421244
try
12431245
{
@@ -1277,7 +1279,7 @@ public static async Task<string> SerializeAsync(this HttpRequestMessage request)
12771279
throw new ArgumentNullException(nameof(request));
12781280
}
12791281

1280-
string result = await request.SerializeAsync(false);
1282+
string result = await request.SerializeAsync(false).ConfigureAwait(false);
12811283
return result;
12821284
}
12831285

Microsoft.SystemForCrossDomainIdentityManagement/Protocol/Query.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public override string ToString()
133133
string result = parameters.ToString();
134134
foreach (KeyValuePair<string, string> placeholder in placeHolders)
135135
{
136-
result = result.Replace(placeholder.Key, placeholder.Value);
136+
result = result.Replace(placeholder.Key, placeholder.Value, StringComparison.InvariantCulture);
137137
}
138138
return result;
139139
}

Microsoft.SystemForCrossDomainIdentityManagement/Protocol/ResourceIdentifier.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ public override bool Equals(object obj)
6969

7070
public override int GetHashCode()
7171
{
72-
int identifierCode = string.IsNullOrWhiteSpace(this.Identifier) ? 0 : this.Identifier.GetHashCode();
73-
int schemaIdentifierCode = string.IsNullOrWhiteSpace(this.SchemaIdentifier) ? 0 : this.SchemaIdentifier.GetHashCode();
72+
int identifierCode = string.IsNullOrWhiteSpace(this.Identifier) ? 0 : this.Identifier.GetHashCode(StringComparison.InvariantCulture);
73+
int schemaIdentifierCode = string.IsNullOrWhiteSpace(this.SchemaIdentifier) ? 0 : this.SchemaIdentifier.GetHashCode(StringComparison.InvariantCulture);
7474
int result = identifierCode ^ schemaIdentifierCode;
7575
return result;
7676
}

Microsoft.SystemForCrossDomainIdentityManagement/Protocol/SchematizedJsonDeserializingFactory.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,12 @@ private static bool TryCreatePatchRequest2Compliant(
254254
{
255255
throw;
256256
}
257+
#pragma warning disable CA1031 // Do not catch general exception types
257258
catch
258259
{
259260
return false;
260261
}
262+
#pragma warning restore CA1031 // Do not catch general exception types
261263

262264
return true;
263265
}
@@ -289,10 +291,12 @@ private bool TryCreatePatchRequest2Legacy(
289291
{
290292
throw;
291293
}
294+
#pragma warning disable CA1031 // Do not catch general exception types
292295
catch
293296
{
294297
return false;
295298
}
299+
#pragma warning restore CA1031 // Do not catch general exception types
296300

297301
return true;
298302
}

Microsoft.SystemForCrossDomainIdentityManagement/Schemas/AttributeDataType.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Microsoft.SCIM
66
{
7+
[System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1720:Identifier contains type name", Justification = "Enum of type names will contain type names")]
78
public enum AttributeDataType
89
{
910
String,

Microsoft.SystemForCrossDomainIdentityManagement/Schemas/ConfigurationFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ public abstract class ConfigurationFactory<TConfiguration, TException>
1111
{
1212
public abstract TConfiguration Create(
1313
Lazy<TConfiguration> defaultConfiguration,
14-
out TException error);
14+
out TException configurationError);
1515
}
1616
}

0 commit comments

Comments
 (0)