I'm trying to open an xml file created on the fly. Here is the code where I write the file to disk, then read it immedately.
string filename = "/Files/Runs/" + LoginServer.CurrentUsername + "/NEMSIS/" + SaveDestination + ".xml";
y.WriteToFile(filename);
System.Diagnostics.Process.Start(filename);
Code that does the writing:
// Write an EMSDataset to file
public void WriteToFile(string filename)
{
var Ser = new XmlSerializer(typeof(EMSDataSet));
using (StreamWriter Sw = new StreamWriter(filename))
Ser.Serialize(Sw, _nemsisDocument);
}
Error information:
A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in System.dll
Additional information: The system cannot find the file specified
If there is a handler for this exception, the program may be safely continued.
What causes this Exception? The filename is exactly the same, yet I can't read the document. The file is created (I can navigate to it in Windows Explorer). Does Process.Start()
search in another location?