Dynamically load assembly

  • Thread starter Thread starter Boni
  • Start date Start date
B

Boni

Dear Sirs,
If I dynamically load assembly into the memory by Load(byte[]) how long do I
have to preserve the array valid? Can it be destructed just after the load
call?
Thanks in advance,
Boni
 
Boni,
If I dynamically load assembly into the memory by Load(byte[]) how long do
I have to preserve the array valid? Can it be destructed just after the
load call?

You're in a GC world, meaning it's not your problem anymore :)

That said, I'd probably just leave it alone :)
 
Hi,
thanks you Tomas.
But I meant with this question, what will be if the variable will go out of
scope?
I have a error, that if I load regestered assembly dynamically from an array
and then use XML Serilaization it throws the exception, where if I use
LoadFrom it is not. So my thougth is, that it need assembly, where the
buffer is allready destructed.

Tomas Restrepo (MVP) said:
Boni,
If I dynamically load assembly into the memory by Load(byte[]) how long
do I have to preserve the array valid? Can it be destructed just after
the load call?

You're in a GC world, meaning it's not your problem anymore :)

That said, I'd probably just leave it alone :)
 
Hi Boni,
Hi,
thanks you Tomas.
But I meant with this question, what will be if the variable will go out
of scope?

Again, not your problem. As long as there's a reference out there pointing
to the memory, it won't be GCd. I doubt this is your problem.
I have a error, that if I load regestered assembly dynamically from an
array and then use XML Serilaization it throws the exception, where if I
use LoadFrom it is not.

What exception are you getting? The problem might very well have to do with
the fact that Load and LoadFrom use different load contexts, for example, or
due to the fact you're not passing any explicit evidence, or a whole other
set of things...
 
Back
Top