dotnet / codeformatter

Tool that uses Roslyn to automatically rewrite the source to follow our coding styles
MIT License
1.24k stars 244 forks source link

CodeFormatter should not rename private fields that are part of an interop type. #230

Open ghost opened 8 years ago

ghost commented 8 years ago

C# structs that are designed to map to known C++ structures for the purposes of P/Invoke'ing are expected to have names that match the original C++ names. CodeFormatter should not add an "_" to those fields, even if the field's visibility is "private."

Two reasons I might put "private" on such a field:

A good rule for deciding whether a struct is an "interop type" might be to check if the author explicitly added the [StructLayout(Sequential/Explicit)] tag the struct.