MissingMethodException Confusion

  • Thread starter Thread starter Chris Jackson
  • Start date Start date
C

Chris Jackson

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 SessionUserControl 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)this.Page;
parentPage.abandonSession();
}

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

this.abandonSession();
or
base.abandonSession();
or
((SessionPage)this).abandonSession();
or any of about 100 other permutations of referencing the object...

....then I get a System.MissingMethodException. Method not found: Void <my
project>.SessionPage.abandonSession().

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?
 
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
 
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.

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.
 
Is the Base class for SessionPage is in another assembly? Are they in same
folder? You may try to refer the copy in same folder to see if it will
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 SessionUserControl 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)this.Page;

parentPage.abandonSession();

}


SessionPage inherits from System.Web.UI.Page, and SessionUserControl
inherits from System.Web.UI.UserControl.

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
--
 
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.)
 
Back
Top