Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Access to instance members in async postconditions lead to invalid IL #365

Closed
SergeyTeplyakov opened this issue Feb 3, 2016 · 0 comments
Labels

Comments

@SergeyTeplyakov
Copy link
Contributor

Consider following example:

class State
{
    private int _state;
    public async Task<int> StartAsync()
    {
        Contract.Ensures(Contract.Result<int>() != 0 && _state == -1);
        await Task.Delay(42);
    }
}

With current implmenetation AsyncClosure doesn't have a _this field that will point to enclosing class, that's why using any instance members in async postconditions lead to invalid IL.

SergeyTeplyakov added a commit to SergeyTeplyakov/CodeContracts that referenced this issue Feb 5, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant