I thought that since System.Data.dll was already loaded to the application
domain, type resolution wouldn't need specifying the assembly name. It's
never late to learn!
It's a pain that there isn't a way of doing basically that. Of course,
System.Data.dll may not have been loaded yet - the assembly isn't (as I
understand it) loaded until it's first actually referenced.
If you try this program:
using System;
using System.Data;
using System.Threading;
class MainClass
{
static void Main(string[] args)
{
Console.WriteLine ("Hello, world.");
Thread.Sleep(5000);
OtherClass.DoSomethingDataRelated();
Thread.Sleep(5000);
}
}
class OtherClass
{
public static void DoSomethingDataRelated()
{
// Quick way of avoiding inlining without
// remembering the attribute name to do it
// properly

if (DateTime.Now.Ticks==0)
throw new Exception();
DataSet ds = new DataSet();
}
}
from Visual Studio, watching the Output window, you'll see a 5 second
pause between the start and when the data (and related) assemblies are
loaded.
You can load all referenced assemblies by looking at
Assembly.GetReferencedAssemblies() and loading them recursively. You
could *then* call GetType on each of the assemblies in turn until you
find the right one. Bit grotty though
