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
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 etropic (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 dhelper (11.9k points)
...