- 実行可能ファイルのパスがあります(
C:\Test\n4.TestConsole.exe
)。 File.Exists(path)
を返しますtrue
。File.OpenRead(path)
問題なくストリームを取得します。Process.Start(path)
System.ComponentModel.Win32Exception
このメッセージでをスローします:システムは、指定されたファイルを見つけることができません。
Windows 8 Professional x64-.NET Framework 4.5
編集:これがコードです。
public partial class Form1 : Form
{
public string Path { get; set; }
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
// I put a breakpoint here and verify the Path's value is
// C:\Test\n4.TestConsole.exe.
// File.Exists returns true.
MessageBox.Show(File.Exists(Path));
// File.OpenRead doesn't throw an exception.
using (var stream = File.OpenRead(Path)) { }
// This throws the exception.
Process.Start(Path);
}
}