Open jaredmoo opened 8 years ago
+1 on this. In MSBuild we use binary serialization all over (uhg) and changing private fields on [Serializable] classes changes the contract for serialization. It would be good to detect both of these and be able to disable renaming in those cases (even if it's an extra option).
Another irritant: renaming fields that are part of an interop struct and are intentionally named to match their C++ counterparts. Opened a separate issue for this:
We were bit by a nasty issue that running CodeFormatter broke serialization of a type that had [DataMember] on a private field. CodeFormatter renamed the field, which caused the serialization format to change, so our pre-CodeFormatter and post-CodeFormatter serialization was incompatible.
Below program demonstrates the issue:
Before CodeFormatter, produces the below output:
Running CodeFormatter renames
MyInteger
to_myInteger
, so now it produces this output:Of course we should have had tests that detected this issue, but I should feel confident that CodeFormatter will not affect code functionality.