[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.sdk

DocErr? Regarding MethodBuilder.Invoke

Mark Hurd

11/16/2002 4:14:00 PM

Based on my reading of:

http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemReflectionEmitMethodBuilderClassInvoke...

which is the same as:

ms-help://MS.NETFrameworkSDK/cpref/html/frlrfsystemreflectionemitmethodbuilder
classinvoketopic1.htm

when you get a NotSupportedException while attempting to call Invoke on a
MethodBuilder you should

"Retrieve the method using GetMethod and call InvokeMember on the returned
MethodInfo." (because Invoke is not supported in this instance.)

However, although GetMethod does return a MethodInfo, there is no InvokeMember
method that I can find that uses a MethodInfo... "InvokeMember" in the quote
above is linked to Type:InvokeMember, but that expects a method name
(String) -- presumably it calls GetMethod internally, so may work, but that
doesn't make the documentation right :-)

I've found more information at:

ms-help://MS.NETFrameworkSDK/cpguidenf/html/cpcondefiningmethodwithreflectione
mit.htm

(same as

http://msdn.microsoft.com/library/en-us/cpguide/html/cpcondefiningmethodwithreflecti...

) which says: Although MethodBuilder is derived from MethodInfo, some of the
abstract methods defined in the MethodInfo class are not fully implemented in
MethodBuilder. These MethodBuilder methods throw the NotSupportedException.
For example the MethodBuilder.Invoke method is not fully implemented.

It goes on to imply that I should use reflection normally to access the
method. Given this consensus, that's what I'll try next.

Regards,
Mark Hurd, B.Sc.(Ma.) (Hons.)


2 Answers

Mark Hurd

11/21/2002 4:23:00 AM

0

Mark Hurd <markhurd@ozemail.com.au> wrote:
>
>
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemReflectionEmitMethodBuilderClassInvoke...
>
> which is the same as:
>
>
ms-help://MS.NETFrameworkSDK/cpref/html/frlrfsystemreflectionemitmethodbuilder
> classinvoketopic1.htm
>
> [say]
>
> "Retrieve the method using GetMethod and call InvokeMember on the returned
> MethodInfo." (because Invoke is not supported in this instance.)
>
> [and]
>
>
ms-help://MS.NETFrameworkSDK/cpguidenf/html/cpcondefiningmethodwithreflectione
> mit.htm
>
> (same as
>
>
http://msdn.microsoft.com/library/en-us/cpguide/html/cpcondefiningmethodwithreflecti...
>
> ) [...] says: Although MethodBuilder is derived from MethodInfo, some of the
> abstract methods defined in the MethodInfo class are not fully implemented
> in MethodBuilder. These MethodBuilder methods throw the
> NotSupportedException. For example the MethodBuilder.Invoke method is not
> fully implemented.

The implementation of MethodBuilder.Invoke in the SSCLI just throws the
abovementioned exception. If the .NET Framework implementation is the same,
the documentation error is rather significant :-) Simply, the page of
documentation for MethodBuilder.Invoke should be replaced by:

This method is not implemented. Calling it will throw a
NotSupportedException.

Regards,
Mark Hurd, B.Sc.(Ma.) (Hons.)


(Tian Min Huang)

12/13/2002 4:07:00 PM

0

Dear Mark,

Thanks a lot for your post and feedback. I have reported this issue to our
Documentation Team. Thank you again for your support!

Have a nice day!

Regards,
HuangTM
This posting is provided "AS IS" with no warranties, and confers no rights.