Error "The specified buffer index is not within the buffer capacity" RRS feed

  • Question

  • The error is generated by the following code:

    IBuffer buffer = await FileIO.ReadBufferAsync(storageFileFoo);
    byte[] abData = buffer.ToArray(); 
    I assume the file is too large.  Is there a way to avoid this or proactively determine the file is too large?


    Monday, July 21, 2014 2:39 PM

All replies

  • How large is the file that you're using in this case?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Monday, July 21, 2014 7:27 PM
  • I get it for many different files.  I have just done a test with a file of 32MB that generates this error. 

    This is on a quad-core CPU machine with 16GB RAM.


    Monday, July 21, 2014 7:42 PM
  • This error occurs when the file size is zero too.


    Wednesday, July 23, 2014 2:41 PM