I want to read a binary file using BinaryReader, but I keep getting an exception:
using (var stream = File.Open("file.bin", FileMode.Open, FileAccess.Read))
{
using (BinaryReader r = new BinaryReader(stream)) //EXCEPTION
{
}
}
the "file.bin" has been set as a Content in the build action, but I keep getting this exception:
System.MethodAccessException was unhandled
Attempt to access the method failed: System.IO.File.Open(System.String, System.IO.FileMode, System.IO.FileAccess)