Hi Scott,

> I've made these changes, and checked them in, but I have a sneaking
> suspicion that this is not the correct place to close the writer.
>
> The writer is created in the this block from IResultFormatter
> NUnitTask.CreateFormatter(...)
>
>             TextWriter tw = new StreamWriter( outfile.Create());
>             retFormatter.SetOutput(tw);
>             return retFormatter;
>
> Then the formatter is used. It seems like IResultFormatter should be
> disposable, and that is when the writer should be closed. Or the creator
> should take care of it.
>
> It seems like your solution, although it works, will close the writer
> that it doesn't necessary own. And could be a pre-mature closure.

I thought about this, too, but wasn't so sure about this. For one thing, as
you yourself pointed out, the writer is created at the same time as the
formatter, and handed to it. That, at least imho, gives the formatter pretty
clear ownership of the writer. However, you have a valid point.

However, I'd consider instead some refactoring here: To me, the clearest
solution is to give the formatter clear ownership of the writer, and in
fact, let it create the writer itself. It makes no sense, afaics, what
benefit comes from creating it independently.

--
Tomas Restrepo
[EMAIL PROTECTED]


_______________________________________________________________
Hundreds of nodes, one monster rendering program.
Now that's a super model! Visit http://clustering.foundries.sf.net/

_______________________________________________
Nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to