Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1007311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:35:57+00:00 2026-05-16T08:35:57+00:00

I have a dependency on .NET 2.0 SP2 in my ClickOnce deployed application (the

  • 0

I have a dependency on .NET 2.0 SP2 in my ClickOnce deployed application
(the ApplicationDeployment.CurrentDeployment.CheckForDetailedUpdate(false) method is SP2 only).

I would like to check whether SP2 is present during app startup. I have tried to detect this by catching MissingMethodException after calling a SP2-only method.

    /// <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
        {
            wh.Close();
        }
    }

The code in catch never executes when this runs on .NET 2.0 without SP2. The exception is only caught by the AppDomain.CurrentDomain.UnhandledException event handler.

How is it possible that the MissingMethodException is not caught? I can imagine that this is a special case – the CLR hits a method that does not exist and somehow it is not possible to pass this to the catch block. I would like to understand the principle behind this.

Anyone has any resources on this issue? Are there any other exceptions that cannot be caught in a catch block?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T08:35:57+00:00Added an answer on May 16, 2026 at 8:35 am

    I suspect it’s happening at JIT time, before the method is even properly entered – i.e. before your catch block is hit. It’s possible that if you catch MissingMethodException in the calling method, that will sort it out… particularly if you decorate CheckDotNet2SP with MethodImpl[MethodImplOptions.NoInlining]. It still sounds like it would be pretty dicey though.

    You could always check for the presence of the method with reflection rather than by trying to call it though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been looking at various dependency injection frameworks for .NET as I feel
I have been adding dependency injection to my code because it makes by code
I have read a lot of articles on Dependency Injection as well as watched
There have been several questions already posted with specific questions about dependency injection ,
I am having dependency troubles. I have two classes: Graphic and Image . Each
I have a Windows Service project, A, with a dependency on a class library
I'm struggling to understand Dependency Properties in Silverlight 2. Does anybody have a good
I have an application dependent on some internal web services, and so we want
I have several properties that are dependent on the environment the application is running.
I am trying to work out a way to use dependency injection with ASP.NET

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.