【发布时间】:2010-11-09 19:44:14
【问题描述】:
在找不到引用的 .dll 时是否可以捕获异常?
例如,我有一个引用第三方 dll 的 C# 项目;如果找不到该 dll,则会引发异常。异常是 System.IO.FileNotFoundException,但我无法确定在哪里捕获它。以下代码似乎不起作用:
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
try
{
// code goes here
}
catch (Exception exc)
{
MessageBox.Show(exc.ToString());
}
}
}
【问题讨论】: