相关疑难解决方法(0)

为什么无法捕获MissingMethodException?

我在ClickOnce部署的应用程序中依赖于.NET 2.0 SP2(该ApplicationDeployment.CurrentDeployment.CheckForDetailedUpdate(false)方法仅适用于SP2).

我想检查应用启动期间SP2是否存在.我试图通过在调用仅SP2方法后捕获MissingMethodException来检测这一点.

    /// <summary>
    /// The SP2 bootstrapper does not allow HomeSite installation
    /// http://msdn.microsoft.com/en-us/vstudio/bb898654.aspx
    /// So we only advice the user to download .NET 2.0 SP2 manually.
    /// </summary>
    private void CheckDotNet2SP()
    {
        WaitHandle wh = new AutoResetEvent(true);
        try
        {
            wh.WaitOne(1); //this method is .NET 2.0 SP2 only
        }
        //NOTE: this catch does not catch the MissingMethodException
        catch (Exception) //change to catch(MissingMethodException) does not help
        {
            //report that .NET 2.0 SP2 is missing
        }
        finally …
Run Code Online (Sandbox Code Playgroud)

.net c# clr missingmethodexception .net-2.0

11
推荐指数
2
解决办法
2817
查看次数

标签 统计

.net ×1

.net-2.0 ×1

c# ×1

clr ×1

missingmethodexception ×1