Version Used: 15.3 Preview 3
Steps to Reproduce:
- Create a custom task-like type with the method builder implemented as a
struct
- In the
Start<TStateMachine> method, set the value of a field of the method builder
- In the
SetResult method, read the value of the field
Expected Behavior:
The value read in SetResult will match the value written to the field in Start<TStateMachine>.
Actual Behavior:
The value read in SetResult is the value of the field at the point Create() returned.
Cause:
The Start<TStateMachine> method is called on a copy of the builder on the stack instead of calling it on the instance returned from Create().
Workaround:
Set the state in Create() instead of Start<TStateMachine>.