warning AD0001: Analyzer 'StyleCop.Analyzers.OrderingRules.SA1201ElementsMustAppearInTheCorrectOrder' threw an exception of type 'System.Collections.Generic.KeyNotFoundException' with message 'The given key was not present in the dictionary.'. #3788
Labels
This issue was arising when we added a 'record' struct in a .cs file at the bottom of the class.
CSC : warning AD0001: Analyzer 'StyleCop.Analyzers.OrderingRules.SA1201ElementsMustAppearInTheCorrectOrder' threw an
exception of type 'System.Collections.Generic.KeyNotFoundException' with message 'The given key was not present in the
dictionary.'.
Repro issue:
public class FooClass {
...
public List Value {get; set;}
...
public record BarClass([property: JsonProperty("name") string name]);
}
No other indication was given that this was an issue. It was fixed by moving the record above the constructor of the Foo class.
References: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1201.md
I do not need further assistance; this is merely to assist others if they run into a similar issue.
The text was updated successfully, but these errors were encountered: