I have found an strange behavior when use the open file dialog in c#.
If use this code in Windows XP
the current working directory changes to the path of t
FileDialog (the base class of OpenFileDialog) has a property called AutoUpgradeEnabled which controls whether the dialog takes advantage of the newer file dialogs that were implmented in Vista and newer operating systems when they are available. (Internally this is the difference between calling GetOpenFileName in comdlg32 or in using the IFileDialog interface).
The reason for doing this is that the newer dialogs support a number of features like the "places" bar (see the CustomPlaces collection). An unexpected side effect of this is that the newer IFileDialog implementation does not change the current directory whereas the older version did.
This is a bug in the file dialog implementation and happens regardless of the value of the RestoreDirectory property
If you don't want to use the newer file dialog functionality, the easiest thing to do is to set the AutoUpgradeEnabled to false.