SergeyTeplyakov / ErrorProne.NET

Set of roslyn-based analyzers for catching common C# errors (inspired by Google's error-prone)
MIT License
869 stars 43 forks source link

False warnings for ArraySegment<T> #257

Open helviett opened 2 years ago

helviett commented 2 years ago

ArraySegment<T> is a readonly struct, but analyzer thinks it is not and always gives ESP06 warning.

vpenades commented 2 years ago

I believe I am having a similar problem, with System.Numerics.Vectors

I have projects that target frameworks netstandard2 and net6 ... as it happens, in net6 several System.* libraries expose APIs with readonly modifier, but the netstandard 2.0 counterparts don't

In other words, it's impossible to optimize code for both frameworks; What's an optimization in net6 is seen as a performance issue in netstandard2.0

Personally, I think the solution would be to allow disabling analysis on specific frameworks