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 own the Professional Edition and I am getting the following error while running a test with code coverage in VSTS:


Test method JDA.PRO.Framework.UnitTest.Service.PROServiceFactoryUnitTest.TestCreateServiceInstanceSingleton threw exception: System.MissingMethodException: Method not found: 'Void TypeMock.InternalMockManager.Clover()'..

Why does it try to use "Clover"?

Here is the unit test code.

[TestMethod]
public void TestCreateServiceInstanceSingleton()
{
MockManager.Init();

PROServiceImplementationInfo serviceInfo = new PROServiceImplementationInfo();
serviceInfo.AssemblyName = "JDA.PRO.Framework.UnitTest";
serviceInfo.ClassName = "JDA.PRO.Framework.UnitTest.Service.Helper.TestService";
serviceInfo.InterfaceName = "JDA.PRO.Framework.UnitTest.Service.Helper.TestSingletonServiceInterface";
serviceInfo.ServiceInitializationType = "SINGLETON";

Mock mockPROServiceConfigurationHelper =
MockManager.MockAll(typeof(PROServiceConfigurationHelper), Constructor.NotMocked);
mockPROServiceConfigurationHelper.AlwaysReturn("GetServiceConfiguration", serviceInfo);

object testService = PROServiceFactory.GetInstance().CreateServiceInstance(typeof(TestSingletonServiceInterface));

Assert.AreEqual(typeof(TestService), testService.GetType());

TestSingletonServiceInterface testServiceInterface = (TestSingletonServiceInterface)testService;
Assert.AreEqual<int>(0, testServiceInterface.InstanceCount);
testServiceInterface.ClassDetail++;
testServiceInterface.InstanceCount++;
testService = PROServiceFactory.GetInstance().CreateServiceInstance(typeof(TestSingletonServiceInterface));
testServiceInterface = (TestSingletonServiceInterface)testService;
Assert.AreEqual<int>(1, testServiceInterface.InstanceCount);
Assert.AreEqual<int>(1, testServiceInterface.ClassDetail);

MockManager.Verify();
GC.Collect();

}
asked by craigtm (1.7k points)

8 Answers

0 votes
Hi ,

What is probably happening is that you are linked against a previous version of TypeMock.NET

Please tell me what versions of TypeMock are installed.

1. Under Control Panel -> Add or Remove Programs
2. In the GAC => C:WindowsAssembly
If you have more then one version installed, uninstall all the versions and Repair the latest 3.1.3

Note that I have seen this happen (to me actually :-)) if you install TypeMock while Visual Studio is running and Hit the Ignore button when the installer displays a warning.

To see if this is the case please open Visual Studio and click Tools->TypeMock Configuration open the version tab and tell me what version is there.

If the dialog doesn’t open or you have a different version, perform the following:

1. Close visual studio
2. Under Control Panel -> Add or Remove Programs Choose TypeMock ->Change
3. Click One Click Repair.

Please tell me if this works.
answered by scott (32k points)
0 votes
I followed your suggestion (there was a 3.0.3 version of TypeMock in the GAC), but now my tests all abort, even which coverage disabled. Here is the message:

Code coverage instrumentation warning while processing file JDA.PRO.Framework.dll:
Warning VSP2013 : Instrumenting this image requires it to run as a 32-bit process. The CLR header flags have been updated to reflect this.
.
Warning: Test Run deployment issue: The assembly or module 'System.Data' directly or indirectly referenced by test assembly 'c:jdavsnetpro runkproframeworksourcerameworkpro.framework.unittestindebugjda.pro.framework.unittest.dll' was not found.
Test host process exited unexpectedly.

This is not a 64 bit app,by the way.

I also get a pop-up saying that the Community Edition is installed??? I am using my temporary Professional License.

I have tried uninstalling and reinstalling also (after closing VSTS).

I gues I could try rebooting too... :P
answered by craigtm (1.7k points)
0 votes
Hi,
There are two issues.
For the first.
1. Clean and rebuild the tests.

For the second reenter your code and
2. Please send me a screen shot of the license tab in the TypeMock Configurator (to the support mail).
answered by scott (32k points)
0 votes
Hi,
I can't seem to reply to your mail address :-(

In any case please see if the dll actually exists or for some reason it is not there.

Open the Visual Studio Command Prompt and:

1. Please run>
mstest /testcontainer:"yourdll" /detail:errormessage

2. And then run>
"C:Program FilesTypeMockTypeMock.NETTMockRunner "-log mstest /testcontainer:"yourdll" /detail:errormessage

3. And send me the output + typemock.log in the C:Program FilesMicrosoft Visual Studio 8Common7IDE directory.
answered by scott (32k points)
0 votes
Hi Craig

Thanks for sending the logs.
:arrow: From what we see, the problem is not with TypeMock because your tests fail even when TypeMock is not running.
The actual problem is that the log4net dll could not be loaded.

----------------------------------
[errormessage] = Unable to create instance of class JDA.PRO.Framework.UnitTest.Service.PROServiceFactoryUnitTest. Error: System.TypeInitializationException: The type initializer for 'JDA.Inf.Sys.JDALoggingService' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'log4net, Version=1.2.0.30714, Culture=neutral, PublicKeyToken=9325eb26cf050f55' or one of its dependencies.
----------------------------------

:idea: To solve do one the following:
1. Make sure that the log4net dll is copied
(in Visual Studio Solution Explorer choose the log4net reference, Right Click -> Properties and make sure that Copy Local is True)
2. Change the Test Run Configuration to not copy the dll's to a new location
(in Visual Studio open you .testrunconfig file, Select Code Coverage, and make sure that Instrument Assemblies in Place is checked)
answered by scott (32k points)
0 votes
Hmmm. I will try what you suggested but, just so that you know, I have uninstalled 3.1.3 Professional and I have reverted back to 3.0.3 Community and now all of my test run and succeed (with code coverage turned off). I had to take this step because I could no longer run any tests - even using the debugger.
answered by craigtm (1.7k points)
0 votes
This was taken offline,
It turns out that there was an old TypeMock.dll in the system that wasn't upgraded that caused this problem.
After upgrading this dll the problem went away.

I guess that we should have a better message for this scenario.
answered by scott (32k points)
0 votes
Thanks for the great support!
answered by craigtm (1.7k points)
...