MissingMethodException Confusion

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chris Jackson

    #1

    MissingMethodException Confusion

    OK, this one has me completely confused. Here's the situation:

    I have a home-rolled session management system, which allows me to share
    session state between my ASP.NET applications and my ASP Classic
    applications.

    To do this, I have a SessionPage class, which is what I inherit all of my
    pages from, and a SessionUserCont rol class, which is what I inherit all of
    my user controls from.

    One of the public methods in both is: void abandonSession( );

    If I call this from a user control, then it simply executes the following
    code in the base class:

    public void abandonSession( ) {
    SessionPage parentPage = (SessionPage)th is.Page;
    parentPage.aban donSession();
    }

    This works like a charm. If, however, I have a page inheriting from
    SessionPage, and I just call:

    this.abandonSes sion();
    or
    base.abandonSes sion();
    or
    ((SessionPage)t his).abandonSes sion();
    or any of about 100 other permutations of referencing the object...

    ....then I get a System.MissingM ethodException. Method not found: Void <my
    project>.Sessio nPage.abandonSe ssion().

    I beg to differ - I can find the method, Intellisense can find the method,
    ildasm can find the method, the user control class can find the method - why
    can't my page find this method???!!!

    Is there anything that can be done to get this to work? I can include the
    user control, so it's not blocking my progress, but it just seems inane that
    I would need to have this extra file. Am I missing something obvious? I'm
    using the 1.1 runtime, the class I am inheriting from is in another assembly
    which I have updated the reference to, and it is registered for COM Interop.
    I am out of ideas - I give up. Help?

    --
    Chris Jackson
    Software Engineer
    --


  • Natty Gur

    #2
    Re: MissingMethodEx ception Confusion

    Hi,

    Check that SessionPage.dll exist with the correct version in the
    application directory and GAC (if exist). it sound like you reference
    correct DLL in design time but wrong one in run time. Usually wrong
    versions in GAC and bin directory cause this.

    Natty Gur, CTO
    Dao2Com Ltd.
    28th Baruch Hirsch st. Bnei-Brak
    Israel , 51114

    Phone Numbers:
    Office: +972-(0)3-5786668
    Fax: +972-(0)3-5703475
    Mobile: +972-(0)58-888377

    Know the overall picture


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!

    Comment

    • Natty Gur

      #3
      Re: MissingMethodEx ception Confusion

      Hi,

      Check that SessionPage.dll exist with the correct version in the
      application directory and GAC (if exist). it sound like you reference
      correct DLL in design time but wrong one in run time. Usually wrong
      versions in GAC and bin directory cause this.

      Natty Gur, CTO
      Dao2Com Ltd.
      28th Baruch Hirsch st. Bnei-Brak
      Israel , 51114

      Phone Numbers:
      Office: +972-(0)3-5786668
      Fax: +972-(0)3-5703475
      Mobile: +972-(0)58-888377

      Know the overall picture


      *** Sent via Developersdex http://www.developersdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      • Chris Jackson

        #4
        Re: MissingMethodEx ception Confusion

        > Check that SessionPage.dll exist with the correct version in the[color=blue]
        > application directory and GAC (if exist). it sound like you reference
        > correct DLL in design time but wrong one in run time. Usually wrong
        > versions in GAC and bin directory cause this.[/color]

        I have done this. In fact, just to be sure, in VS.NET I deleted the old
        reference and created a new one, and then rebuilt. This did not solve the
        problem. I'm still able to access it from a user control calling the
        function from the parent page, but not from the parent page itself.

        --
        Chris Jackson
        Software Engineer
        --


        Comment

        • Chris Jackson

          #5
          Re: MissingMethodEx ception Confusion

          > Check that SessionPage.dll exist with the correct version in the[color=blue]
          > application directory and GAC (if exist). it sound like you reference
          > correct DLL in design time but wrong one in run time. Usually wrong
          > versions in GAC and bin directory cause this.[/color]

          I have done this. In fact, just to be sure, in VS.NET I deleted the old
          reference and created a new one, and then rebuilt. This did not solve the
          problem. I'm still able to access it from a user control calling the
          function from the parent page, but not from the parent page itself.

          --
          Chris Jackson
          Software Engineer
          --


          Comment

          • Chris Jackson

            #6
            Re: MissingMethodEx ception Confusion

            > Is the Base class for SessionPage is in another assembly? Are they in same[color=blue]
            > folder? You may try to refer the copy in same folder to see if it will[/color]
            help.

            All of the pages in my application reside in one assembly.

            They derive from my SessionPage class, which resides in a separate assembly.
            This assembly is in the GAC, and it is being found.

            The methods of the class that handle the session management are all
            working - the code from my overrides all executes.

            Additionally, I can call the public abandonSession( ) function from my ASCX
            pages, which derive from SessionUserCont rol in the same assembly as
            SessionPage. Moreover, this function is able to call the abandonSession( )
            function from the SessionPage class - I just can't do so directly from a
            page that derives from . This is what I do in my ASCX page that works:

            public void abandonSession( ) {

            SessionPage parentPage = (SessionPage)th is.Page;

            parentPage.aban donSession();

            }


            SessionPage inherits from System.Web.UI.P age, and SessionUserCont rol
            inherits from System.Web.UI.U serControl.

            It's just ... weird...

            I have tried every permutation of casting I can think of to determine if
            this is the issue, and I'm still lost. What else can I look at to determine
            why I am seeing this behavior?


            --
            Chris Jackson
            Software Engineer
            Microsoft MVP - Windows XP
            Windows XP Associate Expert
            --


            Comment

            • Luke Zhang [MSFT]

              #7
              Re: MissingMethodEx ception Confusion

              You may try to search how many copies there are on your local computer,
              there may be an incorrect version somewhere, try just keep one copy in the
              same folder with your assembly.

              Luke

              (This posting is provided "AS IS", with no warranties, and confers no
              rights.)

              Comment

              Working...