Who is responsible for closing Windows.Web.Http.HttpStreamContent? RRS feed

  • Question

  • I am using this to upload a file using openSequentialReadAsync and assign the result to the content ctor.

    After the transfer I rename the file that I called openSequentialReadAsync on and get an exception that says "file not found". So it seems someone is keeping a lock on the file somewhere. Do I need to call close() on the file stream or content object?

    • Edited by pkursawe Wednesday, August 13, 2014 7:23 PM
    Wednesday, August 13, 2014 5:12 PM

All replies

  • Does it help if you do that?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, August 14, 2014 12:15 AM
  • I don't know where in the workflow I would have to call it. And since the request can fail I would have to close the stream from the success and error handlers. It seems more like a bug, that the request object does not close the stream after it has been uploaded to the server.
    Thursday, August 14, 2014 12:21 AM