473,471 Members | 1,868 Online
Bytes | Software Development & Data Engineering Community
Create 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.XPath.
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 ReflectionOnlyLoadFrom. 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.Reflection;
using System.Diagnostics;
using System.IO;
using System.Collections;
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\CompactFramework\2.0\WindowsCE\ System.Xml.dll"};
assemblyPath = Path.GetDirectoryName(args[0]);
Assembly assembly = Assembly.ReflectionOnlyLoadFrom(args[0]);
AppDomain appDomain = AppDomain.CurrentDomain;
appDomain.ReflectionOnlyAssemblyResolve += new
ResolveEventHandler(appDomain_ReflectionOnlyAssemb lyResolve);
Console.WriteLine("Loaded: " + assembly.FullName + "\
n========");
Type[] types = assembly.GetTypes();
foreach (Type type in types)
{
// Test System.Xml.XPath.XPathException's methods
if (type.FullName == "System.Xml.XPath.XPathException")
{
Console.WriteLine(type.FullName);
Console.WriteLine("\nMethodInfo\n=======\n");
foreach (MethodInfo methodInfo in type.GetMethods()
{
Console.WriteLine(methodInfo);

}
}
}
Console.WriteLine("\n=======");
}
catch (ReflectionTypeLoadException ex)
{
Console.WriteLine(ex.Message + "\n===");
}
}

static Assembly appDomain_ReflectionOnlyAssemblyResolve(object sender,
ResolveEventArgs args)
{
return Assembly.ReflectionOnlyLoadFrom(@assemblyPath + "\\" +
(args.Name.Substring(0, args.Name.IndexOf(','))) + ".dll");
}
}
}
--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...sharp/200509/1
Nov 17 '05 #1
0 1346

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

Similar topics

23
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...
3
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...
5
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(...
6
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...
5
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
by: mtv | last post by:
Hi all, I have the following code: ================================ Webservice side: public class MyWS: WebService { private myLib.DataObject curDataObject;
18
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...
4
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...
1
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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,...
1
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
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.