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
Hi

See subject. What's the story here, has this been tested? Do you expect it to just work?

The reason I am asking is that we have been forced to take this route ourselves (due to the fact that we have some 3.rd party components that do not run under .NET 4.0). And now a large number of our tests fail with TypeMock exceptions.

A typical example is:

Test method <NameOfTestMethod> threw exception:
TypeMock.TypeMockException:
*** No method calls found in recording block. Please check:
* Are you trying to fake a field instead of a property?
* Are you are trying to fake an unsupported mscorlib type? See supported types here: https://www.typemock.com/mscorlib-types

The mocks are typically simple stuff and there is no apparent reason why they fail.

There is also this one:

Test method <NameOfTestMethod> threw exception:
TypeMock.VerifyException:
TypeMock Verification: Method <NameOfMockedMethod>() has 1 more expected calls
Method <NameOfMockedMethod>() has 1 more expected calls
Method <NameOfMockedMethod>() has 1 more expected calls
Method <NameOfMockedMethod>() has 1 more expected calls
Method <NameOfMockedMethod>() has 1 more expected calls
Method <NameOfMockedMethod>() has 1 more expected calls
Method <NameOfMockedMethod>() has 1 more expected calls

which doesn't make sense at all.

BTW. I upgraded from 6.0.7 to 6.0.8 and it just went from bad to worse (the findings above are from after the upgrade)
asked by brumlemann (2k points)

9 Answers

0 votes
Hi,

This is a basic case which works, retargeting .NET framework isn't supposed to be an issue.

Does it happen on every test code? If not, can you please mail to our support a small project that reproduces it?
Are you using Natural API? Does it also happen after restarting VS?

What version of Windows do you use (x64/x86) and what tests runner is used?

Regards,
Elisha,
Typemock Support
answered by Elisha (12k points)
0 votes
Hi,

Could you please also try removing completely, then adding again the references to Typemock and Typemock.ArrangeActAssert, making sure that they are from the same version?

This might be an upgrade issue, where the Typemock DLL in the GAC has a different version from the AAA being referenced.

Please let me know if this worked.
answered by igal (5.7k points)
0 votes
Hi Elisha and Igal

Try your own C# samples.

- Make sure all the tests run in VS2008 ( I had to make a small fix by adding a CultureInfo.InvariantCulture parameter to a string.Format but that's most likely irrelevant to the case)
- Convert to VS2010 SP1
- Run the tests again. They should pass.
- Change the targetting to 3.5 and rerun the tests.

On my box two tests now fail.

MockSimpleQuery:
Error message:
Test method Typemock.Examples.CSharp.TestH_LINQ.MockSimpleQuery threw exception:
TypeMock.TypeMockException:
*** No method calls found in recording block. Please check:
* Are you trying to fake a field instead of a property?
* Are you are trying to fake an unsupported mscorlib type? See supported types here: https://www.typemock.com/mscorlib-types
Stack trace:
fv.a(p A_0, Boolean A_1)
fb.a(Boolean A_0)
cg.a(Boolean A_0)
e7.c(Boolean A_0)
e7.a(Object A_0, Boolean A_1, Func`1 A_2, Action A_3, Action A_4, Action A_5)
e7.c(Object A_0)
Typemock.Examples.CSharp.TestH_LINQ.MockSimpleQuery() in C:Program Files (x86)TypemockIsolator.0ExamplesGeneralExamplesCSTestH_LINQ.cs: line 66
TypeMock.MockManager.a(String A_0, String A_1, Object A_2, Object A_3, Boolean A_4, Boolean A_5, Object[] A_6)
TypeMock.InternalMockManager.getReturn(Object that, String typeName, String methodName, Object methodParameters, Boolean isInjected, Boolean isInterceptedType)
Typemock.Examples.CSharp.TestH_LINQ.MockSimpleQuery() in C:Program Files (x86)TypemockIsolator.0ExamplesGeneralExamplesCSTestH_LINQ.cs: line 65


MockComplexQuery:
Error message:
Test method Typemock.Examples.CSharp.TestH_LINQ.MockComplexQuery threw exception:
System.NullReferenceException: Object reference not set to an instance of an object.

Stack trace:
System.SZArrayHelper.SZGenericArrayEnumerator`1..ctor(T[] array)
System.SZArrayHelper.GetEnumerator[T]()
System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
System.Linq.Enumerable.Count[TSource](IEnumerable`1 source)
Typemock.Examples.CSharp.TestH_LINQ.MockComplexQuery() in C:Program Files (x86)TypemockIsolator.0ExamplesGeneralExamplesCSTestH_LINQ.cs: line 96
TypeMock.MockManager.a(String A_0, String A_1, Object A_2, Object A_3, Boolean A_4, Boolean A_5, Object[] A_6)
TypeMock.InternalMockManager.getReturn(Object that, String typeName, String methodName, Object methodParameters, Boolean isInjected, Boolean isInterceptedType)
Typemock.Examples.CSharp.TestH_LINQ.MockComplexQuery() in C:Program Files (x86)TypemockIsolator.0ExamplesGeneralExamplesCSTestH_LINQ.cs: line 80

Regards
Martin
answered by brumlemann (2k points)
0 votes
Hi,

Could you please also try removing completely, then adding again the references to Typemock and Typemock.ArrangeActAssert, making sure that they are from the same version?

This might be an upgrade issue, where the Typemock DLL in the GAC has a different version from the AAA being referenced.

Please let me know if this worked.


I know about the upgrade issues Igal, beleive me ;) The first thing I check when TM bombs is the GAC.

Just thought I'd mention too that the TM references in the C# general sample project are a bit outdated.
'Specific version=false' masks it away. I don't have a shred of TM 6.0.4 on my machine (Iknow, I have a new disk where the old one used to be) and haven't had for a very long time.

I changed to 'Specific version=true' to make sure I only bind to V6.0.8. (that's the only version I am interested in right now) in case I have something really weird in my assembly resolver paths .

Regards
Martin
answered by brumlemann (2k points)
0 votes
Just a quick reminder on what we're dealing with here. When retargeting test projects to .NET 3.5 MSTest chooses a different test runner.QTAgent32_35.exe and QTAgent_35.exe was indtroduced in VS2010 SP1 to support retargeting.

It may seem then that the new test runners change the ballgame slightly. At least that's a theory that would explain the observations.

Regards
Martin
answered by brumlemann (2k points)
0 votes
Thanks very much, Martin.

I'll check this out ASAP, and get back to you!
answered by igal (5.7k points)
0 votes
Hi Martin,

I have a solution for you - please add the following to the file 'namespaces.dat' (located in your installation directory):

QTAgent32_35.exe
QTAgent_35.exe


This should solve the tests crashing!

Please let me know if this helped. Thanks!
answered by igal (5.7k points)
0 votes
Hi again Igal

That seems to have done the trick, and ASAP it was, indeed ;-)

When will you have this fix in an installer?

Martin
answered by brumlemann (2k points)
0 votes
I already added this to the installer, so it will be released in an upcoming version, however I don't have an estimate when that would be...
answered by igal (5.7k points)
...