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 just purchased an enterprise license because I decided I needed to be able to use NCover for the project I am working on.

The problem I am running into is the tests fail when run under NCover but not when I run them without NCover.

I am using NUnit as my testing framework, and have entered my license code in the configuration utility, selected NCover 1.3 and linked it. I have tried to use NCover version 1.3.3 and 1.5 beta (both 1 and 2) with no luck.

An example of the errors I get under NCover is
1) Ulta.Server.MasData.DataQueueTests.LoadQueue : Ulta.Lib.AppException.UltaException : Object reference not set to an instance of an object.
TearDown : TypeMock.VerifyException :
TypeMock Verification: Expected a new instance of Ulta.Lib.Data.DBManager (try using MockAll)
Method Ulta.Lib.Data.DBManager.AddProc() has 2 more expected calls
Method Ulta.Lib.Data.DBManager.ExecuteCommand() has 2 more expected calls
Method Ulta.Lib.Data.DBManager.CreateConnection() has 1 more expected calls
Method Ulta.Lib.Data.DBManager.AddNumberParam() has 2 more expected calls

   at Ulta.Lib.Configuration.ConfigurationManager.GetValue(String sName, String& sValue) in F:\System.net\Kernel\Lib\ConfigurationManager\ConfigurationManager.cs:line 90
   at Ulta.Lib.ResourceInfo.ResourceManager.Initialize() in F:\System.net\Kernel\Lib\ResourceManager\ResourceManager.cs:line 130
   at Ulta.Lib.ResourceInfo.ResourceManager.FindResource(String sResourceID, DataRow& drResourceRow) in F:\System.net\Kernel\Lib\ResourceManager\ResourceManager.cs:line 351
   at Ulta.Lib.ResourceInfo.ResourceManager.GetResource(String sResourceID, DatabaseResource& databaseResource) in F:\System.net\Kernel\Lib\ResourceManager\ResourceManager.cs:line 160
   at Ulta.Lib.Data.DBManager.CreateConnection(ResourceManager ResMgr, String LogicalName)
   at Ulta.Server.MasData.DataQueue..ctor(Parameters Parameters) in W:\Work\MasData.Net\MasDataDll\DataQueue.cs:line 49
   at Ulta.Server.MasData.DataQueueTests.LoadQueue() in W:\Work\MasData.Net\MasDataTests\DataQueueTests.cs:line 138
--TearDown
   at TypeMock.MockManager.Verify()
   at Ulta.Server.MasData.DataQueueTests.TestTearDown() in W:\Work\MasData.Net\MasDataTests\DataQueueTests.cs:line 104


I have tried changing the call to MockAll with the same results. This only occur when run with the command line:
"c:\program files\ncover\ncover.console" /c "C:\Program Files\NUnit\bin\nunit-console.exe" MasDataTests.dll


If I run
"C:\Program Files\NUnit\bin\nunit-console.exe" MasDataTests.dll

it all works fine, all tests succeed.

I tried turning verbose on (set TMOCK_VERBOSE=1) and looking at the TypeMock.out that is the NCover directory but there is no IL code in that file to send along.

I am sure I am missing something, but can't figure out what it is. I have use NCover before without TypeMock successfully, so I am at a loss here.


Darryn Glass
asked by echmyr (2.2k points)

18 Answers

0 votes
Hi,
TypeMock.exe is .NET 1.1 compatible.

I have sent you another file to install.
please install all the files that where sent.

> TypeMock.exe
> TypeMock.dll
> ProfileLinker.dll
answered by scott (32k points)
0 votes
I love tech support that is helpful, and I hate having to say that great tech support just doesn't seem to work.

I copied the new file you gave to the correct directory and installed it in the GAC
Microsoft (R) .NET Global Assembly Cache Utility.  Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

The Global Assembly Cache contains the following assemblies:
   TypeMock, Version=3.0.1.1, Culture=neutral, PublicKeyToken=3dae460033b8d8e2, Custom=null
   TypeMock, Version=3.0.2.0, Culture=neutral, PublicKeyToken=3dae460033b8d8e2, Custom=null
   TypeMock, Version=3.0.2.1, Culture=neutral, PublicKeyToken=3dae460033b8d8e2, Custom=null

The cache of ngen files contains the following entries:

Number of items = 3


But I still get the same error as before
Windows cannot access the specified device, path, or file.  You may not have the appropriate permissions to access the item.


Again as before, the old TypeMock.exe runs fine (except for the crash on closing). NUnit-console crashes on exit and NCover crashes when I try to run it.

I have a home project I am using NCover and Type Mock for also (not at the same time) and I will try this on my home computer also (just to isolate some strangeness on my work computer) this weekend. If you have any other ideas, I am open to try...
answered by echmyr (2.2k points)
0 votes
I found another very peculiar thing. If I try to link NCover with the old TypeMock.exe (the one that crashes) all the .NET programs I run after that (at least the ones that I have written) all crash on exit after the code I have written has been completely run. If I go back into the old TypeMock.exe and unlink then, this problem goes away. I am sure if we can ever figure out why the new one won’t run it will fix this problem also, but I thought it was strange, especially since one of the programs in question never was even tested with TypeMock.
answered by echmyr (2.2k points)
0 votes
This issue should be fixed in version 3.0.3 :D
answered by scott (32k points)
0 votes
Ok, I was not able to get back to this right away. Deadlines don't wait.

I have been able to make this all work, but not quite the way the instructions were.

I am now running NUnit 2.2.6 .NET 2.0, NCover 1.5.3, and Typemock 3.0.3. I can make this all work if I link NCover from the cofiguration tool and then run my tests without running mocking_on. :D I cannot get TMockRunner to work at all. :x

Thanks for the help. I am able to at least move forward now.
answered by echmyr (2.2k points)
0 votes
Hi,
Glad that you managed to solve this. We are currently enhancing our product to support these scenarios even better. (Through msbuild and tmockrunner)
answered by scott (32k points)
0 votes
One last note on this whole thing and then I think this thread is done. I have found that if you want to use NCover, TypeMock and .NET 1.1 there are some caveats.

1> You must use NCover 1.3.3 and NUnit for 1.1 (not the 2.0 compiled version). I think the issue is that NCover and NUnit must use the same version of .NET.
2> When debugging in VS 2003, I had to unlink NCover. If I did not, the line of code I was breaking on was not the same as what was being executed. It seems that the linked TypeMock or NCover messed up the debugger. Unlinking NCover fixed this problem.
answered by echmyr (2.2k points)
0 votes
The whole process should be much easier now with version 3.1 Nantand MSBuildintegration.
(Professional and Enterprise Editions only)
answered by scott (32k points)
...