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
Hi,

Am getting the following error with TypeMock version 6.0.4.
These tests are running with out any issues in version 5.4.5.

Test Process 1: Test method BoardUnitTest.BoardTest.Map6 threw exception TypeMock.TypeMockException, but exception ABC.Project2.Utilities.Project1Exception was expected. Exception message: TypeMock.TypeMockException: *** Cannot return a value for InterceptedTypes.IsIntercepted() because no value was set. use recorder.Return(). *** Note: Cannot mock types from mscorlib assembly.

As this message appears in number of locations apart from changing the individual code do you suggest any other global solution?

Thanks.
asked by mbs (1.9k points)

13 Answers

0 votes
Hi,

Can you post example code that fails now? What API do these tests use?

Doron
Typemock Support
answered by doron (17.2k points)
0 votes
Can we mock a get property using Mock.ExpectGet() without initializing the property first. i have created a mock object as below and am getting the error after the recording section
MockObject mockboardconfig;
mockboardconfig = MockManager.MockObject(typeof(BoardConfig));
using (RecordExpectations recorder = RecorderManager.StartRecording())
{
               mockboardconfig.ExpectGet("ValidHls", validHls);
}

My class is defined as below
public abstract class BoardConfig
    {
        #region Private/Internal Members
        private List<uint> _validHls = new List<uint>();
....
}
answered by mbs (1.9k points)
0 votes
mbs,

Isolator does not support faking fields, so faking _validHls will fail. If I understand correctly, you are trying to fake the property ValidHls, and this should work. What error message are you getting?

Doron
Typemock Support
answered by doron (17.2k points)
0 votes
Hi Doron,

Am trying to fake the property ValidHls not the field.
public abstract class BoardConfig 
    { 
        #region Private/Internal Members 
        private List<uint> _validHls = new List<uint>(); 
        public IEnumerable<uint> ValidHls
        {
            get { return _validHls; }
        }
.... 
}

error message is

Test Process 1: Test method BoardUnitTest.BoardTest.Map6 threw exception TypeMock.TypeMockException, but exception ABC.Project2.Utilities.Project1Exception was expected. Exception message: TypeMock.TypeMockException: *** Cannot return a value for InterceptedTypes.IsIntercepted() because no value was set. use recorder.Return(). *** Note: Cannot mock types from mscorlib assembly.
answered by mbs (1.9k points)
0 votes
This is odd, but gives me a pretty good direction to solve the issue. Can you post here the statement you are using to fake ValidHls? I think this error is due to a bug, which this could help resolve.

Thanks,
Doron
Typemock Support
answered by doron (17.2k points)
0 votes
As i said earlier am getting the error after the recording section from the below code
MockObject mockboardconfig; 
mockboardconfig = MockManager.MockObject(typeof(BoardConfig)); 
using (RecordExpectations recorder = RecorderManager.StartRecording()) 
{ 
               mockboardconfig.ExpectGet("ValidHls", validHls); 
} 
answered by mbs (1.9k points)
0 votes
OK, this is a bug introduced in our latest versions. I will work to fix this and issue you a patch as soon as possible.

Doron
Typemock Support
answered by doron (17.2k points)
0 votes
mbs,

I created a patched version with a fix to this issue. I'm going to send you an email with it and we'll follow it up offline. This fix should be introduced at the upcoming Isolator version.

If anyone following this thread needs this fix before the next version release, post it here or send us an email at support(at)typemock.com.

Doron
Typemock Support
answered by doron (17.2k points)
0 votes
Hi Doron,

Could you please email me the fix as we are getting the same problem.

Regards,

Ben
answered by bsparkinson (180 points)
0 votes
Hi,

We are using 6.0.5 version and still running into the same issue. Kindly send me the fix.

Thanks
answered by mk_typemock (180 points)
...