[Mono-list] Loading System.Data

Piers Haken piersh@friskit.com
Fri, 8 Mar 2002 23:48:51 -0800

I'll answer my own question:

still, the docs are wrong, grrr...


-----Original Message-----
From: Piers Haken 
Sent: Friday, March 08, 2002 9:56 PM
To: Mono Hackers List (E-mail)
Subject: [Mono-list] Loading System.Data

This is a .NET question more than a mono question, I'm hoping someone
can shed some light on this:

I'm trying to load Assemblies from the GAC using System.Load(string). 

I'm using the code from the docs for that method:

Here's my test case:

using System.Reflection;
namespace Foo
	class Foo
		public static void Main ()
			Assembly ass = Assembly.Load ("System.Data");

Pretty simple, huh? But I'm getting an exception (see below). This
worked fine in beta2 - I just upgraded to release.

Can someone try to run this for me and tell me if they get the same

Is there any other way to load an assembly like this? I tried
Assembly.LoadFrom() but it can't find it either.


C:\> test.exe
Unhandled Exception: System.IO.FileNotFoundException: File or assembly
name System.Data, or one of its dependencies, was not found.
File name: "System.Data"
   at System.Reflection.Assembly.nLoad(AssemblyName fileName, String
codeBase, Boolean isStringized, Evidence assemblySecurity, Boolean
throwOnFileNotFound, Assembly locationHint, StackCrawlMark& stackMark)
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,
Boolean stringized, Evidence assemblySecurity, StackCrawlMark&
   at System.Reflection.Assembly.LoadFrom(String assemblyFile, Evidence
security Evidence)
   at Foo.Foo.Main()

Fusion log follows:
=== Pre-bind state information ===
LOG: Where-ref bind. Location = C:\System.Data
LOG: Appbase = C:\
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).

LOG: Application configuration file does not exist.
LOG: Policy not being applied to reference at this time (private,
custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/System.Data
<file:///C:/System.Data> .


Mono-list maillist  -  Mono-list@ximian.com