-->
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.  [ 3 posts ] 
Author Message
 Post subject: Configure.AddAssembly for External Embedded Resource
PostPosted: Wed Nov 16, 2005 10:34 pm 
Newbie

Joined: Wed Nov 16, 2005 10:06 pm
Posts: 4
I have class library project that handles the NHibernate interface, including the loading the mapping file (*.hbm.xml) via the Configuration.AddAssembly method. I'm passing the assembly name as a parameter.

When the project DLL is referenced in another Win EXE project, and the library executes the AddAssembly method, a security exception results:

"That assembly does not allow partially trusted callers."

The EXE project is set to Full Trust, and I tried adding [assembly: AllowPartiallyTrustedCallers] to the class library.

Does anyone have any suggestions on how to access an embedded resource like this from a referenced DLL?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 17, 2005 6:11 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Is your DLL also set to full trust? If you're using .NET 2.0 then more information should be available in the SecurityException (FailedAssemblyInfo property). In case the failing assembly turns out to be NHibernate, you can recompile it with the AllowPartiallyTrustedCallers attribute, but note that this is generally insecure (somebody might map a security-sensitive class using NH and manipulate it through NH).


Top
 Profile  
 
 Post subject: Configure.AddAssembly for External Embedded Resource
PostPosted: Thu Nov 17, 2005 2:37 pm 
Newbie

Joined: Wed Nov 16, 2005 10:06 pm
Posts: 4
I am using .Net 2.0. The failed assembly info indicates only System.Security.SecurityException. The property pages for the class library projects don't appear to have a section on setting security at that level, like the the EXE project does.

I started down the path of compiling NHibernate in 2.0, but did not want to fuss with signing at this stage in the development process.

I rebuilt everything on another machine in .Net '03, and it works fine. I'm getting a bit frustrated with .Net 2.0. I have to disable the Debugging in the Visual Studio hosting process because the IDE throws an error every time an app is rerun after an exception (VSHoste.exe is in use). You have to restart the IDE every time. Plus, I cannot step into the class library to debug it, even though everything is compiled in debug mode. All of this works under the old version of .NET.

Anyway, any further suggestions would be appreciated.


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

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.