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
We are using ReSharper 2.0 (build #259), NUnit 2.2.7 and VS2005.

After installing TypeMock.NET and enabling it from the Tools menu a test now fails with a System.TypeLoadException, when running the test from within the IDE using the ReSharper Unit Test Runner.

If I disable TypeMock.NET from the Tools menu and run the test again from within the IDE it works fine and goes green.

The test itself is an existing test that does not reference TypeMock.NET yet. I have not added any references to TypeMock.NET, I am just running existing working code.

How/why is just turning TypeMock.NET on causing my test to fail?

Any help or guidance would be appreciated as this product looks great!
asked by MisterD (600 points)

10 Answers

0 votes
Hi
Currently we are not supporting ReSharper but lets give it a try.
Can you please send me the TypeMock logs?
I send you offline my mail address plus instructions how to create the logs.
answered by ohad (35.4k points)
0 votes
We are using ReSharper 2.0 (build #259), NUnit 2.2.7 and VS2005.

After installing TypeMock.NET and enabling it from the Tools menu a test now fails with a System.TypeLoadException, when running the test from within the IDE using the ReSharper Unit Test Runner.

If I disable TypeMock.NET from the Tools menu and run the test again from within the IDE it works fine and goes green.

The test itself is an existing test that does not reference TypeMock.NET yet. I have not added any references to TypeMock.NET, I am just running existing working code.

How/why is just turning TypeMock.NET on causing my test to fail?

Any help or guidance would be appreciated as this product looks great!



I am experiencing a similar problem, but with NUnit. When using NUnit to run a certain test, everything works well, but when running that test with TypeMock (via TMockRunner, or by launching from inside a TypeMock-enabled instance of VisualStudio) I encounter a System.TypeLoadException:

Failures:
1) com.innovationNext.aware.test.unit.domain.TestTester.BugAddSavedReferenceThrowsOnExistingUriWithFragments : System.TypeLoadException : Could not load type 'com.innovationNext.aware.domain.ReferenceList`1' from assembly 'aware, Version=2.3.2.7, Culture=neutral, PublicKeyToken=null' due to value type mismatch.
at com.innovationNext.aware.domain.ReferenceList`1.Contains(T reference)
at com.innovationNext.aware.domain.SavedReferenceList.AsyncAddAndDownload(Dictionary`2 references) in C:productswareetty-tweakeddevsrcdomainSavedReferenceList.cs:line 83
at com.innovationNext.aware.test.unit.domain.TestTester.BugAddSavedReferenceThrowsOnExistingUriWithFragments() in C:productswareetty-tweakeddev estunitdomainTestTester.cs:line 56


I am working on extracting a test case, but I do not have code ready yet. The problem is also not perfectly predictable -- I've been unable to reproduce the problem on a Win2k machine (my main dev. box is running XP.)

I've reproduced the problem with TypeMock 3.6.1 paired with NUnit 2.2.8, 2.2.9 and 2.4 beta 2, both in GUI and console modes. I've also run the test method as a stand-alone c# app (invoking the test method directly from a Main) to pull nunit out of the mix, and the program performs as expected, so something about the integration of TypeMock and NUnit must be causing this problem.

A bit more info: This only started becoming an issue after introducing generics into our class hierarchy. The method ReferenceList`1.Contains(T reference) is an abstract class that SavedReferenceList extends (and provides a closed type to, in the class declaration). Contains has the same pedigree (implementation location, override location, visibility.. signature etc.) as another method WasViewed(T reference) which *can* be called successfully at the same location on the stack that the exception is thrown. (this was tested by adding watches in the debugger when the TypeLoadException was thrown and caught by Visual Studio.)

If I am able to extract a stand-alone test case that exhibits this failure I will provide that as well.

This problem has proven to be quite a show-stopper. Any assistance you can offer in finding a solution or workaround will be greatly appreciated.

Thank You,
Rogan Creswick
answered by creswick (180 points)
0 votes
Hi Rogan
I'm sending you my email address offline.
Please run the test with TypeMock log enabled and send me the results.
of course if you can submit a small test case it will help. 8)

To enable TypeMock log:
Open
START -> programs -> TypeMock.NET -> TypeMock Configuration
Open the Visual Studio tab
Check in the check box near "Write TypeMock Log"

I removed your mail address from your post to avoid spam programs retrieving your mail
answered by ohad (35.4k points)
0 votes
Hi Rogan
I'm sending you my email address offline.
Please run the test with TypeMock log enabled and send me the results.
of course if you can submit a small test case it will help. 8)

To enable TypeMock log:
Open
START -> programs -> TypeMock.NET -> TypeMock Configuration
Open the Visual Studio tab
Check in the check box near "Write TypeMock Log"

I removed your mail address from your post to avoid spam programs retrieving your mail


Thanks Ohad --

I sent this to you directly, with what logs I could generate, but I wanted to update this thread too.

Running with logging (either via VS.) or with TMockRunner -loglevel N ... prevents the problem from happening, as long as N is 1 - 9. (with loglevel 0, no logging appears to happen, and the exception happens as well.) This is a manageable workaround, although the logfiles get fairly large. (and must be cleaned periodically)

--Rogan
answered by creswick (180 points)
0 votes
I am getting the same exception with TypeMock 3.7.1.

Can you please post the fix?? Why are bug fixes not published but instead "sent offline"?
answered by matt.darnall (260 points)
0 votes
Hi Matt
Can you send me the TypeMock log files?
I'm sending you a mail with my address.

We don't have a fix since we could re-crate it with logging enable.

Why are bug fixes not published but instead "sent offline"?

The reason is that we first want to confirm with the bug reporter that the problem solved.
When it solved the fix is always part of the next release.
answered by ohad (35.4k points)
0 votes
I cannot reproduce this with logging turned on. Are there any updates on this?
answered by matt.darnall (260 points)
0 votes
Hi Matt
Sadly there are no news about this.
Can you tell me what tools you are using to run the tests?
answered by ohad (35.4k points)
0 votes
Hello! I'm using last typemock with Resharper 5.0

The problem is still there. I get

[ img ]
answered by neutrino (760 points)
0 votes
Update on this thread - the original case is a very old, and has been resolved 3 years ago. The update by neutrino has been opened as a new thread.
answered by doron (17.2k points)
...