c# - Write large data with WriteLineAsync in a using block -


can following code cause error, if writelineasync not finished writing, using term tries dispose writer stream?

for example:

using (var writer = system.io.file.appendtext(filename)) {      writer.writelineasync(message); } 

what happen, if write large data, may takes few seconds?

thank you

yes, stream disposed of before task has completed.

you should either await task returned writelineasync or write file synchronously instead, using writeline.


Comments

Popular posts from this blog

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -

apache - setting document root in antoher partition on ubuntu -

python - pip install -U PySide error -