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
Could we get an update on this issue? It has been over a month now and is seriously starting to hamper the testing on my current project.
answered by juice_johnson (9.8k points)
0 votes
any updates?

answered by dean2008 (960 points)
0 votes
Hi guys,

We understand the pressure you're under, and we thank you for your patience.
The issue is high on our list, and unfortunately was not resolved yet. It is a tough one. As soon as it is solved, we'll get you a patch.
answered by gilz (14.5k points)
0 votes
Hi all,

I really like to thank you for your patience regarding this issue. As said before it is very high on our priorities.

So far we have not managed to consistently reproduce the problem a fact which really slows us down. We do however see the problem from time to time and know that it is really there. From our investigation it we believe that this is caused by some sort of threads conflicts.

We do have a general idea on how to by pass the issue but at this stage are not sure if the workaround actually works or not.

If anyone wishes to join our efforts in testing this please let us know.
answered by lior (13.2k points)
0 votes
I have recently downloaded TypeMock to trial for our organisation and have run into a similar problem to those described above.

XMLSerializer.Deserialize(obj.GetType, strXmlMessage)

The code above, when called within a thread, returns the following error only when typemock is turned on

System.InvalidOperationException: There is an error in XML document System.InvalidProgramException: Common Language Runtime detected an invalid program.

Your last post a month ago says that you are working on the problem. Is there any update on this?
answered by andreserna (140 points)
0 votes
so far we have not managed to locate the issue. As I explained we are having hard time to reproduce this consistently.

If on your side the problem is consisten please let us know maybe with your help we can speed up the process of fixing it.
answered by lior (13.2k points)
0 votes
Any other progress on this? thanks, can I have an email address to email a project if I can reproduce seperately? you will need resharper and nunit.
answered by dean2008 (960 points)
0 votes
Sorry. No progress yet. :(
We'll be happy to get project that produces the problem.
I will send you an email with an address to send the project.
answered by ohad (35.5k points)
0 votes
I dont know what the problem is. I created a sample that specifically reproduces this problem for you months ago. I can reproduce this at will. I spent hours preparing that sample for you. You all have been so vague in what you are actually doing to help resolve the problem that it is really difficult for us as users of the product to help you out if you arent communicating with us. So what was wrong with the sample i sent you?

NHibernate 2.0 alpha will be released very shortly. At that time, there will be many users that are hit with this problem. Basically its a total deal breaker if you want to run NHibenrate 2.0 and TypeMock. This will definitely not look good for typemock in the community. The sad thing is that you have had months to try and resolve the problem.

This would be different if the product was open source, but we are paying customers and this is totally unacceptable.
answered by juice_johnson (9.8k points)
0 votes

As we mentioned in several posts before. We have not yet managed to consistently reproduce this issue.
All our attempts to debug and fix this are really going very slowly because of this.

We've got several samples each of them causes an exception (not always the same) to be thrown every once in a while and only on part of our testing platforms here.
From what we managed to find out this looks like some sort of memory corruption maybe caused by a threading issue.

If the problem is behaving in a more consistent way on your machine (i.e. happens every run) then let me know and we will take it offline and try to duplicate your exact platform here.

We are aware that this is a very urgent problem and we apologize for the delays in solving this. We are also doing our best to solve all issues coming from all our clients.

other than that there is not much else to say. What would you like to know?
answered by lior (13.2k points)