On 17.03.2012 15:48, steves wrote:
It's because AvoidUnusedPrivateFieldsRule does not check accesses to
private field in nested types, which actually have access to private
fields of their parent type. Compiler generates a nested class that
implements the coroutine and all the accesses to the private fields in
your example are moved into the new generated class, which is then not
taken into consideration by AvoidUnusedPrivateFieldsRule.
Fix seems to be easy: just check nested types for private fields
access, i did it here:
https://github.com/steve-s/mono-tools/commit/8e81fd26112b4fe792822b42da8a3243360ba4d9
and will send a pull request...
However, if we don't take into account compiler generated nested
types, it could be a sign of a bad design if a private field is used
only in nested type(s), so maybe new rule?
That would depend on the nested class, wouldn't it? Enumerators and the
whole async state machine stuff come to my mind, but I'm not firm enough
with the details here :-/
Best Regards, David
--
You received this message because you are subscribed to the Google Groups
"Gendarme" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/gendarme?hl=en.