Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

automatically loading ALL assemblies

0 views
Skip to first unread message

Pieter Philippaerts

unread,
May 8, 2002, 5:44:17 PM5/8/02
to
"Simon Weaver" <fl...@simonweaver.com> wrote in message
news:OCv2xht9BHA.2212@tkmsftngp03...
> when you dont reference a class in an assembly it isnt loaded.
> is there a way to load all dependent assemblies automatically when the
> program loads. either up front, or in the background.
>
> i could start off a thread to call a static method in each assembly
> to force them to load, but that seems a little clumsy and wanted
> to see if there was a 'proper way' of doing this.
>
> my users dont like long pauses during execution. theyd rather have a
> long pause at the beginning.

We'll post the answer within 8 days when our date reaches yours.

Regards,
Pieter Philippaerts
http://www.mentalis.org/


Tom Clement

unread,
May 8, 2002, 6:28:45 PM5/8/02
to
Funny!

"Pieter Philippaerts" <Pie...@mentalis.org> wrote in message
news:eyvx7kt9BHA.2204@tkmsftngp04...

Simon Weaver

unread,
May 8, 2002, 8:37:50 PM5/8/02
to
ok, well first of all just wanted to let you guys know that the future is
awesome. everything always compiles and this is in fact the only
remaining problem i have with VS.NET (well apart from my other
post in this newsgroup).

on the inaccurate clock - i have a nice brand new dell but the system
clock is *#&@# and keeps gaining time. i applied a patch and it still
screws up so i guess we're stuck with it. aparently its an XP bug.

oh yes and why on earth does MS's newsserver take MY date
and not use its own. methinks thats a bug.

i wish i could take you all 'back to the future', but i am afraid that i
cannot. anybody care to answer my question :-D

-simon

ps. methinks is in the dictionary before anyone complains about that

"Tom Clement" <t...@DeleteThisAvinon.com> wrote in message
news:#im63#t9BHA.2432@tkmsftngp04...

Mattias Sjögren

unread,
May 8, 2002, 9:05:57 PM5/8/02
to
Simon,

>is there a way to load all dependent assemblies automatically when the
>program loads. either up front, or in the background.

Not that I've tried it, but I assume you can recursively call
Assembly.GetReferencedAssemblies() and then Assembly.Load() on each
reference. Something like

using System.Reflection;

void LoadAllReferences(Assembly asm)
{
foreach ( AssemblyName ref in asm.GetReferencedAssemblies() ) {
Assembly asmRef = Assembly.Load( ref );
LoadAllReferences( asmRef );
}
}

static void Main()
{
LoadAllReferences( typeof(YourClass).Assembly );
}


You might have to add code to keep track of which assemblies have been
loaded already.


Mattias

===
Mattias Sjögren (VB MVP)
mattias @ mvps.org
http://www.msjogren.net/dotnet/

MikeP

unread,
May 9, 2002, 1:48:23 PM5/9/02
to
Dell burns their hard drives with a particular CPU. Your CPU does not match
the buring system. You have to re-adjust your tick counts to correct the
times.

Execute the following at a command line. You will need admin privledges. The
first /unregister will fail - ignore the error message and execute it again.

net stop w32time
w32tm /unregister
w32tm /unregister
w32tm /register
net start w32time

"Simon Weaver" <fl...@simonweaver.com> wrote in message

news:uev0AHv9BHA.2656@tkmsftngp03...

A. Lunshof

unread,
May 9, 2002, 5:16:27 PM5/9/02
to
Hi,
Windows XP should automatically contact the time-server once in 3 days or so
to set the correct time, at least Windows does that with me!
"MikeP" <mpo...@nothere.com> wrote in message
news:#IRG4G49BHA.2556@tkmsftngp03...

Simon Weaver

unread,
May 9, 2002, 6:02:25 PM5/9/02
to
it does,
but if the date is already wrong it wont correct that - in fact
i dont think it even corrects the time if the date is wrong.
my clock was going so badly off that it lost 6 hours in a day.
or gained? whatever.

-simon

"A. Lunshof" <a_lu...@hotmail.com> wrote in message
news:LGBC8.799438$Lj7.30879726@Flipper...

