Skip to content

Instantly share code, notes, and snippets.

@fdbeirao
Created April 30, 2019 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fdbeirao/a07ceb4f8ab4e9fc3e215d101903f3b1 to your computer and use it in GitHub Desktop.
Save fdbeirao/a07ceb4f8ab4e9fc3e215d101903f3b1 to your computer and use it in GitHub Desktop.
Akka.Net NullReferenceException while creating PersistentActor using a CallingThreadDispatcher
using Akka.Actor;
using Akka.Configuration;
using Akka.Persistence;
using Akka.TestKit;
using System;
using System.Threading.Tasks;
namespace akka_dispatcher_bug
{
class Program
{
static async Task Main(string[] args)
{
var actorSystem = ActorSystem.Create("mysystem", ConfigurationFactory.ParseString(@"
akka {
actor.default-dispatcher.type = """ + typeof(CallingThreadDispatcherConfigurator).AssemblyQualifiedName + @"""
scheduler.implementation = """ + typeof(TestScheduler).AssemblyQualifiedName + @"""
}"));
actorSystem.ActorOf(Props.Create<MyActor>());
Console.WriteLine("Press Enter to terminate the actor system");
Console.ReadLine();
await actorSystem.Terminate();
}
}
public class MyActor : ReceivePersistentActor
{
public override string PersistenceId => "Any";
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Akka" Version="1.3.12" />
<PackageReference Include="Akka.Persistence" Version="1.3.12" />
<PackageReference Include="Akka.TestKit" Version="1.3.12" />
</ItemGroup>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment