Avoid allocations in CanWrap... methods#3711
Avoid allocations in CanWrap... methods#3711sharwell merged 4 commits intoDotNetAnalyzers:masterfrom
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #3711 +/- ##
==========================================
+ Coverage 93.12% 93.13% +0.01%
==========================================
Files 1088 1088
Lines 114954 115026 +72
Branches 4088 4113 +25
==========================================
+ Hits 107047 107126 +79
+ Misses 6865 6860 -5
+ Partials 1042 1040 -2 |
|
Is it still benefitial to use GetOrAdd after having checked with TryGetValue, or would it be even better to simply call TryAdd instead, to not need to capture any variables at all and get rid of the local function? |
|
Answering myself: Since the local function in your code is rarely called, I assume there will be no practical difference in performance. But maybe it would be better with the simpler code, for readability? Just a thought. |
| return false; | ||
| } | ||
|
|
||
| ConcurrentDictionary<Type, bool> wrappedObject = SupportedObjectWrappers.GetOrAdd(underlyingType, _ => new ConcurrentDictionary<Type, bool>()); |
There was a problem hiding this comment.
Was there an actual problem with this first lookup (in each method)? I haven't dug into your IL comparison, but since no capture is needed, it seems the only possible overhead would be creating the func instance. I think I recall that lambdas are automatically detected to be static if possible, but in case that is not correct, wouldn't simply marking the lambda as static be the best change?
ConcurrentDictionary<Type, bool> wrappedObject = SupportedObjectWrappers.GetOrAdd(underlyingType, static _ => new ConcurrentDictionary<Type, bool>());
There was a problem hiding this comment.
The IL confirmed that the delegate instance is indeed cached between calls in a static field:
// Load the delegate instance from a static field
IL_0033: ldsfld class System.Func`2<System.Type, ConcurrentDictionary`2<SyntaxKind, bool>> StyleCop.Analyzers.Lightup.LightupHelpers/'<>c'::'<>9__30_0'
IL_0038: dup
// Branch if not null?
IL_0039: brtrue.s IL_0052
IL_003b: pop
// ..
// Create the delegate
IL_0047: newobj instance void class System.Func`2<System.Type, ConcurrentDictionary`2<SyntaxKind, bool>>::.ctor(object, native int)
IL_004c: dup
// Store it
IL_004d: stsfld class System.Func`2<System.Type, ConcurrentDictionary`2<SyntaxKind, bool>> StyleCop.Analyzers.Lightup.LightupHelpers/'<>c'::'<>9__30_0'
// Invoke the delegate
IL_0052: callvirt instance !1/*class [System.Collections.Concurrent]System.Collections.Concurrent.ConcurrentDictionary`2<valuetype [Microsoft.CodeAnalysis.CSharp]Microsoft.CodeAnalysis.CSharp.SyntaxKind, bool>*/ class [System.Collections.Concurrent]System.Collections.Concurrent.ConcurrentDictionary`2<class [System.Runtime]System.Type, class [System.Collections.Concurrent]System.Collections.Concurrent.ConcurrentDictionary`2<valuetype [Microsoft.CodeAnalysis.CSharp]Microsoft.CodeAnalysis.CSharp.SyntaxKind, bool>>::GetOrAdd(!0/*class [System.Runtime]System.Type*/, class [System.Runtime]System.Func`2<!0/*class [System.Runtime]System.Type*/, !1/*class [System.Collections.Concurrent]System.Collections.Concurrent.ConcurrentDictionary`2<valuetype [Microsoft.CodeAnalysis.CSharp]Microsoft.CodeAnalysis.CSharp.SyntaxKind, bool>*/>)
This is indeed better. It works in this case because the cached value is a bool (value type). For the |
| return false; | ||
| } | ||
|
|
||
| ConcurrentDictionary<Type, bool> wrappedObject = SupportedObjectWrappers.GetOrAdd(underlyingType, _ => new ConcurrentDictionary<Type, bool>()); |
There was a problem hiding this comment.
📝 This line does not need to change.
There was a problem hiding this comment.
I just kept the static to emphasize the non-capturing semantic of the lambda.
|
|
||
| ConcurrentDictionary<Type, bool> wrappedObject = SupportedObjectWrappers.GetOrAdd(underlyingType, _ => new ConcurrentDictionary<Type, bool>()); | ||
|
|
||
| // Avoid creating the delegate if the value already exists |
There was a problem hiding this comment.
📝 This comment is sufficient for the method (it already states the complete intent, and it's just a simple bug that we didn't adhere to it)
| { | ||
| canCast = wrappedObject.GetOrAdd( | ||
| obj.GetType(), | ||
| kind => underlyingType.GetTypeInfo().IsAssignableFrom(obj.GetType().GetTypeInfo())); |
There was a problem hiding this comment.
📝 This line is the source of the capturing allocation (specifically, capturing a method parameter in a lambda forces the the capture to be allocated on all paths and not just the one that creates this delegate).
| canCast = underlyingType.GetTypeInfo().IsAssignableFrom(obj.GetType().GetTypeInfo()); | ||
| wrappedObject.TryAdd(obj.GetType(), canCast); |
There was a problem hiding this comment.
❗ Requesting that this pull request be reduced to just this two line change in each case.
|
@sharwell Merging failed due to some (unrelated?) build error. |
|
I consider myself unlucky when it comes to these builds, but you are on another level :-) I think that you got all the "usual" random build errors plus one that I don't think I have ever seen. There are however some new commits on master, so you can merge those and push again. Maybe fifth time is the charm? Otherwise I hope that @sharwell can merge this anyway. |
|
I'll just restart the build. Merging from master will turn off the auto merge. |
…20) [](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [StyleCop.Analyzers](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers) | `1.2.0-beta.507` -> `1.2.0-beta.556` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>DotNetAnalyzers/StyleCopAnalyzers (StyleCop.Analyzers)</summary> ### [`v1.2.0-beta.556`](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/releases/tag/1.2.0-beta.556) [Compare Source](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/compare/1.2.0-beta.553...1.2.0-beta.556) #### What's Changed - Update SA1011 to forbid trailing space before the end of a switch case by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3674](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3674) - Rewrite IOperationWrapper as a wrapper structure around IOperation by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3611](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3611) - Update SA1202 to support interfaces (C# 8) and records (C# 9, 10) by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3694](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3694) - Update documentation for SA1308 to also mention prefix "t\_" by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3697](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3697) - Update SA1642 and its code fix to handle record structs correctly by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3696](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3696) - Update dependencies by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3700](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3700) - Mark several test classes as partial by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3702](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3702) - Add missing test files and fix inheritance by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3703](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3703) - Generate and validate derived test classes by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3704](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3704) - Update SA1011 to not require space before a range operator by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3709](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3709) - Update SA1131 to treat methods as constants by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3710](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3710) - Avoid allocations in CanWrap... methods by [@​martin-strecker-sonarsource](https://togithub.com/martin-strecker-sonarsource) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3711](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3711) - Update SA1648 to accept inheritdoc on members implemented from static abstract/virtual interface members by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3715](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3715) - Update SA1600 to also handle records by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3725](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3725) - Update SA1119 to allow parenthesis around a ref ternary conditional expression when it is the left-hand side of an assigment by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3737](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3737) - Update SA1119 to allow parenthesized switch expressions followed by an invocation by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3733](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3733) - Add c# 12 test project by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3734](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3734) - Run tests in parallel jobs by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3740](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3740) - Update SA1010 to accept whitespace before collection initializers by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3745](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3745) - Update SA1513 to not require a blank line if the closing brace is at the end of a collection expression by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3746](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3746) - Update SA1118 to allow multi-line collection expressions by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3749](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3749) - Update SA1009 to require a space after the closing parenthesis if it is followed by ++ or -- from a prefix unary expression by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3750](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3750) - Update SA1008 to allow space before the opening parenthesis of a using alias definition of a tuple type by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3748](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3748) - Update documentation for SA1102 to contain compilable code examples by [@​arphox](https://togithub.com/arphox) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3755](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3755) - Update SA1008 to not crash if there is no previous token by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3741](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3741) - Change default value of test property CodeActionValidationMode to SemanticStructure instead of None and update so that tests still pass by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3753](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3753) - Allow inheritdoc for class constructors with base types by [@​MartyIX](https://togithub.com/MartyIX) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3719](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3719) - Fix that SA1134 Fix All maybe non-deterministic by [@​pdelvo](https://togithub.com/pdelvo) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/2853](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/2853) - Coverage improvements by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3675](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3675) - Fix SA1131 to not treat "complex" expressions as a literal by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3760](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3760) #### New Contributors - [@​martin-strecker-sonarsource](https://togithub.com/martin-strecker-sonarsource) made their first contribution in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3711](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3711) - [@​arphox](https://togithub.com/arphox) made their first contribution in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3755](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3755) - [@​MartyIX](https://togithub.com/MartyIX) made their first contribution in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3719](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3719) **Full Changelog**: DotNetAnalyzers/StyleCopAnalyzers@1.2.0-beta.507...1.2.0-beta.556 ### [`v1.2.0-beta.553`](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/releases/tag/1.2.0-beta.553) [Compare Source](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/compare/1.2.0-beta.507...1.2.0-beta.553) ##### What's Changed - Update SA1011 to forbid trailing space before the end of a switch case by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3674](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3674) - Rewrite IOperationWrapper as a wrapper structure around IOperation by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3611](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3611) - Update SA1202 to support interfaces (C# 8) and records (C# 9, 10) by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3694](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3694) - Update documentation for SA1308 to also mention prefix "t\_" by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3697](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3697) - Update SA1642 and its code fix to handle record structs correctly by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3696](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3696) - Update dependencies by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3700](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3700) - Mark several test classes as partial by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3702](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3702) - Add missing test files and fix inheritance by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3703](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3703) - Generate and validate derived test classes by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3704](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3704) - Update SA1011 to not require space before a range operator by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3709](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3709) - Update SA1131 to treat methods as constants by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3710](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3710) - Avoid allocations in CanWrap... methods by [@​martin-strecker-sonarsource](https://togithub.com/martin-strecker-sonarsource) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3711](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3711) - Update SA1648 to accept inheritdoc on members implemented from static abstract/virtual interface members by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3715](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3715) - Update SA1600 to also handle records by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3725](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3725) - Update SA1119 to allow parenthesis around a ref ternary conditional expression when it is the left-hand side of an assigment by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3737](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3737) - Update SA1119 to allow parenthesized switch expressions followed by an invocation by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3733](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3733) - Add c# 12 test project by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3734](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3734) - Run tests in parallel jobs by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3740](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3740) - Update SA1010 to accept whitespace before collection initializers by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3745](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3745) - Update SA1513 to not require a blank line if the closing brace is at the end of a collection expression by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3746](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3746) - Update SA1118 to allow multi-line collection expressions by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3749](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3749) - Update SA1009 to require a space after the closing parenthesis if it is followed by ++ or -- from a prefix unary expression by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3750](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3750) - Update SA1008 to allow space before the opening parenthesis of a using alias definition of a tuple type by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3748](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3748) - Update documentation for SA1102 to contain compilable code examples by [@​arphox](https://togithub.com/arphox) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3755](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3755) - Update SA1008 to not crash if there is no previous token by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3741](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3741) - Change default value of test property CodeActionValidationMode to SemanticStructure instead of None and update so that tests still pass by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3753](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3753) - Allow inheritdoc for class constructors with base types by [@​MartyIX](https://togithub.com/MartyIX) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3719](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3719) - Fix that SA1134 Fix All maybe non-deterministic by [@​pdelvo](https://togithub.com/pdelvo) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/2853](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/2853) - Coverage improvements by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3675](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3675) ##### New Contributors - [@​martin-strecker-sonarsource](https://togithub.com/martin-strecker-sonarsource) made their first contribution in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3711](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3711) - [@​arphox](https://togithub.com/arphox) made their first contribution in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3755](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3755) - [@​MartyIX](https://togithub.com/MartyIX) made their first contribution in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3719](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3719) **Full Changelog**: DotNetAnalyzers/StyleCopAnalyzers@1.2.0-beta.507...1.2.0-beta.553 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "after 9pm,before 6am" in timezone Europe/Zurich, Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/smartive/cas-fee-adv-mumble-api). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMDMuMSIsInVwZGF0ZWRJblZlciI6IjM3LjEwMy4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…591) [](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [StyleCop.Analyzers](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers) | `1.2.0-beta.507` -> `1.2.0-beta.556` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>DotNetAnalyzers/StyleCopAnalyzers (StyleCop.Analyzers)</summary> ### [`v1.2.0-beta.556`](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/releases/tag/1.2.0-beta.556) [Compare Source](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/compare/1.2.0-beta.553...1.2.0-beta.556) #### What's Changed - Update SA1011 to forbid trailing space before the end of a switch case by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3674](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3674) - Rewrite IOperationWrapper as a wrapper structure around IOperation by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3611](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3611) - Update SA1202 to support interfaces (C# 8) and records (C# 9, 10) by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3694](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3694) - Update documentation for SA1308 to also mention prefix "t\_" by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3697](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3697) - Update SA1642 and its code fix to handle record structs correctly by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3696](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3696) - Update dependencies by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3700](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3700) - Mark several test classes as partial by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3702](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3702) - Add missing test files and fix inheritance by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3703](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3703) - Generate and validate derived test classes by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3704](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3704) - Update SA1011 to not require space before a range operator by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3709](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3709) - Update SA1131 to treat methods as constants by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3710](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3710) - Avoid allocations in CanWrap... methods by [@​martin-strecker-sonarsource](https://togithub.com/martin-strecker-sonarsource) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3711](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3711) - Update SA1648 to accept inheritdoc on members implemented from static abstract/virtual interface members by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3715](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3715) - Update SA1600 to also handle records by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3725](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3725) - Update SA1119 to allow parenthesis around a ref ternary conditional expression when it is the left-hand side of an assigment by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3737](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3737) - Update SA1119 to allow parenthesized switch expressions followed by an invocation by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3733](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3733) - Add c# 12 test project by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3734](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3734) - Run tests in parallel jobs by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3740](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3740) - Update SA1010 to accept whitespace before collection initializers by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3745](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3745) - Update SA1513 to not require a blank line if the closing brace is at the end of a collection expression by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3746](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3746) - Update SA1118 to allow multi-line collection expressions by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3749](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3749) - Update SA1009 to require a space after the closing parenthesis if it is followed by ++ or -- from a prefix unary expression by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3750](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3750) - Update SA1008 to allow space before the opening parenthesis of a using alias definition of a tuple type by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3748](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3748) - Update documentation for SA1102 to contain compilable code examples by [@​arphox](https://togithub.com/arphox) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3755](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3755) - Update SA1008 to not crash if there is no previous token by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3741](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3741) - Change default value of test property CodeActionValidationMode to SemanticStructure instead of None and update so that tests still pass by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3753](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3753) - Allow inheritdoc for class constructors with base types by [@​MartyIX](https://togithub.com/MartyIX) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3719](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3719) - Fix that SA1134 Fix All maybe non-deterministic by [@​pdelvo](https://togithub.com/pdelvo) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/2853](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/2853) - Coverage improvements by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3675](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3675) - Fix SA1131 to not treat "complex" expressions as a literal by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3760](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3760) #### New Contributors - [@​martin-strecker-sonarsource](https://togithub.com/martin-strecker-sonarsource) made their first contribution in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3711](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3711) - [@​arphox](https://togithub.com/arphox) made their first contribution in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3755](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3755) - [@​MartyIX](https://togithub.com/MartyIX) made their first contribution in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3719](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3719) **Full Changelog**: DotNetAnalyzers/StyleCopAnalyzers@1.2.0-beta.507...1.2.0-beta.556 ### [`v1.2.0-beta.553`](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/releases/tag/1.2.0-beta.553) [Compare Source](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/compare/1.2.0-beta.507...1.2.0-beta.553) ##### What's Changed - Update SA1011 to forbid trailing space before the end of a switch case by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3674](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3674) - Rewrite IOperationWrapper as a wrapper structure around IOperation by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3611](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3611) - Update SA1202 to support interfaces (C# 8) and records (C# 9, 10) by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3694](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3694) - Update documentation for SA1308 to also mention prefix "t\_" by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3697](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3697) - Update SA1642 and its code fix to handle record structs correctly by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3696](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3696) - Update dependencies by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3700](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3700) - Mark several test classes as partial by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3702](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3702) - Add missing test files and fix inheritance by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3703](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3703) - Generate and validate derived test classes by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3704](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3704) - Update SA1011 to not require space before a range operator by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3709](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3709) - Update SA1131 to treat methods as constants by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3710](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3710) - Avoid allocations in CanWrap... methods by [@​martin-strecker-sonarsource](https://togithub.com/martin-strecker-sonarsource) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3711](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3711) - Update SA1648 to accept inheritdoc on members implemented from static abstract/virtual interface members by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3715](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3715) - Update SA1600 to also handle records by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3725](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3725) - Update SA1119 to allow parenthesis around a ref ternary conditional expression when it is the left-hand side of an assigment by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3737](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3737) - Update SA1119 to allow parenthesized switch expressions followed by an invocation by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3733](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3733) - Add c# 12 test project by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3734](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3734) - Run tests in parallel jobs by [@​sharwell](https://togithub.com/sharwell) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3740](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3740) - Update SA1010 to accept whitespace before collection initializers by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3745](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3745) - Update SA1513 to not require a blank line if the closing brace is at the end of a collection expression by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3746](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3746) - Update SA1118 to allow multi-line collection expressions by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3749](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3749) - Update SA1009 to require a space after the closing parenthesis if it is followed by ++ or -- from a prefix unary expression by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3750](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3750) - Update SA1008 to allow space before the opening parenthesis of a using alias definition of a tuple type by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3748](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3748) - Update documentation for SA1102 to contain compilable code examples by [@​arphox](https://togithub.com/arphox) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3755](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3755) - Update SA1008 to not crash if there is no previous token by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3741](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3741) - Change default value of test property CodeActionValidationMode to SemanticStructure instead of None and update so that tests still pass by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3753](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3753) - Allow inheritdoc for class constructors with base types by [@​MartyIX](https://togithub.com/MartyIX) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3719](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3719) - Fix that SA1134 Fix All maybe non-deterministic by [@​pdelvo](https://togithub.com/pdelvo) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/2853](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/2853) - Coverage improvements by [@​bjornhellander](https://togithub.com/bjornhellander) in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3675](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3675) ##### New Contributors - [@​martin-strecker-sonarsource](https://togithub.com/martin-strecker-sonarsource) made their first contribution in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3711](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3711) - [@​arphox](https://togithub.com/arphox) made their first contribution in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3755](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3755) - [@​MartyIX](https://togithub.com/MartyIX) made their first contribution in [https://github.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3719](https://togithub.com/DotNetAnalyzers/StyleCopAnalyzers/pull/3719) **Full Changelog**: DotNetAnalyzers/StyleCopAnalyzers@1.2.0-beta.507...1.2.0-beta.553 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 4am" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/ThorstenSauter/NoPlan). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMDMuMSIsInVwZGF0ZWRJblZlciI6IjM3LjEwMy4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
) Updated [StyleCop.Analyzers](https://github.com/DotNetAnalyzers/StyleCopAnalyzers) from 1.2.0-beta.333 to 1.2.0-beta.556. <details> <summary>Release notes</summary> _Sourced from [StyleCop.Analyzers's releases](https://github.com/DotNetAnalyzers/StyleCopAnalyzers/releases)._ ## 1.2.0-beta.556 ## What's Changed * Update SA1011 to forbid trailing space before the end of a switch case by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3674 * Rewrite IOperationWrapper as a wrapper structure around IOperation by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3611 * Update SA1202 to support interfaces (C# 8) and records (C# 9, 10) by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3694 * Update documentation for SA1308 to also mention prefix "t_" by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3697 * Update SA1642 and its code fix to handle record structs correctly by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3696 * Update dependencies by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3700 * Mark several test classes as partial by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3702 * Add missing test files and fix inheritance by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3703 * Generate and validate derived test classes by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3704 * Update SA1011 to not require space before a range operator by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3709 * Update SA1131 to treat methods as constants by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3710 * Avoid allocations in CanWrap... methods by @martin-strecker-sonarsource in DotNetAnalyzers/StyleCopAnalyzers#3711 * Update SA1648 to accept inheritdoc on members implemented from static abstract/virtual interface members by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3715 * Update SA1600 to also handle records by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3725 * Update SA1119 to allow parenthesis around a ref ternary conditional expression when it is the left-hand side of an assigment by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3737 * Update SA1119 to allow parenthesized switch expressions followed by an invocation by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3733 * Add c# 12 test project by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3734 * Run tests in parallel jobs by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3740 * Update SA1010 to accept whitespace before collection initializers by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3745 * Update SA1513 to not require a blank line if the closing brace is at the end of a collection expression by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3746 * Update SA1118 to allow multi-line collection expressions by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3749 * Update SA1009 to require a space after the closing parenthesis if it is followed by ++ or -- from a prefix unary expression by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3750 * Update SA1008 to allow space before the opening parenthesis of a using alias definition of a tuple type by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3748 * Update documentation for SA1102 to contain compilable code examples by @arphox in DotNetAnalyzers/StyleCopAnalyzers#3755 * Update SA1008 to not crash if there is no previous token by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3741 * Change default value of test property CodeActionValidationMode to SemanticStructure instead of None and update so that tests still pass by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3753 * Allow inheritdoc for class constructors with base types by @MartyIX in DotNetAnalyzers/StyleCopAnalyzers#3719 * Fix that SA1134 Fix All maybe non-deterministic by @pdelvo in DotNetAnalyzers/StyleCopAnalyzers#2853 * Coverage improvements by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3675 * Fix SA1131 to not treat "complex" expressions as a literal by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3760 ## New Contributors * @martin-strecker-sonarsource made their first contribution in DotNetAnalyzers/StyleCopAnalyzers#3711 * @arphox made their first contribution in DotNetAnalyzers/StyleCopAnalyzers#3755 * @MartyIX made their first contribution in DotNetAnalyzers/StyleCopAnalyzers#3719 **Full Changelog**: DotNetAnalyzers/StyleCopAnalyzers@1.2.0-beta.507...1.2.0-beta.556 ## 1.2.0-beta.507 ## What's Changed * Update to StyleCop.Analyzers 1.2.0-beta.435 by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3499 * Add c# 11 test project to opencover-report.ps1 by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3506 * Use GetText instead of ToFullString by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3514 * Keep tracked nodes in a list by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3525 * Remove unnecessary nullable directives by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3530 * Remove hard-coded language versions in test projects for c# 8, 9 and 10 by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3528 * Update SA1515 to not let one range of trivia affect another by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3529 * Mentioned VS 2022 by @twojnarowski in DotNetAnalyzers/StyleCopAnalyzers#3549 * Remove byte order mark from schema file by @martincostello in DotNetAnalyzers/StyleCopAnalyzers#3562 * Update SA1012 to expect no space between a property pattern's opening brace and an enclosing list pattern's opening bracket by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3511 * Update Microsoft.CodeAnalysis.CSharp.Workspaces to version 4.4.0 for the c# 11 test project by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3580 * Update SA1008 to handle positional patterns inside property patterns by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3579 * Update SA1000 to trigger after keywords is, or, and, not by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3585 * Update SA1000.md by @Youssef1313 in DotNetAnalyzers/StyleCopAnalyzers#3563 * Update SA1313 to also allow incorrect names in explicitly implemented methods from interfaces by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3569 * Update SA1023 to not trigger first in line, inside a foreach without braces by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3543 * Update SA1400 to recognize access modifier "file" by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3590 * Update SA1206 to recognize modifier "file" by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3591 * Update SA1000 to handle checked operator declarations correctly by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3505 * Update SA1402 to handle records and record structs by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3570 * Bump Newtonsoft.Json from 12.0.3 to 13.0.2 in /StyleCop.Analyzers/StyleCop.Analyzers.Status.Generator by @dependabot in DotNetAnalyzers/StyleCopAnalyzers#3584 * Update to the latest version of the testing library by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3601 * Update so that SA1600 tests will be run with the expected language version in test projects for c# 8 and above by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3614 * Update reading of file_header_template and stylecop.documentation.copyrightText to allow multiple lines by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3617 * Update SA1015 to require trailing space after an explicit generic return type in a lambda expression by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3625 * Update to Microsoft.CodeAnalysis.Analyzers 3.3.5-beta1.23205.2 by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3628 * Update SA1206 to handle c# 11 modifier "required" by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3535 * Preparations for SettingsHelper optimizations by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3635 * Correct SA1515 to not fire on the second line of a file header by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3633 * Update AnalyzersExtensions and SettingsHelper to use cached JsonValue objects where possible by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3642 * Update SA1010 to not trigger on list patterns by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3507 * Update NamingSettings and DocumentationSettings to keep one Regex instance instead of calling Regex.IsMatch by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3639 * Use ResxSourceGenerator for resource generation by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3343 * Make XmlCommentHelper faster by @ninedan in DotNetAnalyzers/StyleCopAnalyzers#3651 * Update RenameToUpperCaseCodeFixProvider to not offer a code fix if the identifier only consists of underscores by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3637 * Don't emit SA1414 for interface implementations by @CollinAlpert in DotNetAnalyzers/StyleCopAnalyzers#3644 * Support file-scoped namespaces in SA1516 by @JakubLinhart in DotNetAnalyzers/StyleCopAnalyzers#3513 * Update SA1137 to also consider init accessors by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3669 * Update SA1500 to also consider init accessors by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3670 * Update SA1513 to not trigger before an init accessor by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3666 * Update SA1212 to also trigger for an init accessor before a getter by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3661 * Update SA1513 codefix to use the existing newline character sequence by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3607 * Correct code fix for SA1130 when delegate expression is part of a cast expression by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3516 * Update so that c# 7 tests will be run with the expected language version in test projects for c# 8 and above by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3616 * SA1629 should allow full-sentence links instead of forcing the period to glow white by @jnm2 in DotNetAnalyzers/StyleCopAnalyzers#3371 ## New Contributors * @twojnarowski made their first contribution in DotNetAnalyzers/StyleCopAnalyzers#3549 * @ninedan made their first contribution in DotNetAnalyzers/StyleCopAnalyzers#3651 ... (truncated) ## 1.2.0-beta.435 ## What's Changed * Update to Microsoft.CodeAnalysis.Testing 1.1.1-beta1.22081.4 by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3450 * Update SA1600 to show inheritance example. by @codajo in DotNetAnalyzers/StyleCopAnalyzers#3385 * Enable nullable reference types by default by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3455 * Disable SA0002 (Invalid settings file) for empty projects by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3456 * Support awaiting a parenthesized 'switch' or 'with' expression by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3462 * Fix support for object initializers in interpolations by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3463 * Fix typo in SA1307.md by @marcospgp in DotNetAnalyzers/StyleCopAnalyzers#3466 * Map dotnet_separate_import_directive_groups=false to OptionSetting.Allow by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3484 * Support extended property patterns in SA1101 by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3483 * Fix false positive in SA1516 between global statements by @maxkoshevoi in DotNetAnalyzers/StyleCopAnalyzers#3482 * Fix handling of generic delegates in file type name by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3485 * Collect incremental state without passing compilation to output stage by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3452 * Updated code fix name for SA1027 to be ok regardless of the 'useTabs' setting by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3490 * Corrected documentation for SA1516 by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3488 * Updated SA1009 to forbid space after a closing parenthesis in a method reference contained in single quotes by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3497 * Added a new test project for c# 11 by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3491 * Remove same values at SA1201ElementsMustAppearInTheCorrectOrder.MemberNames by @eliseevev in DotNetAnalyzers/StyleCopAnalyzers#3496 * Updated SA1015 analyzer to handle generic attributes (c# 11 preview) by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3494 * Updated SA1008 to handle tuples in logical patterns by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3495 ## New Contributors * @codajo made their first contribution in DotNetAnalyzers/StyleCopAnalyzers#3385 * @marcospgp made their first contribution in DotNetAnalyzers/StyleCopAnalyzers#3466 * @maxkoshevoi made their first contribution in DotNetAnalyzers/StyleCopAnalyzers#3482 * @eliseevev made their first contribution in DotNetAnalyzers/StyleCopAnalyzers#3496 **Full Changelog**: DotNetAnalyzers/StyleCopAnalyzers@1.2.0-beta.406...1.2.0-beta.435 ## 1.2.0-beta.406 ## What's Changed * Increase test coverage for records in SA1500, SA1502, and SA1508 by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3421 * Add 'allowDoWhileOnClosingBrace' configuration to the JSON schema by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3423 * Use CultureInfo.InvariantCulture for en-US by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3426 * Allow direct use of explicit parameterless constructors by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3432 * Support file-scoped namespaces in SA1649 and SA1402 by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3436 * Add file-scoped namespace support to SA1208 in DotNetAnalyzers/StyleCopAnalyzers#3438 * Expand support for file scoped namespaces by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3446 * Insert blank line before using directives in file-scoped namespace by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3447 **Full Changelog**: DotNetAnalyzers/StyleCopAnalyzers@1.2.0-beta.376...1.2.0-beta.406 ## 1.2.0-beta.376 ## What's Changed * Update System.Collections.Immutable in the status generator by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3362 * Update to Microsoft.CodeAnalysis.Testing 1.1.0-beta1.21329.1 by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3361 * SA1130: Handle optional named arguments correctly by @wdolek in DotNetAnalyzers/StyleCopAnalyzers#3289 * Add C# 10 test project by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3398 * Support C# 10 'record struct' by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3401 * Update SA1116 and SA1117 to handle target-typed new (C# 9) by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3408 * Use reference assemblies for index and range by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3417 * Update SA1119 to support C# Ranges by @pantosha in DotNetAnalyzers/StyleCopAnalyzers#3372 * Allow object initializers and switch expressions in throw statements by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3418 * Update to Roslyn 4, .NET SDK 6.0.100 by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3416 * Update SA1135 to support file-scoped namespaces by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3419 * Fix ignored Namespace attribute in OperationLightupGenerator by @pavel-mikula-sonarsource in DotNetAnalyzers/StyleCopAnalyzers#3378 * Update SA1003 and SA1008 to not require space before a cast inside a range expression by @bjornhellander in DotNetAnalyzers/StyleCopAnalyzers#3409 ## New Contributors * @wdolek made their first contribution in DotNetAnalyzers/StyleCopAnalyzers#3289 * @pavel-mikula-sonarsource made their first contribution in DotNetAnalyzers/StyleCopAnalyzers#3378 **Full Changelog**: DotNetAnalyzers/StyleCopAnalyzers@1.2.0-beta.354...1.2.0-beta.376 ## 1.2.0-beta.354 ## What's Changed * Update SA1305 doc to mention allowedHungarianPrefixes in stylecop.json by @Youssef1313 in DotNetAnalyzers/StyleCopAnalyzers#3321 * Implement custom fix all providers by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3322 * Handle new() syntax on SA1118 by @BlythMeister in DotNetAnalyzers/StyleCopAnalyzers#3340 * Support defining options in .editorconfig by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3285 * Set TLS defaults for testing by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3342 * Update to Microsoft.CodeAnalysis.Testing 1.0.1-beta1.21202.2 by @sharwell in DotNetAnalyzers/StyleCopAnalyzers#3341 * Issue #2801: SA1500 fires for the while clause of do/while statement by @Kevin-Andrew in DotNetAnalyzers/StyleCopAnalyzers#3196 ## New Contributors * @BlythMeister made their first contribution in DotNetAnalyzers/StyleCopAnalyzers#3340 * @Kevin-Andrew made their first contribution in DotNetAnalyzers/StyleCopAnalyzers#3196 **Full Changelog**: DotNetAnalyzers/StyleCopAnalyzers@1.2.0-beta.333...1.2.0-beta.354 Commits viewable in [compare view](DotNetAnalyzers/StyleCopAnalyzers@1.2.0-beta.333...1.2.0-beta.556). </details> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
The "CanWrap.." methods are in the hot path in our repository (see SonarSource/sonar-dotnet/issues/8106). It is likely that the methods are on the hot path in your analyzer as well (they are called by each ...Wrapper.IsInstance implementation).
The following improvements can be validated by the generated IL:
IL_00000creates a capture class for the whole method. In the new version, no capture class is created.Func<,>delegate instantiation for_ => new ConcurrentDictionary<Type, bool>()is deferred for sure. The function delegate inIL_0047seems to be stored in a hidden static field and reused in the old version. The new version makes sure that the delegate is not instantiated on the happy path for sure.IL_0033in the new version is only conditional executed after the branch after theSupportedSyntaxWrappers.TryGetValue(IL_0017) and a second branch after the static field lookup (IL_0025).wrappedSyntax.TryGetValueis not successfulcanCastis calculated and added to theConcurrentDictionarywithout a delegate. This is possible becausecanCastis a value type. Unlike with reference types, the created value doesn't suffer from concurrency issues ifTryAddfails.The allocation saving for the capture class was measured in this SonarSource/sonar-dotnet/pull/8107 on our side with the similar changes in place.
The IL for the old version of
CanWrapNodelooks like so (3 timesnewobj):The IL for the new version looks like so (1 time
newobj):