Simon Weaver

unread,
May 9, 2002, 9:46:34 PM5/9/02
to
looks like most of the dependent assemblies are loaded for you automatically
the recursion loads the rest, BUT one assembly isnt loaded - perhaps there
is
no internal reference for it. what on earth does thunk mean anyway????????

'Main Database.exe': Loaded
'c:\windows\assembly\gac\system.enterpriseservices\1.0.3300.0__b03f5f7f11d50
a3a\system.enterpriseservices.thunk.dll', No symbols loaded.

so ultimately it doesnt seem to make any difference. perhaps the bottleneck
is in creating the form for the first time and not actually in loading
assemblies?

-simon

here's my current kind of working version of the Mattias' code. thanks

---------------------

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main() {

LoadAllReferences(Assembly.GetExecutingAssembly(), new ArrayList());

Application.Run(new ITDDatabaseForm());
}

private static void LoadAllReferences(Assembly asm, ArrayList loaded) {

Console.WriteLine("----------- "+asm);
foreach ( AssemblyName asr in asm.GetReferencedAssemblies() ) {
Console.WriteLine(asr.FullName);
}
Console.WriteLine("----------- **");

foreach ( AssemblyName asr in asm.GetReferencedAssemblies() ) {

if (loaded.Contains(asr.FullName)) {
Console.WriteLine("### already loaded "+asr.ToString());

}
else {

Console.WriteLine("**** " + asr.ToString());
Assembly asmRef = Assembly.Load( asr );

loaded.Add(asr.FullName);
LoadAllReferences( asmRef, loaded );
}
}
}

"Mattias Sjögren" <mattias.don...@mvps.org> wrote in message
news:urMHDWv9BHA.1304@tkmsftngp07...

Nick

unread,
May 10, 2002, 9:52:38 AM5/10/02
to
It only corrects the time if it is within an hour or 30 mins I forget.
Because of timezones and such. Most of the timesync programs do this as a
fail safe. I don't know why but they just do.

So the timesync in XP only corrects minor errors such as seconds or minites
not days and hours.


"Simon Weaver" <fl...@simonweaver.com> wrote in message

news:OPrg1U69BHA.2172@tkmsftngp04...

Andy Parker

unread,
May 14, 2002, 3:22:02 AM5/14/02
to
Could it be the compilation by the CLR to the machine code that is giving
the delay? Have you thought about putting it in the Global Assembly Cache
(GAC)?

Andy.


"Simon Weaver" <fl...@simonweaver.com> wrote in message

news:uteRFS89BHA.1748@tkmsftngp04...

Scott Hutchinson

unread,
May 16, 2002, 11:19:51 AM5/16/02
to
"Simon Weaver" <fl...@simonweaver.com> wrote in message
news:uteRFS89BHA.1748@tkmsftngp04...

> no internal reference for it. what on earth does thunk mean anyway????????


Meaning of thunk:

http://wombat.doc.ic.ac.uk/foldoc/foldoc.cgi?query=thunk

Why is it relevant?

Scott Hutchinson
s.c.o.t.t.h.u....@usa.net
(to contact me, remove all dots left of @)


Scott Hutchinson

unread,
May 16, 2002, 11:23:08 AM5/16/02
to
Sorry, I didn't finish reading your message before I posted re thunk.

Perhaps you could try loading all the forms up front and hiding them until
you need them.

Scott Hutchinson
s.c.o.t.t.h.u....@usa.net
(to contact me, remove all dots left of @)

"Scott Hutchinson" <sco...@nospamplease.com> wrote in message
news:u1Oxh0O$BHA.2552@tkmsftngp05...

Simon Weaver

unread,
May 16, 2002, 5:36:25 PM5/16/02
to
when you dont reference a class in an assembly it isnt loaded.
is there a way to load all dependent assemblies automatically when the
program loads. either up front, or in the background.

i could start off a thread to call a static method in each assembly


to force them to load, but that seems a little clumsy and wanted
to see if there was a 'proper way' of doing this.

my users dont like long pauses during execution. theyd rather have a
long pause at the beginning.

-simon


0 new messages