chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
I have traced a problem down to TypeMock but not sure how extensive the problem is. All the issues started popping up with the latest source of NHibernate from the trunk so I thought the issue was there. Basically running the unit tests for NHibernate would produce an error similiar to this.

NHibernate.Test.CfgTest.ConfigurationFixture.CacheConfiguration : NHibernate.MappingException : Could not compile the mapping document: NHibernate.DomainModel.ABC.hbm.xml

  ----> System.InvalidOperationException : There is an error in XML document (0, 0).

  ----> System.InvalidProgramException : Common Language Runtime detected an invalid program.

basically its an issue with the XmlSerializer and TypeMock. After working with the NHibernate team and nobody could reproduce the error, I found this post ... 5&SiteID=1

The reporter ultimately figured out that uninstalling TypeMock fixed the problem. I simply disabled TypeMock from Vs.Net and that resolved the problem. ReEnabled TypeMock and the problem returned.

The issue seems to stem from a conflict between TypeMock and The XmlSerializer because the issue the NHibernate tests are with the XmlSerializer just as the poster describes in the link above.

Partial stack from NHibernate is

       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)

I saw that there are other issues with the CLR detecting an Invalid program and TypeMock on this forum. Hopefully this issue is being fixed. Otheriwse, let me know if I can provide more information to get this issue resolved.

asked by juice_johnson (9.8k points)

33 Answers

0 votes
yes, i can reproduce the problem consistently.
answered by juice_johnson (9.8k points)
0 votes
Lets take it offline
ill send you an email with all the details.
answered by lior (13.2k points)
0 votes

I'm happy to say that with the help of Jesse (AKA juice_johnson) - many thanks, a fix for this issue is available. :D

I will send the fix to all parties posting in this thread and it will be integrated into our next release.
However if anyone else wish to get it, please contact us.
answered by lior (13.2k points)