A public static readonly array can still have its elements changed by any code

tx0/csharp:exposed-static-arrayrecommendedwarningmaintainability/designdepth fastsmell

What it finds

readonly protects the field, not the array: Config.Names[0] = "x" changes the shared array for everyone. An ImmutableArray, a ReadOnlyCollection or a property returning a copy keeps the elements fixed.

From the rule's source, exposed_static_array.rs.

Example from the rule's tests
public class Lists{    public static readonly string[] Names = { "a", "b" };tx0 reports: the elements of the public array Names can be changed by any code    private static readonly string[] Hidden = { "c" };    public static readonly System.Collections.Generic.IReadOnlyList<string> Safe = new[] { "d" };}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/csharp:exposed-static-array" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/csharp:exposed-static-array] reason="..."

tx0 explain tx0/csharp:exposed-static-array shows the same in the terminal. Found a false positive? Report it.