title: C#: FileStream.SetLength(long) fails with "The requested operation could not be completed due to a file system limitation" (on Windows 10 Home, NTFS)
body: <p>I had a very confusing experience with the System.IO.FileStream when writing a fairly large file that was approaching 8Gb in size***.  The call to FileStream.SetLength(LARGE_NUMBER) started to suddenly fail with the error </p>
  
  <blockquote>
    <p>The requested operation could not be completed due to a file system limitation</p>
  </blockquote>
  
  <p>The stacktrace was:</p>
  
  <pre><code>   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
     at System.IO.FileStream.SetLengthCore(Int64 value)
     at System.IO.FileStream.SetLength(Int64 value)
     at LiteDB.FileDiskService.WriteJournal(ICollection`1 pages, UInt32 lastPageID)
     ...
  </code></pre>
  
  <p>This was reproducible and fairly puzzling as googling turned up no obvious answer. </p>
  
  <p>For the record, the LARGE_NUMBER SetLength was being called with was around 8,110,000,000 -- not small, but not in any way special. I've certainly seen larger files on NTFS before.</p>
  
  <hr>
  
  <p>*** It's a LiteDB database file -- I do recognise I'm probably stretching what it is meant to be used for but this isn't the point of the question.</p>