ErrorProne.NET icon indicating copy to clipboard operation
ErrorProne.NET copied to clipboard

Wrong "in" Keyword suggestion when struct is stored in a collection of tuples

Open Aniobodo opened this issue 3 years ago • 1 comments

List<(MyStruct ms, int)> myStructTupleList = new ();

MyMethod(in myStruct)//example method

MyMethod(in myStructTupleList[0].ms) //does not compile with the "in" keyword

Aniobodo avatar Jun 23 '22 06:06 Aniobodo

Thanks a lot for reporting this issue. I think I'm going to remove the rule that suggests to use the 'in' modifier explicitly, because this is just a matter of preferences and has 0 impact on runtime and I think these analyzers should only report/suggest fixes that affect the runtime behavior of the program and should not have any opinions on style.

SergeyTeplyakov avatar Jul 21 '22 22:07 SergeyTeplyakov