473,796 Members | 2,573 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GetMethods returns invalid methods

Hi,

I'm using .NET CF 2.0. I have a problem in retrieving the exact methods of a
Class in CF. When I do a type.GetMethods () (where type is System.Xml.XPat h.
XPathException for example), I get get_HelpLink (GetProperties also returns
HelpLink) which is not available in CF. I'm loading the exact System.Xml.dll
from the CF directory using ReflectionOnlyL oadFrom. So the dll being probed
is correct but the methods being returned are not the exact ones available.
Here's the code. Any help is very much appreciated. Urgent.

using System;
using System.Reflecti on;
using System.Diagnost ics;
using System.IO;
using System.Collecti ons;
using System.Text;

namespace DNVsCF
{
class Program
{
static string assemblyPath = string.Empty;
static void Main(string[] args)
{
try
{
// Hardcoding args for testing
args = new string[] {@"C:\Program Files\Microsoft Visual
Studio 8\SmartDevices\ SDK\CompactFram ework\2.0\Windo wsCE\System.Xml .dll"};
assemblyPath = Path.GetDirecto ryName(args[0]);
Assembly assembly = Assembly.Reflec tionOnlyLoadFro m(args[0]);
AppDomain appDomain = AppDomain.Curre ntDomain;
appDomain.Refle ctionOnlyAssemb lyResolve += new
ResolveEventHan dler(appDomain_ ReflectionOnlyA ssemblyResolve) ;
Console.WriteLi ne("Loaded: " + assembly.FullNa me + "\
n========");
Type[] types = assembly.GetTyp es();
foreach (Type type in types)
{
// Test System.Xml.XPat h.XPathExceptio n's methods
if (type.FullName == "System.Xml.XPa th.XPathExcepti on")
{
Console.WriteLi ne(type.FullNam e);
Console.WriteLi ne("\nMethodInf o\n=======\n");
foreach (MethodInfo methodInfo in type.GetMethods ()
{
Console.WriteLi ne(methodInfo);

}
}
}
Console.WriteLi ne("\n=======") ;
}
catch (ReflectionType LoadException ex)
{
Console.WriteLi ne(ex.Message + "\n===");
}
}

static Assembly appDomain_Refle ctionOnlyAssemb lyResolve(objec t sender,
ResolveEventArg s args)
{
return Assembly.Reflec tionOnlyLoadFro m(@assemblyPath + "\\" +
(args.Name.Subs tring(0, args.Name.Index Of(','))) + ".dll");
}
}
}
--
Message posted via DotNetMonster.c om
http://www.dotnetmonster.com/Uwe/For...sharp/200509/1
Nov 17 '05 #1
0 1361

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
3130
by: rithish | last post by:
<code> var dt = new Date(2004, 0, 1); alert ( dt.getDate() ); // returns proper date alert ( dt.getUTCFullYear() ); // returns 2003 </code> Why is this so? Or is that I am missing something? Regards, Rithish.
3
2305
by: Joe | last post by:
Back in March I submitted a patch for cgi.py to sourceforge to fix a problem with the handling of an invalid REQUEST_METHOD. I thought I followed all the steps to properly submit the bug and patch but the patch is still sitting there in limbo. This is the first patch I have submitted for Python, did I miss a step in the patch process? What else needs to be done?
5
11765
by: Urs | last post by:
Hi all, I'm rather new to C# so please forgive my ignorance. I'd like to list the public, non-inherited methods of a class. I thought MethodInfo mi = typeof(string).GetMethods( BindingFlags.Public | BindingFlags.DeclaredOnly); would do just that, but no methods at all are returned. Going on, I tried typeof(string).GetMethods(BindingFlags.Public),
6
3017
by: VM | last post by:
In my Win app, I have an event that calls method myMethod.Process() which returns a struct. This method Process() is composed of several other methods: openDB(), checkDB, expireDB(), etc... and all these methods return 0 (Success) or 1 (Fail). If any of these methods return a 0, the process is cancelled. How can I return the 1 value (failure) if the method itself returns a struct? Here's some of the code: private void...
5
3441
by: Nick Flandry | last post by:
I'm running into an Invalid Cast Exception on an ASP.NET application that runs fine in my development environment (Win2K server running IIS 5) and a test environment (also Win2K server running IIS 5), but fails on IIS 6 running on a Win2003 server. The web uses Pages derived from a custom class I wrote (which itself derives from Page) to provide some common functionality. The Page_Load handler the failing webpage starts out like this: ...
5
6915
by: mtv | last post by:
Hi all, I have the following code: ================================ Webservice side: public class MyWS: WebService { private myLib.DataObject curDataObject;
18
3137
by: ben.carbery | last post by:
Hi, I have just written a simple program to get me started in C that calculates the number of days since your birthdate. One thing that confuses me about the program (even though it works) is how global variables and function returns work... For example, I have a global array "char datestring;" which is defined in the function speakdate. speakdate just converts a set of integers (date variables) to a string.
4
2174
by: Varangian | last post by:
Hello, I know that the kind of question below has been asked several times....however I need a clear answer in my specific situation. I have 2 methods. One returns an SqlDataReader and the other returns a DataView. I was considering making them Static methods, so as to avoid creating instance of the class which takes care of these methods, kind of a helper class. Since its a web site the method may be accessed by more than one user at...
1
2349
by: asilter | last post by:
Hi, I'm trying to assign variables where vpSec0 points. void * vpSec0 = NULL; CreateHVFESection0(vpSec0); CreateHVFESection0 function is below.
0
9684
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10459
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10017
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9055
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7552
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6793
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5445
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5577
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.