ファイル ダイアログを開こうとしていますが、ShowDialog を呼び出すと例外が発生します。このコードは常に正常に機能していましたが、Silverlight 4 にアップグレードすると何らかの問題が発生したと思います。
コード:
var dlg = new OpenFileDialog { Filter = "CSV Files (*.csv)|*.csv" };
if (dlg.ShowDialog() == true)
{
Upload(dlg.File);
}
例外:
Directory = 'dlg.File.Directory' threw an exception of type 'System.Security.SecurityException'
{System.Security.SecurityException: File operation not permitted. Access to path file.csv' is denied.
at System.IO.FileSecurityState.EnsureState()
at System.IO.FileInfo.get_DirectoryName()
at System.IO.FileInfo.get_Directory()
}
正しいファイル名とファイルサイズを取得しましたが、ディレクトリとディレクトリ名に関する情報がないため、ディレクトリのオプションを取得するのは問題のようです。