+2  A: 

Within your code, call the function

System.IO.Directory.GetCurrentDirectory()

By default, unless you've changed the Debug properties of your project, the current directory will start as the bin\Debug directory of your project (where the .exe runs from).

Richard
What do you mean by the actual program not running? The program was stopped at a breakpoint when the screenshot was taken.
Peter Mortensen
Hmmm, I see what you mean. I was wrong about the .vshost - I've just checked the same thing and procexp tracks my current working directory with no problems.Try comparing the output of System.IO.Directory.GetCurrentDirectory() - with the default project settings this should be the bin\Debug directory of your application.If the XML file you are trying to read is a project item, be sure to set the Build Action property to "Content", and the Copy to Output Directory property appropriately. It might also be worth you reading from your application's root directory rather than the current dir.
Richard
Field "Working directory" on the Debug page is empty. But on the Compile page the field "Build output path" contains "bin\". Should it be empty?. This project was created by Visual Studio in 2003 and has been through two Visual Studio updates since then. Currently the application starts from the bin directory, not bin/Debug
Peter Mortensen
That sounds fine. For a default C# project, the output path will be bin\Debug, and the working directory field is empty.
Richard
The startup project is a VB.NET project (and from which I listed the settings above).
Peter Mortensen
+2  A: 

In visual studio, under the project's settings in the debug tab, you can set the "Working Directory" if you want.

To determine the current working directory in code or in the immediate window in a breakpoint, try

System.IO.Directory.GetCurrentDirectory()
Philip Rieck
For the Immediate Window: isn't it "Debug.Print (System.IO.Directory.GetCurrentDirectory() )"?
Peter Mortensen
Alternative to Immediate Window: menu Debug/Quickwatch/<enter in Expression field>/Press Reevaluate. Or enter in the last row of the Name column of a regular Watch window, followed by the Return key.
Peter Mortensen
or in the immediate window, you can always do "? System.IO.Directory.GetCurrentDirectory()"
Philip Rieck
A: 

The best way is to run the application in windbg (the windows debugger), then attach to the process and run the !handle command. Each open file will have an associated handle. By dumping all the handles for the corresponding process, you will see the corresponding file path.

Here is an example:

!handle 0 f process-id

Replace the process-id with the value of your process id. In place of the process id you can also use the process address. If this does not show the file object, then file handle has already been closed. In this case you need to trace the handles. This can be done with the !htrace command.

steve