Missing Method Exception (REALLY Weird!!!) PLEASE HELP

M

MatthewRoberts

I created a scripting engine that accepts source code, source language,
and various other properties that specify imports, references, and
such. Then, I created a ScriptPanel that allows editing of all this
data, with a drop down for the language, list boxes for the imports and
references, and a highlighting textbox for the script itself.

Next, I inherit from the scripting engine to create custom scripts.
These custom scripts contain properties such as RequiredMethodName,
RequiredMethodParameters, and RequiredMethodReturnValue to clarify how
they should be written, so that consumers of the custom script know
what and how to call into the script. Likewise, the ScriptPanel
contains these same properties such that the panel can be assigned the
values from the custom scripts. In this way, the panel can test whether
the requirements are met in the edited script.

Seems logical, right?

Well, the properties on the custom scripts and on the ScriptPanel are
like so:

Public Property RequiredMethodName() As String
Public Property RequiredMethodParameters() As System.Type()
Public Property RequiredMethodReturnValue() As System.Type

Notice that the types of these properties are "System.Type" and an
array of "System.Type". However, this is apparently not allowed, though
I can find no documentation that says so. Whenever I compile, I get no
errors. Even the background compiler does not give me any squigglies,
and IntelliSense shows the correct property signatures.

However, whenever I actually run the application, whether in debug mode
or by launching the compiled EXE, I get the following error:

System.MissingMethodException: Method not found: Void
ScriptPanel.set_RequiredMethodParameters(System.Type[])

Well, that doesn't make any sense! The property is right there. How can
it not be found? In the code editor, even when I right-click and select
Goto Definition while on that property, it takes me right there to the
code or to the Object Browser, depending on how I reference the project
containing the ScriptPanel (I've tried it both ways).

So, I thought, maybe it doesn't like properties of type System.Type or
arrays of System.Type. (I also tried just with the single System.Type,
commenting out the array, and I get the same error, albeit with a
different method name.) So, I changed the properties to pairs of
Set/Get functions like so:

Public Function GetRequiredMethodParameters() As System.Type()
Public Sub SetRequiredMethodParameters(ByVal parameters As
System.Type())

Again, I get the following error:

System.MissingMethodException: Method not found: Void
ScriptPanel.SetRequiredMethodParameters(System.Type[])

WHAT??!! I just created that function. There it is right there! What
gives? Can you just not pass System.Types around? That would be very
strange if so, and no where can I find that this practice is not
allowed. And if it is not allowed, I am totally screwed because I need
to pass types around. Passing strings around might work, but then
developers and script writers are going to have to fully qualify
everything all the time. Not gonna happen. :)

I have changed properties to functions, the names of the functions,
putting the ScriptPanel in another namespace, the names of parameters,
everything. The only thing that fixes this issue is removing
System.Type and arrays of System.Type. Even when I look at the DLL with
ILDASM, it shows the properties or functions as being there. Yet, at
runtime, it cannot find them.

Can someone please explain this to me? There seems to be something
really wrong here and it is driving me bonkers.
 
G

Guest

Hello Matthew,

We are experiencing the same issue in our application. Where you able to
solve it?

Thanks,
Gloria

MatthewRoberts said:
I created a scripting engine that accepts source code, source language,
and various other properties that specify imports, references, and
such. Then, I created a ScriptPanel that allows editing of all this
data, with a drop down for the language, list boxes for the imports and
references, and a highlighting textbox for the script itself.

Next, I inherit from the scripting engine to create custom scripts.
These custom scripts contain properties such as RequiredMethodName,
RequiredMethodParameters, and RequiredMethodReturnValue to clarify how
they should be written, so that consumers of the custom script know
what and how to call into the script. Likewise, the ScriptPanel
contains these same properties such that the panel can be assigned the
values from the custom scripts. In this way, the panel can test whether
the requirements are met in the edited script.

Seems logical, right?

Well, the properties on the custom scripts and on the ScriptPanel are
like so:

Public Property RequiredMethodName() As String
Public Property RequiredMethodParameters() As System.Type()
Public Property RequiredMethodReturnValue() As System.Type

Notice that the types of these properties are "System.Type" and an
array of "System.Type". However, this is apparently not allowed, though
I can find no documentation that says so. Whenever I compile, I get no
errors. Even the background compiler does not give me any squigglies,
and IntelliSense shows the correct property signatures.

However, whenever I actually run the application, whether in debug mode
or by launching the compiled EXE, I get the following error:

System.MissingMethodException: Method not found: Void
ScriptPanel.set_RequiredMethodParameters(System.Type[])

Well, that doesn't make any sense! The property is right there. How can
it not be found? In the code editor, even when I right-click and select
Goto Definition while on that property, it takes me right there to the
code or to the Object Browser, depending on how I reference the project
containing the ScriptPanel (I've tried it both ways).

So, I thought, maybe it doesn't like properties of type System.Type or
arrays of System.Type. (I also tried just with the single System.Type,
commenting out the array, and I get the same error, albeit with a
different method name.) So, I changed the properties to pairs of
Set/Get functions like so:

Public Function GetRequiredMethodParameters() As System.Type()
Public Sub SetRequiredMethodParameters(ByVal parameters As
System.Type())

Again, I get the following error:

System.MissingMethodException: Method not found: Void
ScriptPanel.SetRequiredMethodParameters(System.Type[])

WHAT??!! I just created that function. There it is right there! What
gives? Can you just not pass System.Types around? That would be very
strange if so, and no where can I find that this practice is not
allowed. And if it is not allowed, I am totally screwed because I need
to pass types around. Passing strings around might work, but then
developers and script writers are going to have to fully qualify
everything all the time. Not gonna happen. :)

I have changed properties to functions, the names of the functions,
putting the ScriptPanel in another namespace, the names of parameters,
everything. The only thing that fixes this issue is removing
System.Type and arrays of System.Type. Even when I look at the DLL with
ILDASM, it shows the properties or functions as being there. Yet, at
runtime, it cannot find them.

Can someone please explain this to me? There seems to be something
really wrong here and it is driving me bonkers.
 
Joined
Jul 5, 2006
Messages
1
Reaction score
0
Gacutil

I had a similar problem with the "Missing Method Exception". In my case, it didn't seem to have anything to do with System.Type though. A developer here recommended that I run GACUTIL /cdl to clear the GAC temp files...that seemed to do the trick. The assembly where the missing method was, was strongly named...so, the version that was in the GAC didn't match the version that I was compiling against. The manifestation of this is that you "see" the method in Visual Studio .NET, but at run-time the method is "missing". Beware the GAC!
 

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