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
So far we are working with Typemock version 4.1.1 and the below code works fine on that. Now we are moving to version 5.4.5 and the following code fails. This code is inside TestInitialize.
MockObject _mockDriver = null;
_mockDriver = MockManager.MockObject(typeof(BaseIslac<X>), Constructor.Mocked);


The error is on the second line:
System.TypeLoadException: Declaration referenced in a method implementation cannot be a final method. Type: 'Mock0000BaseIslac`1'. Assembly: 'DynamicMockAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=a0857b23fb3f20d9'.

Due to so many dependencies & time frame at the moment we can not change or upgrade to any other version apart from 5.4.5.
Please let us know how to over come this error.
asked by mbs (1.9k points)

5 Answers

0 votes
Hi,

can you please post here more details about the class you're trying to fake?
How is it defined? Is it in a signed assembly? etc.
answered by ohad (35.5k points)
0 votes
The class is an abstract one defind as
public abstract class BaseIslac<D> : Interface1, IBaseIslac, Interface2, Interface3, IInternalDD<IslacFields>
        where D : BaseIslac<D> 
{...}

Yes the assembly is signed.
FYI, Just now i have found similar case in your form
https://www.typemock.com/community/viewt ... b1678e5350

When tested my case against 6.0 version as suggested we are seeing no issues with our testing code and it is passing.
Is my case also falls in to the same catagory?
Please let me know.
answered by mbs (1.9k points)
0 votes
The class is an abstract one defind as
public abstract class BaseIslac<D> : Interface1, IBaseIslac, Interface2, Interface3, IInternalDD<IslacFields>
        where D : BaseIslac<D> 
{...}

Yes the assembly is signed.
FYI, Just now i have found similar case in your form
https://www.typemock.com/community/viewt ... b1678e5350

When tested my case against 6.0 version as suggested we are seeing no issues with our testing code and it is passing.
Is my case also falls in to the same catagory?
Please let me know.
answered by mbs (1.9k points)
0 votes
Hi,

It looks like the same issue.
I suggest to upgrade to the latest version (6.0.4). This should fix the problem.
answered by ohad (35.5k points)
0 votes
Hi,

As i said earlier due to so many dependencies & time frame at the moment we can not change or upgrade to any other version apart from 5.4.5.
Can you deliver any patch for us fixing this issue in 5.4.5?
else Please let us know how to over come this error.
answered by mbs (1.9k points)
...