public async Task CreateForWritingAsync()

in Core/src/Impl/Storages/FileSystemStorage.cs [166:184]


    public async Task CreateForWritingAsync(SymbolStoragePath file, AccessMode mode, Stream stream)
    {
      if (stream == null)
        throw new ArgumentNullException(nameof(stream));
      if (!stream.CanSeek)
        throw new ArgumentException("The stream should support the seek operation", nameof(stream));
      await Task.Yield();
      stream.Seek(0, SeekOrigin.Begin);
      var fullFile = SymbolPathToDiskPath(file);
      
      // This operation consists of two phases and should normally acquire a writer lock.
      // However, we assume that no other read-lock-acquiring operations will fail if a new directory or file appears.
      using (await myRwLock.AcquireReadLockAsync())
      {
        Directory.CreateDirectory(Path.GetDirectoryName(fullFile) ?? "");
        await using var outStream = File.Create(fullFile);
        await stream.CopyToAsync(outStream); 
      }
    }