OrleansTestKit
OrleansTestKit copied to clipboard
Question for this.AsReference<IMyGrain> in timers
getting the following when testing a timer
System.ArgumentException : Passing a half baked grain as an argument. It is possible that you instantiated a grain class explicitly, as a regular object and not via Orleans runtime or via proper test mocking (Parameter 'grain')
Stack Trace:
GrainExtensions.AsWeaklyTypedReference(IAddressable grain)
GrainExtensions.AsReference[TGrainInterface](IAddressable grain)
MyGrain.SnapshotTimerFired() line 1029
TestTimerRegistry.FireAllAsync() line 37
using
await Silo.FireAllTimersAsync();
on
var myGrain = await Silo.CreateGrainAsync<MyGrain>(myguid, myspecialstring);
timer is registered in OnActivateAsync
timer callback looks like this:
private async Task SnapshotTimerFired()
{
var me = this.AsReference<IMyGrain>();
await me.CheckForExpiredCallsAndSendSnapshotHACK();
}
the AsReference
is used so the timer execution counts as a grain call.
does the testkit handle this, or it this some other grain having an issue?