-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Update FxCop analyzers #4800
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
Update FxCop analyzers #4800
Changes from all commits
3c5a472
24c1731
d7e7b90
e9ba026
d102362
077cb99
6197678
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -106,7 +106,7 @@ internal bool EndsEscapeSequence(char ch) | |
|
|
||
| internal bool Match(char start, char end) | ||
| { | ||
| return _endChars.IndexOf(end.ToString()) == _startChars.IndexOf(start.ToString()); | ||
| return _endChars.IndexOf(end.ToString(), StringComparison.Ordinal) == _startChars.IndexOf(start.ToString(), StringComparison.Ordinal); | ||
|
||
| } | ||
|
|
||
| internal string StartBracketCharacters | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,7 +48,7 @@ public string Name | |
| } | ||
| } | ||
|
|
||
| private string _name = null; | ||
| private string _name; | ||
| } | ||
| #endif | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -244,6 +244,9 @@ public static ValueSerializer GetSerializerFor(PropertyDescriptor descriptor, IV | |
| /// </summary> | ||
| protected Exception GetConvertToException(object value, Type destinationType) | ||
| { | ||
| if (destinationType == null) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one would already throw a NullReferenceException destinationType.FullName. By adding an explicit throw here, we make sure to throw early, with the right stacktrace and the right parameter name. This one is technically a breaking change, the type of exception returned is not the same as before. Let me know if you would prefer to revert this change.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whilst this is a breaking change indeed, these types of changes have been generally considered acceptable across the .NET ecosystem. |
||
| throw new ArgumentNullException(nameof(destinationType)); | ||
|
|
||
| string text; | ||
| if (value == null) | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -542,6 +542,9 @@ private ConcurrentDictionary<ReferenceEqualityTuple<MemberInfo, MemberInfo>, Xam | |
|
|
||
| public virtual XamlType GetXamlType(Type type) | ||
| { | ||
| if (type == null) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one would succeed in XamlLanguage.TypeAlias(type) but throw in GetXamlType. By adding an explicit throw here, we make sure to throw early, with the right stacktrace and the right parameter name. |
||
| throw new ArgumentNullException(nameof(type)); | ||
|
|
||
| return GetXamlType(type, XamlLanguage.TypeAlias(type)); | ||
| } | ||
|
|
||
|
|
@@ -683,7 +686,7 @@ internal virtual XamlMember GetAttachableEvent(string name, MethodInfo adder) | |
| #region Settings | ||
|
|
||
| // Unchanging, initialized in ctor | ||
| private readonly XamlSchemaContextSettings _settings = null; | ||
| private readonly XamlSchemaContextSettings _settings; | ||
|
|
||
| public bool SupportMarkupExtensionsWithDuplicateArity | ||
| { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be needed and it conflicts with other PackageReference when enabling analyzers in any other project than System.Xaml.