// break: fileName is "test.obj", good
private static void parse(string fileName, OnVertex onVertex, OnNormal onNormal, OnTexCoord onTexCoord, OnFace onFace, OnMaterial onMaterial)
{
// break: actualFileName is "data/models/test.obj", good
string actualFileName = Util.DATA_DIR + "models/" + fileName;
// break: actualFileName is still good, everything looks good
StreamReader reader = new StreamReader(new FileStream(actualFileName, FileMode.Open, FileAccess.Read));
[later]
parse("test.obj", ...); // all good
OpenFileDialog fileDialog = ...;
fileDialog.ShowDialog(); // (browsing for the file)
// break: fileDialog.SafeFileName is "test.obj", good
parse(fileDialog.SafeFileName, ...); // EXCEPTION! "Could not access part of path"
Guess The Bug