On Sat, 2011-01-22 at 15:32 +0100, "Andrés G. Aragoneses" wrote:
> Hello,
> 
> I think I've spotted some false positives in EnsureLocalDisposalRule. If 
> the IDisposable object detected by the rule is sent out of the scope of 
> the function (as a return variable, out parameter, or assigning it to 
> the property of some other non-local object), the rule shouldn't warn in 
> this case, or at least give a lower confidence, right?

Yes, that sounds rights.

> 
> Example:
> class StreamFactory {
> void GiveXStream (string file)

^ won't compile, I assume this should be returning a Stream and not
void ;-)

> {
>      var stream = new XStreamReader (file);
>      return stream;
> }
> }
> 
> In this latter case, it should be responsibility of the caller to 
> dispose the object.
> 
> Thoughts?

Can you provide gendarme unit tests for them ? :-)

Thanks!
Sebastien

-- 
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.

Reply via email to