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
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
I'm getting the following exception when running type mock:

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

stack trace is this:

at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializerContract..ctor()
--- End of inner exception stack trace ---
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at System.Xml.Serialization.TempAssembly.get_Contract()
at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings, Type type)
at System.Web.Services.Protocols.SoapClientType..ctor(Type type)
at System.Web.Services.Protocols.SoapHttpClientProtocol..ctor()
at Connect.Sdk.SoapServiceClient..ctor(String url) in C:workConnectGateway.0SolutionsMainConnect.SdkSoapServiceClient.cs:line 25
at Connect.Sdk.ClientServiceFactory.GetService(ServiceTransport transport) in C:workConnectGateway.0SolutionsMainConnect.SdkClientServiceFactory.cs:line 33
at Connect.Sdk.ConnectMessage.Invoke() in C:workConnectGateway.0SolutionsMainConnect.SdkConnectMessage.cs:line 128
at Connect.Sdk.Manager.EntityManager`2.InvokeMessage(Request request) in C:workConnectGateway.0SolutionsMainConnect.SdkManagerEntityManager.cs:line 105
at Connect.Sdk.Manager.PipelineOriginationManager.List(Int32 clientId) in C:workConnectGateway.0SolutionsMainConnect.SdkManagerPipelineOriginationManager.cs:line 60
at Connect.Rules.Test.PipelineOriginationValidationRuleSetTest.Class_Initialize(TestContext context) in C:workConnectGateway.0SolutionsMainTestConnect.Rules.TestPipelineOriginationValidationRuleSetTest.cs:line 46

The test project in which the test sits does not use any type mock features but the exception disappears when I disable TypeMock. I'm using v 3.5.1 of TypeMock.

Any ideas?
asked by enjfdh (680 points)

6 Answers

0 votes
P.S. I have the logs, but they are a bit large to post here
answered by enjfdh (680 points)
0 votes
It could be that you have the same problem described in this post
I will send the patch offline.
answered by ohad (35.4k points)
0 votes

Just incase you did't receive my mail.
We need more information
Can you tell me:
1. Which type you are trying to serialize?
2. How the serialization code looks like?
3. How the test code looks like?

On the other hand if the patch we sent you solved your problem
we'll be happy to know... :D
answered by ohad (35.4k points)
0 votes
I'm running version and I have the problem mentioned here - can I have the patch ?
answered by sune (140 points)
0 votes
If you are using version 4.0.3 the patch is already integrated.
Can you please send me the TypeMock logs?
I'll send a mail with my address offline.

Please note that different problems can lead to the same exception.
answered by ohad (35.4k 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)