1

Closed

pivotal -- HttpTransmitter (HttpWebResponse) request.GetResponse() should be in using block

description

Moved to pivotal

The object returns an IDisposable and therefore it would be cleaner to place it in a using block than to have a finally block.

Also

var responseStream = new TempFileStream();

Should this be in a using block?
Closed Jul 27, 2011 at 1:49 PM by tcabanski
Moved to pivotal

comments

tcabanski wrote Jul 13, 2011 at 10:47 AM

Good point on the HTTP transmitter. Go ahead and refactor it.

Cannot put a using block around the temp file stream because the transmission part collection keeps it open and it will be used later. I'm trying to minimize stream copies so the TransmissionPart always uses the stream it is given and does not make a copy unless the stream cannot be seeked (e.g. NetworkStream).

joefeser wrote Jul 13, 2011 at 12:52 PM

Can we discuss when the transmission goes "out of scope" so that dispose can be called? My fear is we have open handles.

I can write tests around this to verify it if needed.