-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Assembly loaded from wrong location
PostPosted: Mon Oct 15, 2007 5:07 am 
Newbie

Joined: Mon Jun 25, 2007 3:59 pm
Posts: 15
To reproduce:

1. Create assembly ModelEntity.dll
2. Put this assembly to c:\temp and application startup directory
3. Run the code from VS 2005 using ActiveRecord :

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

ActiveRecordStarter.Initialize(activeRecordAssembly, source);

4. Open Debug / Windows / Output

Observed:

1. Output window indicates that wrong assembly is re-loaded (and initialized by activerecord):

Loaded 'C:\mydir\myapp\bin\Debug\ModelEntity.dll', No symbols loaded.

This causes any attemp to use ActiveRecord to fail.

I'm using c:\temp directory because Vista UAC does not allow to replace assembly in appication directory.

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 your ModelEntity.DLL and defining it like this:

Code:
"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 fix ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.