System.IO.File.Exists() different answer from x86 and x64 applications
64-bit, c#, visual-studio-2012
Solution
Thank you for all of the comments. I tried a number of them and found that I could not reproduce the problem for any file other than the one I pointed to with my original code. Over the last couple days, I began to see my hard drive fail on me. After getting a new hard drive, setting it all up again, and running the aforementioned program, I no longer see this issue. I can't be 100% sure about this, but I'm going to assume that the file I was trying to open was corrupted by a failing hard drive. I apologize for the wild goose chase.
Problem
I am using Visual Studio 2012 with Update 3 installed. I am using C# targeting .NET framework 4.5. I have a method that starts like this: ``` public void Open(System.String filePath) { if (!System.IO.File.Exists(filePath)) throw new FileNotFoundException(. . .); . . . } ``` The value of the `filePath` parameter is this: `"C:\\Users\\Jonathan.DeCarlo\\Source\\Repos\\PoliticalClassifier\\src\\PoliticalClassifier.DataSource.Tests\\TestFiles\\Social_Economic_DataMicro.xlsx"` That path does indeed exist on my machine. This application is compiled as "Any CPU." I am running it on a machine with Windows 7 x64 installed. If I let the applicatoin run as an x64 process, the `FileNotFoundException` is thrown even though the file does exist. If I force the application to run as an x86 process, then the the exception is NOT thrown (which should be the case). Why does `System.IO.File.Exists(filePath)` return a different result when the application is running as an x64 process as opposed to an x86 process?