Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ApplyToMembers not work in ObfuscationAttribute(Exclude = true, ApplyToMembers = true)] #75

Closed
ahmedosama007 opened this issue Aug 22, 2019 · 10 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@ahmedosama007
Copy link

ApplyToMembers does not work in ObfuscationAttribute(Exclude = true, ApplyToMembers = true)], it should exclude all class members from certain protection modules

@mkaring mkaring self-assigned this Aug 24, 2019
@ahmedosama007
Copy link
Author

The workaround is to add the attribute to each property/method of the class

For example [Obfuscation(Exclude = false, Feature = "-rename")] to exclude from Rename protection

yck1509#525

@mkaring mkaring added this to the 1.3 milestone Aug 25, 2019
@mkaring
Copy link
Owner

mkaring commented Aug 25, 2019

Yes, but this is a proper hassle. Especially if the class contains a lot of members. I'll try to fix this for the 1.x and the 2.x releases.

@mkaring mkaring added the bug Something isn't working label Aug 25, 2019
@KvanTTT
Copy link

KvanTTT commented Aug 25, 2019

@ahmedosama007, unfortunately, it does not work for properties, only for fields. I guess this is due to properties contain autogenerated getter and setter.

mkaring added a commit that referenced this issue Aug 25, 2019
The apply to member attribute is not properly handled.
The altered settings are now transfered to the member elements.
mkaring added a commit that referenced this issue Aug 25, 2019
The apply to members attribute is only considered for types.
This is done to follow the recommended behaviour by Microsoft.

If the attribute is applied to anything but a type, the parameter is
considered to be set to false without condition.
@mkaring
Copy link
Owner

mkaring commented Aug 25, 2019

@KvanTTT: That did not work at all properly. A type with this specific attribute should forward it's altered configuration to all the members.

@ahmedosama007: I think I fixed the issue and the version containing the fix can be downloaded here. I would appreciate some feedback if it works for you now.

@ahmedosama007
Copy link
Author

ahmedosama007 commented Aug 27, 2019

@mkaring Thanks, I confirm that the issue was fixed, ApplyToMembers = true is now can exclude all class members from certain protections specified by attribute parameter Feature

Thanks for fixing this. please accept my coffee and have a nice day

@KvanTTT
Copy link

KvanTTT commented Aug 27, 2019

@mkaring in your build renaming of public members and types are disabled by default. It differs from previous behavior. Is this made intentionally?

@mkaring
Copy link
Owner

mkaring commented Aug 27, 2019

@KvanTTT Not exactly sure what you are talking about.

@KvanTTT
Copy link

KvanTTT commented Aug 27, 2019

renPublic is false in your build. In the previous version, it was true.

@mkaring
Copy link
Owner

mkaring commented Aug 28, 2019

@KvanTTT If you have a look here you find the behaviour of renPublic unchanged for some time in the 1.x branch. In the 2.x line this parameter is gone and that it intentional. It will be replaced with something more clearly structured.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 13, 2021
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants