[英]Openfiledialog throwing System.IO.FileNotFoundException
I was implementing openfiledialog and after I run the program I get this error我正在实现 openfiledialog,运行程序后出现此错误
System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Drawing.Common,
I don't know why it happens, I tried removing multi-threading but still, it didn't work I also tried adding STAThread but it didn't work as well, it's expected to open up a new window but it doesn't here's the code我不知道为什么会这样,我尝试删除多线程,但还是不行这是代码
Thread thread = new Thread(delegate ()
{
Console.Title = $"Low Pixel | Loading Combos...";
using (OpenFileDialog dialog = new OpenFileDialog())
{
dialog.Title = "Load Combo List";
dialog.Filter = "Text Files |*.txt";
dialog.RestoreDirectory = true;
// sets the settings of the dialog
if (dialog.ShowDialog() == DialogResult.OK)
{
Checker.Combo = new ConcurrentQueue<string>(File.ReadAllLines(dialog.FileName));
// sets the combo variable to read the filename of the dialog selected file
Console.WriteLineFormatted("Sucessfully loaded {0} lines of combos", Color.Aqua, Color.LightBlue, new object[]
{
Checker.Combo.Count()
});
Thread.Sleep(2500);
return;
// returns to the method that the function has been called from
}
}
});
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
检查你的 nuget 包,错误似乎你缺少 System.Drawing.Common 我认为需要渲染对话框
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.