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 am attempting to use TypeMock to mock-out a data access layer generated by .nettiers. I have hit a problem when dealing with empty .nettiers TList objects.

The code below shows the problem. Classes ProductRelationship and ProductRelationshipService were generated by .nettiers from the database. These classes perform database table access. A TList is a .nettiers list structure.

Could it be that TypeMock affects a .nettiers TList class at runtime in such a way that the Predicate overload of the FindAll method does not work on an empty list (i.e. Count = 0)? If FindAll is called on an empty TList a corrupted TList seems to be returned. (I have confirmed that if TypeMock is not used to generate the TList then there is no problem in calling FindAll on an empty TList.)

Are there any know TypeMock bugs that might explain what I have seen? Any assistance would be much appreciated.

TList<ProductRelationship> TestProductRelationshipList =
    new TList<ProductRelationship>();
var FakeProductRelationshipService =
Isolate.WhenCalled(() =>

TList<ProductRelationship> MyList =
int count = MyList.Count;  //this line works fine returning 0 as expected
TList<ProductRelationship> MyFilteredList = MyList.FindAll(
    delegate(ProductRelationship pr) { return pr.ProductId == 1; });
count = MyFilteredList.Count; //null-reference exception thrown
asked by michael.harden@adact (600 points)

1 Answer

0 votes
Hi Michael,

Nothing pops into mind. I am not aware of any compatibility issue with .nettifier. Would it be possible to send over a small solution file recreating this issue to support (at) That would greatly help me investigate the issue.

Typemock Support
answered by doron (17.2k points)