Version 5 AnyCPU getting 2GB error
I'm a noob in C# and I'm getting this error running LincPad5 AnyCPU installed: "The file is too long. This operation is currently limited to supporting files less than 2 gigabytes in size."
Code is reading in a 4.7GB file. I've read somewhere that this is an x86 build issue only and the x64 build will allow for larger memory. "The AnyCPU builds default to X64 rather than X86." I'm running a 64-bit Windows 10 laptop.
byte[] nbytes = File.ReadAllBytes(largeFile);
Thanks,
Code is reading in a 4.7GB file. I've read somewhere that this is an x86 build issue only and the x64 build will allow for larger memory. "The AnyCPU builds default to X64 rather than X86." I'm running a 64-bit Windows 10 laptop.
byte[] nbytes = File.ReadAllBytes(largeFile);
Thanks,
Comments
File.ReadAllBytes has a specific check to make sure the length is less than 2Gb
See https://github.com/dotnet/coreclr/blob/master/src/mscorlib/src/System/IO/File.cs
And the reason for that check is because you can't have a single array bigger than 2GB.
See
https://stackoverflow.com/questions/2415434/the-limitation-on-the-size-of-net-array