I have a class that performs some sensitive I/O operations across an entire disk volume. By sensitive I mean if the operation goes wrong, it can potentially corrupt the target volume.
During some post-release testing, I found that the process can be corrupted using reflection to manipulate private fields. The class is not sealed
by design so that consumers of the library can create derivatives.
Is there a way to secure private members to prevent modification via reflection (from derived or consumer code)?
UPDATE: I found a comment from Hans Passant to an old question mentioning [ReflectionPermission]
. Looking into that now.