2 Replies - 750 Views - Last Post: 19 December 2018 - 09:02 AM

#1 hexagod   User is offline

  • 😂😂😂
  • member icon

Reputation: 31
  • View blog
  • Posts: 577
  • Joined: 29-October 16

Unable to Read Files in Debug Mode ? ( Visual Studio )

Posted 19 December 2018 - 08:29 AM

Does anyone know how I can get visual studio to read files in debug mode ??? It works fine when I use C# / WPF or even C# winforms but when I'm debugging in Visual C++ CLR application I get

Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll

I don't get this exception when I compile the same program in release mode.
Is This A Good Question/Topic? 0
  • +

Replies To: Unable to Read Files in Debug Mode ? ( Visual Studio )

#2 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7132
  • View blog
  • Posts: 24,224
  • Joined: 05-May 12

Re: Unable to Read Files in Debug Mode ? ( Visual Studio )

Posted 19 December 2018 - 08:48 AM

Very likely you have different working directories configured for Debug vs. Release.
Attached Image

To add to the confusion, in C#, the default working directory is the "bin\Debug" or "bin\Release" directory. C++ also did this in older versions of Visual Studio (VS2012 and older as I recall). The changed the behavior for C++ in Visual Studio so that the working directory ends up being the Project directory -- I think this was to help C++ students (where the typical *nix samples would have their data input files living in the Project directory). Personally, I think it made things worse.
Was This Post Helpful? 1
  • +
  • -

#3 hexagod   User is offline

  • 😂😂😂
  • member icon

Reputation: 31
  • View blog
  • Posts: 577
  • Joined: 29-October 16

Re: Unable to Read Files in Debug Mode ? ( Visual Studio )

Posted 19 December 2018 - 09:02 AM

ty skydiver... yeah I was just doing some testing and I noticed that. So it's a directory issue not IDE. I was confused because it's not using the directories like in C# and they each have their own folder for the objects but they pull from the same for root file i/o
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1