Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullReferenceException when configuring expectation #25

Closed
kentcb opened this issue Feb 18, 2016 · 1 comment
Closed

NullReferenceException when configuring expectation #25

kentcb opened this issue Feb 18, 2016 · 1 comment
Assignees
Labels

Comments

@kentcb
Copy link
Owner

kentcb commented Feb 18, 2016

When configuring expectations for Akavache's IBlobCache, I did something like this:

this
    .When(x => x.GetCreatedAt(It.IsAny<IEnumerable<string>>()))
    .Return(Observable.Return<Dictionary<string, DateTimeOffset?>>(null));

But this resulted in an exception:

System.NullReferenceException: Object reference not set to an instance of an object.
   at PCLMock.MockBase`1.GetContinuationKey(LambdaExpression selector)
   at PCLMock.MockBase`1.EnsureWhenContinuationCollection(LambdaExpression memberSelector)
   at PCLMock.MockBase`1.AddOrReplaceWhenContinuation(LambdaExpression memberSelector, WhenContinuation continuation)
   at PCLMock.MockBase`1.When[TMember](Expression`1 selector)
@kentcb kentcb added the bug label Feb 18, 2016
@kentcb kentcb self-assigned this Feb 18, 2016
@kentcb
Copy link
Owner Author

kentcb commented Feb 18, 2016

Ooops, that's because they're extension methods. All the same, it might be nice to report a nice error when this mistake is made.

@kentcb kentcb closed this as completed in 1389bd0 Apr 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant