Duplicate assembly loading

A

Andrus

..NET 2 WinForms application.
In need to load dynamically generated assembly from isolated storage or from
temp directory due to Vista UAC.

In VS 2005 IDE I stepped over two lines:

Assembly activeRecordAssembly =
Assembly.LoadFrom(@"c:\temp\ModelEntity.dll");

ActiveRecordStarter.Initialize(activeRecordAssembly, source);

VS output window after first line is OK:

'Myapp.vshost.exe' (Managed): Loaded 'c:\temp\ModelEntity.dll', No symbols
loaded.

After stepping over second line Output windows shows that assembly is loaded
again! :

'Myapp.vshost.exe' (Managed): Loaded
'I:\raamat\Myapp\bin\Debug\ModelEntity.dll', No symbols loaded.

How to prevent ModelEntity.dll duplicate loading ?
It loads wrong assembly. I need that first loaded assembly is used or
assembly is loaded from temp directory.

How to force .net to look into c:\temp directory first for assembly ?
How to load this assembly from isolated storage ?

Andrus
 
N

Nicholas Paldino [.NET/C# MVP]

Andrus,

What is the second line of code that you stepped over? That would help.
 
A

Andrus

second line in my application is

ActiveRecordStarter.Initialize(activeRecordAssembly, source);

this calls Castle ActiveRecord FrameWork initializer and second load happens
inside ActiveRecord

Andrus.

Nicholas Paldino said:
Andrus,

What is the second line of code that you stepped over? That would
help.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Andrus said:
.NET 2 WinForms application.
In need to load dynamically generated assembly from isolated storage or
from
temp directory due to Vista UAC.

In VS 2005 IDE I stepped over two lines:

Assembly activeRecordAssembly =
Assembly.LoadFrom(@"c:\temp\ModelEntity.dll");

ActiveRecordStarter.Initialize(activeRecordAssembly, source);

VS output window after first line is OK:

'Myapp.vshost.exe' (Managed): Loaded 'c:\temp\ModelEntity.dll', No
symbols
loaded.

After stepping over second line Output windows shows that assembly is
loaded again! :

'Myapp.vshost.exe' (Managed): Loaded
'I:\raamat\Myapp\bin\Debug\ModelEntity.dll', No symbols loaded.

How to prevent ModelEntity.dll duplicate loading ?
It loads wrong assembly. I need that first loaded assembly is used or
assembly is loaded from temp directory.

How to force .net to look into c:\temp directory first for assembly ?
How to load this assembly from isolated storage ?

Andrus
 
N

Nicholas Paldino [.NET/C# MVP]

Andrus,

Have you looked at the documentation for the ActiveRecordStarter class
in the Castle documentation? There ^should^ be something there (I'm
assuming that a framework has some documentation).


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Andrus said:
second line in my application is

ActiveRecordStarter.Initialize(activeRecordAssembly, source);

this calls Castle ActiveRecord FrameWork initializer and second load
happens inside ActiveRecord

Andrus.

"Nicholas Paldino [.NET/C# MVP]" <[email protected]>
kirjutas sõnumis
Andrus,

What is the second line of code that you stepped over? That would
help.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Andrus said:
.NET 2 WinForms application.
In need to load dynamically generated assembly from isolated storage or
from
temp directory due to Vista UAC.

In VS 2005 IDE I stepped over two lines:

Assembly activeRecordAssembly =
Assembly.LoadFrom(@"c:\temp\ModelEntity.dll");

ActiveRecordStarter.Initialize(activeRecordAssembly, source);

VS output window after first line is OK:

'Myapp.vshost.exe' (Managed): Loaded 'c:\temp\ModelEntity.dll', No
symbols
loaded.

After stepping over second line Output windows shows that assembly is
loaded again! :

'Myapp.vshost.exe' (Managed): Loaded
'I:\raamat\Myapp\bin\Debug\ModelEntity.dll', No symbols loaded.

How to prevent ModelEntity.dll duplicate loading ?
It loads wrong assembly. I need that first loaded assembly is used or
assembly is loaded from temp directory.

How to force .net to look into c:\temp directory first for assembly ?
How to load this assembly from isolated storage ?

Andrus
 
A

Andrus

Nicholas,

ActiveRecord dynamically builds an NHibernate mapping definition.

Part of that NHibernate mapping is the type information. It's expressed in
the usual .NET manner:

fully.qualified.typename, assemblyname

What's happening is that ActiveRecord is building up a mapping for one of
types inside ModelEntity.DLL and defining it like this:

"Namespace.ModelEntity.ClassName, ModelEntity"

(this is assuming "ModelEntity" is the name of the assembly). As you can
see, there's no path information in there (by definition) so I'm guessing
when this information is passed to NHibernate, it loads some information
using the fully qualified type information above and then normal .NET rules
for locating assemblies happens (current directory, then probing paths).

How to force .NET to search c:\temp directory first for assemblies ?

Andrus.
Have you looked at the documentation for the ActiveRecordStarter class
in the Castle documentation? There ^should^ be something there (I'm
assuming that a framework has some documentation).


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Andrus said:
second line in my application is

ActiveRecordStarter.Initialize(activeRecordAssembly, source);

this calls Castle ActiveRecord FrameWork initializer and second load
happens inside ActiveRecord

Andrus.

"Nicholas Paldino [.NET/C# MVP]" <[email protected]>
kirjutas sõnumis
Andrus,

What is the second line of code that you stepped over? That would
help.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

.NET 2 WinForms application.
In need to load dynamically generated assembly from isolated storage or
from
temp directory due to Vista UAC.

In VS 2005 IDE I stepped over two lines:

Assembly activeRecordAssembly =
Assembly.LoadFrom(@"c:\temp\ModelEntity.dll");

ActiveRecordStarter.Initialize(activeRecordAssembly, source);

VS output window after first line is OK:

'Myapp.vshost.exe' (Managed): Loaded 'c:\temp\ModelEntity.dll', No
symbols
loaded.

After stepping over second line Output windows shows that assembly is
loaded again! :

'Myapp.vshost.exe' (Managed): Loaded
'I:\raamat\Myapp\bin\Debug\ModelEntity.dll', No symbols loaded.

How to prevent ModelEntity.dll duplicate loading ?
It loads wrong assembly. I need that first loaded assembly is used or
assembly is loaded from temp directory.

How to force .net to look into c:\temp directory first for assembly ?
How to load this assembly from isolated storage ?

Andrus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top