Dim g As Stream = Await b.OpenStreamForWriteAsync
g.SetLength(0)
g.Close()
Dim f As Streams.IRandomAccessStream = Await b.OpenAsync(FileAccessMode.ReadWrite), d As BitmapEncoder = Await BitmapEncoder.CreateAsync(BitmapEncoder.PngEncoderId, f)
d.SetSoftwareBitmap(c)
Await d.FlushAsync()
f.Dispose()
I solved this myself. Prior to the formal writing open a Stream and set its length to 0, and afterwards Dispose it. This seems somewhat weird however. Any better practices?