Hi.
I have the following application structure:
- Asp.Net Mvc 2.0 web application running under medium trust.
- uNHAddIns (v3.0.0.892 built from trunk as of a couple of days ago)
for session nh management
- NH (v3.0.0.1001built from trunk)
- Windsor, ServiceLocator using WindsorAdaptor, Castle.DynamicProxy2,
Castle.Core all rebuilt with AllowPartiallyTrustedCallers attribute
I get an "Operation could destabilize the runtime" exception in
NHibernate.Cfg.MappingSchema.HbmClass (new for 3.0?) when a session
factory is created and nhibernate is configured. The exception is
thrown when the following property is accessed in HbmClass:
public IEnumerable<IEntityPropertyMapping> Properties
{
get { return Items != null ? Items.Cast<IEntityPropertyMapping>():
new IEntityPropertyMapping[0]; }
}
I've heard of similar problems when using Linq under medium trust. I
am guessing this is a bug (probably a microsoft one that we all have
to code around!) that only shows up under medium trust (works fine in
full trust but i'd like to run this app on a shared hosting
environment)
Here is the stack trace:
[VerificationException: Operation could destabilize the runtime.]
NHibernate.Cfg.MappingSchema.HbmClass.get_Properties() +127
NHibernate.Cfg.XmlHbmBinding.RootClassBinder.Bind(HbmClass
classSchema, IDictionary`2 inheritedMetas) +2285
NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.AddRootClasses(HbmClass
rootClass, IDictionary`2 inheritedMetas) +151
NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.AddEntitiesMappings(HbmMapping
mappingSchema, IDictionary`2 inheritedMetas) +269
NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.Bind(HbmMapping
mappingSchema) +164
NHibernate.Cfg.Configuration.AddDeserializedMapping(HbmMapping
mappingDocument, String documentFileName) +296
[MappingException: Could not compile the mapping document: C:\Dev
\Internal\Development\Applications\HttpTest\Source\Mdl.HttpTest.Web\bin
\TestCase.hbm.xml]
NHibernate.Cfg.Configuration.LogAndThrow(Exception exception) +234
NHibernate.Cfg.Configuration.AddDeserializedMapping(HbmMapping
mappingDocument, String documentFileName) +454
NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument
doc) +113
NHibernate.Cfg.Configuration.ProcessMappingsQueue() +63
NHibernate.Cfg.Configuration.AddDocumentThroughQueue(NamedXmlDocument
document) +85
NHibernate.Cfg.Configuration.AddXmlReader(XmlReader hbmReader,
String name) +109
NHibernate.Cfg.Configuration.AddXmlFile(String xmlFile) +359
Mdl.HttpTest.Web.MvcApplication.nhConfigurator_AfterConfigure(Object
sender, ConfigurationEventArgs e) in C:\Dev\Internal\Development
\Applications\HttpTest\Source\Mdl.HttpTest.Web\Global.asax.cs:129
uNhAddIns.SessionEasier.AbstractConfigurationProvider.DoAfterConfigure(Configuration
cfg) +168
uNhAddIns.SessionEasier.DefaultSessionFactoryConfigurationProvider.Configure()
+173
uNhAddIns.SessionEasier.SessionFactoryProvider.Initialize() +226
uNhAddIns.SessionEasier.SessionFactoryProvider.GetFactory(String
factoryId) +55
Mdl.HttpTest.Web.MvcApplication.InitializeNHSessionManagement() in
C:\Dev\Internal\Development\Applications\HttpTest\Source
\Mdl.HttpTest.Web\Global.asax.cs:122
Mdl.HttpTest.Web.MvcApplication.Application_Start(Object sender,
EventArgs e) in C:\Dev\Internal\Development\Applications\HttpTest
\Source\Mdl.HttpTest.Web\Global.asax.cs:89
[HttpException (0x80004005): Could not compile the mapping document: C:
\Dev\Internal\Development\Applications\HttpTest\Source\Mdl.HttpTest.Web
\bin\TestCase.hbm.xml]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext
context, HttpApplication app) +4170257
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr
appContext, HttpContext context, MethodInfo[] handlers) +205
System.Web.HttpApplication.InitSpecial(HttpApplicationState state,
MethodInfo[] handlers, IntPtr appContext, HttpContext context) +336
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr
appContext, HttpContext context) +350
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr
appContext) +382
[HttpException (0x80004005): Could not compile the mapping document: C:
\Dev\Internal\Development\Applications\HttpTest\Source\Mdl.HttpTest.Web
\bin\TestCase.hbm.xml]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context)
+11301302
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)
+88
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest
wr, HttpContext context) +4338644
Any suggestions would be appreciated, i don't feel confident changing
the nh source code so I'm considering going back to previous versions
of nh and unhaddins to see if that helps.
Thanks
Rob
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.