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
Every once in a while I get an InvalidProgramException when I run tests via the command line tool mstest.exe. As this exception is thrown in case of invalid IL, it could be related to the changes made on-the-fly by TypeMock.

I have researched this extensively without being able to exactly pinpoint what is going wrong. The error only appears in about 10% of the runs and only if the TypeMock environment variables are enabled (i.e. by setting the following environment variables:)

set Cor_Enable_Profiling=0x1
set COR_PROFILER={B146457E-9AED-4624-B1E5-968D274416EC}

The test suite in questions doesn't use TypeMock but the test project does reference TypeMock. I'm unable to reproduce the error if I set Cor_Enable_Profiling=0x0.

I can't say for sure if this is caused by TypeMock or not. However, if I disable TypeMock I am unable to reproduce the error. Please let me know if there is any way for you to verify if TypeMock is or isn't the source of the error.

I'm using 3.5.0.0 (Enterprise) and Visual Studio 2005 Team Suite.
asked by brian.rasmussen (7.2k points)

17 Answers

0 votes
I had the same problem with a MSTest project that did not use TypeMock or even reference TypeMock. I took this problem to the component vendor's tech support, as the stack trace pointed way down into the bowels of their component. The only reason I thought to consider TypeMock is TypeMock is the only thing I've installed between now and when the tests worked.

Unfortunately, I had to uninstall TypeMock, as I have to be able to get things done. Too bad, as I was very excited to use it.

For what it is worth, here is the stack trace:
--
TestCase 'TestProject1.UnitTest1.TestMethod1'
failed: System.InvalidProgramException: Common Language Runtime detected an invalid program.
at Atalasoft.Imaging.Lib.IS.FirstLevelIOCBWrapper.AddRealCallbacks(IOCallbacks_NonMarshallingWrapper wrapper, Boolean bAppend)
at Atalasoft.Imaging.Lib.IS.FirstLevelIOCBWrapper.OpenUserSource(UserOpenCallback pOpenFn, UserReadCallback pReadFn, UserSeekCallback pSeekFn, UserGetPosCallback pPosFn, UserGetSizeCallback pSizeFn, UserEOFCallback pEOFFn, UserCloseCallback pCloseFn, Int32 uUserInfo)
at Atalasoft.Imaging.Lib.IS._IS40_OpenUserSource(UserOpenCallback pOpenFn, UserReadCallback pReadFn, UserSeekCallback pSeekFn, UserGetPosCallback pPosFn, UserGetSizeCallback pSizeFn, UserEOFCallback pEOFFn, UserCloseCallback pCloseFn, Int32 uUserInfo)
at atalabh.a(UserOpenCallback A_0, UserReadCallback A_1, UserSeekCallback A_2, UserGetPosCallback A_3, UserGetSizeCallback A_4, UserEOFCallback A_5, UserCloseCallback A_6, Int32 A_7)
at atalabh..ctor(Stream A_0, atalah3 A_1)
at Atalasoft.Imaging.Codec.TgaDecoder.GetImageInfo(Stream stream)
at Atalasoft.Imaging.Codec.TgaDecoder.IsValidFormat(Stream stream)
at Atalasoft.Imaging.Codec.RegisteredDecoders.GetDecoder(Stream stream)
at Atalasoft.Imaging.Codec.RegisteredDecoders.GetImageInfo(Stream stream)
at Atalasoft.Imaging.Codec.RegisteredDecoders.GetImageInfo(String fileName)
C:DavidVisual Studio ProjectsCeoimage.Documents SolutionTestExtractedTestProject1ImageInfo.cs(23,0): at TestProject1.ImageInfo.UpdateImageInfo(String path)
C:DavidVisual Studio ProjectsCeoimage.Documents SolutionTestExtractedTestProject1UnitTest1.cs(46,0): at TestProject1.UnitTest1.TestMethod1()
--
answered by flipdoubt (220 points)
0 votes
Hi
We solved those issues in our latest release (3.6)
Please download and try again.
Tell me if that solves your problem.
If the problem continues we we will try to solve it.
answered by ohad (35.5k points)
0 votes
Hi Ohad. Sorry to report this, but I am using 3.6. I've re-installed TypeMock and enabled logging. I have *.out files to send you, but I don't know where to send them.

The logs seem pretty sparse to me. They just list the namespaces and assemblies, like this:

