-->
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.  [ 2 posts ] 
Author Message
 Post subject: XmlSerializer problem in NHibernate 2.0.0.Alpha1
PostPosted: Mon Mar 31, 2008 10:37 am 
Senior
Senior

Joined: Thu Jun 21, 2007 8:03 am
Posts: 127
Location: UK
Hi,

I've just tried upgrading our application to NHibernate 2.0.0.Alpha1. The main code works fine, but there is a small bit of legacy web-service code that calls out to a .Net assembly using COM Interop. The host process is dllhost.exe, and the configuration is set through code since there is no .config file.

The error appears to be in Microsoft's XmlSerializer. I can get round the problem by giving IWAM_<machine_name> access to C:\Windows\Temp, but I was wondering if there was a way of configuring NHibernate to avoid the use of temporary files?

Hibernate version: NHibernate-2.0.0.Alpha1

Code between sessionFactory.openSession() and session.close():
Code:
// NHibernate configuration is entered in code rather than using .config files
//  because the COM-Interop stuff uses the dllhost.exe.config file in System32.
configuration.Properties.Add(NHibernate.Cfg.Environment.ConnectionProvider, "NHibernate.Connection.DriverConnectionProvider");
configuration.Properties.Add(NHibernate.Cfg.Environment.Dialect,            "NHibernate.Dialect.MsSql2005Dialect");
configuration.Properties.Add(NHibernate.Cfg.Environment.ConnectionDriver,   "NHibernate.Driver.SqlClientDriver");
configuration.Properties.Add(NHibernate.Cfg.Environment.ConnectionString,   m_connectionString);
configuration.AddAssembly(m_nHibernateAssembly);


Full stack trace of any exception that occurs:
Code:
NHibernate.MappingException: Could not compile the mapping document: Nhs.Scotland.Domain.User.hbm.xml ---> System.InvalidOperationException: Unable to generate a temporary class (result=1).
error CS2001: Source file 'C:\WINDOWS\TEMP\iyijl-_n.0.cs' could not be found
error CS2008: No inputs specified

   at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence)
   at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies)
   at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence)
   at System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlMapping xmlMapping, Type type, String defaultNamespace)
   at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)
   at System.Xml.Serialization.XmlSerializer..ctor(Type type)
   at NHibernate.Cfg.XmlHbmBinding.Binder.Deserialize[T](XmlNode node)
   at NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.Bind(XmlNode node)
   at NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument doc)
   --- End of inner exception stack trace ---
   at NHibernate.Cfg.Configuration.LogAndThrow(Exception exception)
   at NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument doc)
   at NHibernate.Cfg.Configuration.ProcessMappingsQueue()
   at NHibernate.Cfg.Configuration.AddDocumentThroughQueue(NamedXmlDocument document)
   at NHibernate.Cfg.Configuration.AddXmlReader(XmlReader hbmReader, String name)
   at NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream, String name)
   at NHibernate.Cfg.Configuration.AddResource(String path, Assembly assembly)
   at NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly)
   at NHibernate.Cfg.Configuration.AddAssembly(String assemblyName)


Any help/insight would be appreciated.

Thanks,
Richard


Top
 Profile  
 
 Post subject: XmlSerializer problem in NHibernate 2.0.0.Alpha1
PostPosted: Mon Mar 31, 2008 4:02 pm 
Senior
Senior

Joined: Thu Jun 21, 2007 8:03 am
Posts: 127
Location: UK
Hi,

Doesn't look like this is a quick fix, or that you can alter the location of the XmlSerializer generated files without using a config file. :-(

http://www.hanselman.com/blog/ChangingWhereXmlSerializerOutputsTemporaryAssemblies.aspx

Richard


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.