I got the latest source and compiled. When using the newly
built NHibernate assembly, I started receiving runtime errors that my mapping
documents could not be compiled. I’ve tried to track down the
problem but get inconsistent results and the problem doesn’t always
occur.
Here is the error:
NHibernate.MappingException:
Could not compile the mapping document:
GameFly.Retail.EncryptionTranslator.Domain.Mappings.Account.hbm.xml
NHibernate.MappingException:
Could not compile the mapping document:
GameFly.Retail.EncryptionTranslator.Domain.Mappings.Account.hbm.xml --->
System.InvalidOperationException: There is an error in XML document (0, 0).
---> System.InvalidProgramException: Common Language Runtime detected an
invalid program.
at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializerContract..ctor()
--- End of inner exception stack trace ---
at
System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String
encodingStyle, XmlDeserializationEvents events)
at
System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String
encodingStyle)
at
System.Xml.Serialization.XmlSerializer.Deserialize(TextReader textReader)
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)
The interesting thing to note about the exception is the
part where it mentions that the common language runtime detected an invalid program.
This occurs when I run tests with TestDriven.net or VSTS Test. Restoring
my previous version of the nhibernate 2.0 alpha, which looks like it was source
from 11/15/2007, resolves the problem and everything runs as normal. Not
really sure where to look for the problem but let me know if I can provide more
information.
This can occur with a simple mapping file like this.
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
namespace="GameFly.Retail.EncryptionTranslator.Domain"
assembly="GameFly.Retail.EncryptionTranslator.Domain"
schema="Customer.dbo"
xmlns="urn:nhibernate-mapping-2.2">
<class name="Account"
table="Account"
mutable="true" lazy="false">
<!--IDENTITY-->
<id name="Id" access="nosetter.camelcase-underscore" column="intAccountId" type="System.Int32">
<generator class="identity" />
</id>
<!--PROPERTIES-->
<property name="Password" column="vchPassword" type="AnsiString" length="50" not-null="true" />
</class>
</hibernate-mapping>
Thanks,
Jesse