WebServiceHost issues with MissingMethod errors

WebServiceHost issues with MissingMethod errors

Old forum URL: forums.lhotka.net/forums/t/3336.aspx


gartnerj posted on Monday, August 06, 2007

Folks,

i am getting the following when I switch from local running of the BO to the WebServiceHost on a remote machine.  I have checked that the dll's are all up to date, and this NVList where the error occurs is VERY similary to another NVlist that does work.

The error is:

Method not found: 'System.Collections.Generic.List`1<Dal.CustomReleaseOptions> .Dal.CustomReleaseOptions.FetchMultiSelectCodes()'.

I've already checked that the class is marked Serializable, I've used Reflector -- the FetchMultiSelectCodes IS in the DAL dll that is on the WebServicesHost.

Does anyone have any good methodologies for solving these types of problems with the webservicehost?

Thanks,

Jim

JoeFallon1 replied on Tuesday, August 07, 2007

I learned something recently about generics, refelction, methods and base classes that came to light when I upgraded from 1.x to 2.1.

Let's use the Item method of a ROC as an example.

In 1.x I wrote code directly in my ROC that created the Item method and any overloads.

e.g. 

Item(index as Integer)

Item (ID as String)

Item(index as Integer, useInterface As Boolean)

When I upgraded to 2.0, the Item(index as Integer) became part of the CSLA base class and then I moved Item(index as Integer, useInterface As Boolean) into my Base class that inherits from CSLA and that all my ROCs then inherit from.

I noticed that my reflection code "sees" the methods in the order of their base classes so an array of MemberInfo objects sees them like this:

0 = Item (ID as String)

1 = Item(index as Integer, useInterface As Boolean)

2 = Item(index as Integer)

In my reflection code when I called Item and passed an Integer I assumed it would find the right method - but it did not. It gave a similar error to what you are seeing about incorrect parameters and the generic '1.

So in order to get the correct propertyinfo I used code like this:

'JF 6/26/07 - This gets us the correct propertyinfo for any collection with Item(ByVal index As Integer)
Dim itemProp As PropertyInfo = Parent.GetType().GetProperty("Item", New Type() {GetType(Integer)})

So you should review your class hierarchy and see if you have overlaoded methods and then determine which one is really being called.

Joe

 

 

 

 

 

 

 

gartnerj replied on Wednesday, August 08, 2007

Thanks for the help Joe -- it turned out that a member of my team install a version of a shared assembly (the one that was being complained about with the missing method) into the GAC without telling anyone, so of course THAT version didn't have the method in question, so....

 

Still, I'm wondering if anyone has a good way of debugging these situations -- remote debugger, other tools?????

Thanks

Copyright (c) Marimer LLC