Thursday, May 2, 2019

Stream disposing of task before await is complete

The title may be a bit misleading because it is what I believe is occurring based on googling the error, here is my code:

using (Stream stream = image.OpenReadStream()) { var imageId = await imageStore.SaveImage(stream); } 

And the error I'm getting is this

ReadTimeout = 'stream.ReadTimeout' threw an exception of type 'System.InvalidOperationException' 

This SO is what makes me think it is being disposed before the await.
https://stackoverflow.com/questions/43069026/stream-readtimeout-threw-an-exception-of-type-system-invalidoperationexceptio

As always your expertise is always appreciated!

Stream disposing of task before await is complete Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team