c# - Hiding a private field from reflection in .net -


i have class performs sensitive i/o operations across entire disk volume. sensitive mean if operation goes wrong, can potentially corrupt target volume.

during post-release testing, found process can corrupted using reflection manipulate private fields. class not sealed design consumers of library can create derivatives.

is there way secure private members prevent modification via reflection (from derived or consumer code)?

update: found comment hans passant old question mentioning [reflectionpermission]. looking now.

there no way hide field reflection. can used access , manipulate field on type. there steps can take obfuscation make harder identify fields , in turn harder change via reflection. speed bump though. determined developer can use reflection beat work arounds have


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -