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'm getting an error with the RecorderExpectations while debugging and stepping through the code.

Here is my code block

using(RecordExpectations recorder = RecorderManager.StartRecording()){
            recorder.ExpectAndReturn(ApplicationScope.Settings.MailFromServerAddress, fromEmailAddress);
         }



As soon as I get to the closing bracket on the using block, an exception is thrown. Here is the exception :

TypeMock.TypeMockException:
*** Cannot mock types from mscorlib assembly, or no return value set..


This is the stack trace:

   at TypeMock.RecordExpectations.Dispose()
   at GameFly.Retail.UnitTests.Infrastructure.Mail.SupportSmtpEmailSettingsTest.FromEmailAddressFromSettings() in C:DataProjectsGameFlyRetailMainLineSrcGameFly.Retail.UnitTestsInfrastructureMailSupportSmtpEmailSettingsTest.cs:line 93


If I run the test out of the debugger or dont step into the recorder.ExpectAndReturn code block, everything moves on as planned. I also have almost exactly the same code in other tests but they just access a different setting of my settings object and they work fine.

I am having a differnt problem with the same set of tests but I believe they are unrelated so I will create a different post for that.

Thanks.
asked by juice_johnson (9.8k points)

2 Answers

0 votes
Hi
This is a known problem with the Debugger, trying to evaluate local variables.
You can either turn it off (Tools->Options->Debugging->Uncheck Enable Property evaluation)
or make sure that you step over the recorder blocks (otherwise the evaluations are being recorded).
We are still working on an automatic solution.
answered by scott (32k points)
0 votes
Ok cool. Its an easy workaround anyhow. I just wanted to make sure that you were aware of the problem. Apparently you are, so thanks for the quick reply.
answered by juice_johnson (9.8k points)
...