Loading...

gendarme@googlegroups.com

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: [gendarme] Re: AvoidUnusedPrivateFieldsRule - 2 bugs Calvin Rien Thu Mar 15 16:01:40 2012

I'm getting the AvoidUnusedPrivateFieldsRule warning in a coroutine that is 
definitely using the variable.

Here's the chunk of code causing the warning.
https://gist.github.com/748d0593277be1ca82de

On Wednesday, July 23, 2008 9:03:59 AM UTC-7, Sebastien Pouliot wrote:
>
> Both issues are fixed.
>
> Literals (like const) are now ignored[1] since it looking for their
> value turned out too many false positives too.
>
> Thanks again
> Sebastien
>
> [1] it turns out that fxcop does the same (i.e. ignoring them)
>
> On Tue, 2008-07-22 at 20:42 -0400, Sebastien Pouliot wrote:
> > On Sun, 2008-07-20 at 08:39 -0700, Alan wrote:
> > > The 'problem' text reads:
> > > This method calls several times into some properties. This is
> > > expensive for virtual properties or when the property cannot be
> > > inlined.
> > > 
> > > That doesn't appear to relate to the rule name at all.
> > 
> > Good catch, it's a copy-paste error from another rule (still in
> > development). I'll fix this asap.
> > 
> > > Also, I'm getting a warning that I have an unused private field
> > > (FastPeersFlag) even though i'm using it in two separate methods. I
> > > get a similar warning for the other flags.
> > > 
> > > 
> http://anonsvn.mono-project.com/source/trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Messages/StandardMessages/HandshakeMessage.cs
> > 
> > ah it looks like I missed some cases... 
> > 
> > what happens here is that the compilers turns *constant* fields into
> > values inside IL (let me know if the occurs to non-constant fields!)
> > 
> > E.g. you don't see a "LDFLD FastPeersFlag" but a "LDC_I4_4 +
> > CONV.I1" (or something like that, I did not compile it ;-)
> > 
> > Anyway this means Gendarme must look at all constants inside IL to see
> > if one of them match the constant fields. This is not a 100% safe
> > process (it could be a real 4 value not related to the, possible unused,
> > field) but it's better than the (current) alternative.
> > 
> > Thanks for the report!
> > Sebastien
> > 
> > 
> > > 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Gendarme" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/gendarme/-/148Hj6LsIQ8J.
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.