You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Rename confusion breaks data contract serialization #147
1.3.1 serialization.zip
Please check the attached zip
Solution attached, bin contains unconfused and confused exes and xml files produced by them.
Wpf form with two buttons, first saves xml in app folder, second reads file and shows value from file.
Issue is that nested classes not marked as data contract are exported incorrectly, confused version is not compatible with unconfused (but compatible with itself)
Unconfused exports as
You are correct. What happens here is clearly wrong. Renaming the members is correct, because you are obfuscating an executable and ConfuserEx treats all the types in an executable as internal. However, you did set the DataMember, and that should keep the naming in the serialized output the same.
There are a couple of issues surrounding properties and attributes on properties that were found in issue #123. This issue may be related to one of them.
@mkaring thanks for reply, you are obfuscating an executable and ConfuserEx treats all the types in an executable as internal
I think this is arguable but from some point of view make sense.
From the point of normal human logic - yes, but from the point of .net it is still an assembly and its public members in theory can be requested from outside. I think some old confuser versions did not rename public members and I was relying on that, making logic-sensitive members internal and others, especially performance-sensitive or confuser-buggy - public. I don't mind of this new approach, just will have to change my habits and some code to use [Obfuscation] attribute instead of public access modifier.
ConfuerEx always handled the types in executables like this. Not sure what the old Confuser did.
There is a way however, to enforce that the public members remain untouched. You have to add the renPublic parameter of the rename protection with the value false. This way you can disable the automatic selection of this parameter based on the assembly type.
@mkaring thanks a lot for the tip!
Previous version I am still using was released many years ago, it is even not Ex yet, and I am pretty sure public members were not confused, I can't check it with disassembler but I see it from exception stack traces.
Activity
mkaring commentedon Jun 2, 2020
You are correct. What happens here is clearly wrong. Renaming the members is correct, because you are obfuscating an executable and ConfuserEx treats all the types in an executable as internal. However, you did set the
DataMember, and that should keep the naming in the serialized output the same.There are a couple of issues surrounding properties and attributes on properties that were found in issue #123. This issue may be related to one of them.
semenenkov commentedon Jun 2, 2020
@mkaring thanks for reply,
you are obfuscating an executable and ConfuserEx treats all the types in an executable as internal
I think this is arguable but from some point of view make sense.
From the point of normal human logic - yes, but from the point of .net it is still an assembly and its public members in theory can be requested from outside. I think some old confuser versions did not rename public members and I was relying on that, making logic-sensitive members internal and others, especially performance-sensitive or confuser-buggy - public. I don't mind of this new approach, just will have to change my habits and some code to use [Obfuscation] attribute instead of public access modifier.
mkaring commentedon Jun 2, 2020
ConfuerEx always handled the types in executables like this. Not sure what the old Confuser did.
There is a way however, to enforce that the public members remain untouched. You have to add the
renPublicparameter of the rename protection with the valuefalse. This way you can disable the automatic selection of this parameter based on the assembly type.semenenkov commentedon Jun 2, 2020
@mkaring thanks a lot for the tip!
Previous version I am still using was released many years ago, it is even not Ex yet, and I am pretty sure public members were not confused, I can't check it with disassembler but I see it from exception stack traces.
fix(renamer): skip renaming of DataContract/DataMember/JsonProperty a…
Pre release (#68)