--
Logging program: C:Program FilesMicrosoft Visual Studio 8SDK2.0insgen.exe
Known namespace: nunit
Known namespace: vstesthost.exe
Known namespace: MbUnit
Known namespace: TestDriven.TestRunner.dll
Loaded: ->C:WINDOWSssemblyGAC_32mscorlib.0.0.0__b77a5c561934e089mscorlib.dll
Loaded: ->C:WINDOWSssemblyGAC_32mscorlib.0.0.0__b77a5c561934e089sorttbls.nlp
Loaded: ->C:Program FilesMicrosoft Visual Studio 8SDK2.0insgen.exe
Loaded: ->C:WINDOWSssemblyGAC_32mscorlib.0.0.0__b77a5c561934e089sortkey.nlp
Loaded: ->C:WINDOWSssemblyGAC_MSILSystem.Xml.0.0.0__b77a5c561934e089System.Xml.dll
Loaded: ->C:WINDOWSssemblyGAC_MSILSystem.0.0.0__b77a5c561934e089System.dll
Loaded: ->C:WINDOWSssemblyGAC_MSILSystem.Web.Services.0.0.0__b03f5f7f11d50a3aSystem.Web.Services.dll
Loaded: ->C:WINDOWSssemblyGAC_MSILAccessibility.0.0.0__b03f5f7f11d50a3aAccessibility.dll
Loaded: ->C:DavidVisual Studio ProjectsBasecamp .NETCeoimageinDebugCeoimage.dll
Loaded: ->C:DavidVisual Studio ProjectsBasecamp .NETCeoimage.DocumentsinDebugCeoimage.Documents.dll
Loaded: ->C:DavidVisual Studio ProjectsBasecamp .NETCeoimage.Documents.ImaginginDebugCeoimage.Documents.Imaging.dll
Loaded: ->C:PIXTRANBINInterop.PixAnnotLib.dll
Loaded: ->C:PIXTRANBINPixTools.dll
Loaded: ->C:PIXTRANBINPixTools.EZ.dll
Loaded: ->C:WINDOWSssemblyGAC_MSILSystem.Configuration.0.0.0__b03f5f7f11d50a3aSystem.Configuration.dll
Loaded: ->C:WINDOWSssemblyGAC_32System.Data.0.0.0__b77a5c561934e089System.Data.dll
Loaded: ->C:WINDOWSssemblyGAC_MSILSystem.Deployment.0.0.0__b03f5f7f11d50a3aSystem.Deployment.dll
Loaded: ->C:WINDOWSssemblyGAC_MSILSystem.Drawing.0.0.0__b03f5f7f11d50a3aSystem.Drawing.dll
Loaded: ->C:WINDOWSssemblyGAC_MSILSystem.Runtime.Serialization.Formatters.Soap.0.0.0__b03f5f7f11d50a3aSystem.Runtime.Serialization.Formatters.Soap.dll
Loaded: ->C:WINDOWSssemblyGAC_MSILSystem.Security.0.0.0__b03f5f7f11d50a3aSystem.Security.dll
Loaded: ->C:WINDOWSssemblyGAC_MSILSystem.Windows.Forms.0.0.0__b77a5c561934e089System.Windows.Forms.dll
Loaded: ->C:DavidVisual Studio ProjectsBasecamp .NETCeoimage.Documents.IsisScanningobjDebugCeoimage.Documents.IsisScanning.dll
--

And this:

--
Logging program: C:Program FilesMicrosoft Visual Studio 8SDK2.0insgen.exe
Cannot read EnvName0 => The system cannot find the file specified.

Cannot read ResetCLSID => The system cannot find the file specified.

Adding typemock profiler
Loaded C:Program FilesTypeMockTypeMock.NETMockWeaver.dll
Target Runtime .NET 2.0
Initialize Profiler 0, Target Runtime .NET 2.0
--
answered by flipdoubt (220 points)
0 votes
Hi
I'm sending you my address offline.
Please send the logs to this address.
answered by ohad (35.5k points)
0 votes
Hmm
For some reason I keep getting rejections from your mail server.
Can you give me another mail address?
Just change it in profile details.
answered by ohad (35.5k points)
0 votes
I've reset my email address. Please try again.
answered by flipdoubt (220 points)
0 votes
Hi
We fixed the problem.
The patch was sent offline.
answered by ohad (35.5k points)
...