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 Answers. Here you can ask and receive answers from other community members. And if you liked or disliked an answer or thread: react with an up- or downvote Enjoy!
0 votes
Is there any issue trying to control the behavior of a method that is being accessed through the "Create Private Accessor" option in visual studio?

I get...
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index.

Stack trace is on
System.System.Collections.ArrayList.get_Item(Int32 index)
after some callls through isolator.

If I change the methods to other than private, and use the actual class instead of the accessor class the same code runs fine.

If it matters, this is a "live" object, not a fake. (though I'm using DoInstead to intercept behavior).

thanks :)
asked by (1.8k points)

1 Answer

0 votes
We seem to have an issue when using DoInstead and "Private Accessors". A simple workaround for this problem is to create a fake object and then using DoInstead on that fake object.

I've opened a new bug report and would update this thread when this issue will be resolved.
answered by (11.9k points)
...