(And will provide a patch if nobody marks it as WONTFIX after a week!)
On Wed, 2011-01-26 at 00:08 +0100, "Andrés G. Aragoneses" wrote:
> No feedback anyone? I'll create an enhancement request in BNC if no one
> is opposed in 24hours ;)
>
> (And will provide a patch if nobody marks it as WONTFIX after a week!)
I'll be away from tomorrow night until Feb 8th - so you're unlikely to
see a WONTFIX in that period ;-)
Seriously I had not the time to review all related rules (quite a few
deals with IDisposable) but the test case looks valid. IOW your patches
will be most welcome :-)
Thanks!
Sebastien
p.s. see comment below
>
> On 21/01/11 12:55, knocte wrote:
> > Sorry, I meant TypesWithDisposableFieldsShouldBeDisposableRule.
> >
> > On Jan 21, 11:37 am, knocte<kno...@gmail.com> wrote:
> >> Hi Gendarmes,
> >>
> >> I'm wondering if DisposableFieldsShouldBeDisposedRule should be
> >> smarter and detect this case too (saying that class A should be
> >> IDisposable):
> >>
> >> interface ISomeInterface
> >> {
> >> string Name { get; }
> >> }
> >>
> >> class A
> >> {
> >> private ISomeInterface someMember;
> >>
> >> public ISomeInterface SomeMember {
> >> get {
> >> if (someMember == null)
> >> someMember = new B();
The message provided by the defect will need to be clear since
alternatives could also provide non-IDisposable, e.g.:
switch (SomeOtherProperty) {
` case 0:
// not IDisposable
someMember = new C();
break;
default:
someMember = new B();
break;
}
Make this a large switch/case and this IDisposable-case can be hard to
find (and easy to forget ;-)