Created
April 30, 2019 15:23
-
-
Save fdbeirao/a07ceb4f8ab4e9fc3e215d101903f3b1 to your computer and use it in GitHub Desktop.
Akka.Net NullReferenceException while creating PersistentActor using a CallingThreadDispatcher
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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