StreamWriter.close() does not flush in Windows 2012
<h1>EDIT</h1>
<p>I tried with <code>Flush</code>, <code>Close</code> and <code>Using</code>, without success. I also tried to limit the OS cache using <a href="http://www.microimages.com/downloads/SetFileCacheSize.htm" rel="nofollow noreferrer">SetSystemFileCacheSize.exe</a>, but nothing. Also the use of the latest framework, 4.6.2, makes no difference. Don't really know what to do to force the flush...</p>
<hr />
<p>I'm coding a VB.net application that writes files on disk. I have to be sure data is really written on disk every 1 second. So I close the stream, set the last write date and reopen it:</p>
<pre><code>Dim now As DateTime = DateTime.Now
streamer.Close()
File.SetLastWriteTime(path, now)
streamer = File.AppendText(path)
</code></pre>
<p>This works without problem under Windows 7. Under Windows 2012, last write date is updated, but file size is not updated. It seems that OS cache is not really flushed.</p>
<p>I'm using .NET Framework 4.5.2</p>