Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / October 2007

Tip: Looking for answers? Try searching our database.

Duplicate assembly loading

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andrus - 14 Oct 2007 14:32 GMT
.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
Nicholas Paldino [.NET/C# MVP] - 14 Oct 2007 14:57 GMT
Andrus,

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

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> .NET 2 WinForms application.
> In need to load dynamically generated assembly from isolated storage or
[quoted text clipped - 27 lines]
>
> Andrus
Andrus - 14 Oct 2007 19:18 GMT
second line in my application is

ActiveRecordStarter.Initialize(activeRecordAssembly, source);

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

Andrus.

> Andrus,
>
[quoted text clipped - 33 lines]
>>
>> Andrus
Nicholas Paldino [.NET/C# MVP] - 15 Oct 2007 00:05 GMT
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).

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> second line in my application is
>
[quoted text clipped - 42 lines]
>>>
>>> Andrus
Andrus - 15 Oct 2007 10:00 GMT
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
[quoted text clipped - 46 lines]
>>>>
>>>> Andrus

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.