inheritance problem

G

Guest

I have a problem with a class hierarchy.
The inheriting and inherited class are in different solutions.

In the base class, (which inherits from System.Windows.Forms.UserControl) i
have a method Test, see

below, and in the class which inherits from it i have a call to a method,
Testx, which in turn calls

Test.
The application builds with no errors or warnings.

In the try catch block i get the exception below:-
"Method not found: Void SSCTemplate.Component.Test()."

If i use 'go to definition' for Test it correctly finds the method, which is
also visible in the

object browser.
Note that when debugging the call to Testx errors immediately, without
stepping into Testx
However if i replace the call to Test with a call to for example Refresh()
the code behaves as

expected, stepping into Testx and then calling Refresh

Also if i change the call in Testx to
SSCTemplate.Component.Test()
the application does not build, Test() is not found and only the methods on
the UserControl are

visible.

Mybase.Test() fails in exactly the same way as Test()

This seems to boil down to a visibilty problem, in that if the method call
is not qualified the

compiler sees it, but if it is not qualified it does not, but at runtime it
is never seen.

This is running on a Citrix box using Windows server 2003, Visual Studio 2003
I have completely reinstalled the environment for a different Citrix user
on a different client pc

with the same results.

any ideas what is going on?

The inheriting class contains ...
inherits SSCTemplate.Component
...
Try
Testx()
Catch e As Exception
MsgBox(e.Message)
End Try
...

Private Sub Testx()

Me.Test()
End Sub


The inherited class contains...

public class SSCTemplate.Component
Inherits System.Windows.Forms.UserControl
....
more Properties and methods
....
Protected Sub Test()
MsgBox("hallo")
End Sub

thanks guy
 
B

Boni

You seems to have reflection problem. Try to register a class library with
regasm or using an appropriate checkbox on solution property page.
I.e. regasm MyBaseClassLib.dll /codebase
HIH,
Boni
 
P

Phill. W

guy said:
In the try catch block i get the exception below:-
"Method not found: Void SSCTemplate.Component.Test()."

Is the "base class" assembly "registered" in the Global Assembly Cache?

If /not/, do you have the latest version of the "base class" assembly in
the /bin (or possibly, /debug/obj) directory of the "derived class"
project?

Do any of your References have the "Copy Local" property (Solution
Explorer, select reference, F4) set to True? This last one caused me
no end of hassle when I was getting started ...

HTH,
Phill W.
 
G

Guest

Phil, yes this is the problem, a dll being refernced was not the most current
one, seems like the only way of ensuring this is to delete the dl and re copy
it in, as VS.NET doesnt reload dlls, it just uses whatever it has in the bin
directory - grrrrr

cheers

guy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top