Null pointer exception on actor initialization (when using F#)
See original GitHub issueExpected Behavior
I have a service that registers an actor. On dapr run
the service should start without errors.
Actual Behavior
With the following command:
dapr run --app-id actors --app-port 3000 dotnet run
A null pointer exception is thrown:
== APP == Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'fieldName')
== APP == at System.Reflection.Emit.FieldBuilder..ctor(TypeBuilder typeBuilder, String fieldName, Type type, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, FieldAttributes attributes)
== APP == at System.Reflection.Emit.TypeBuilder.DefineFieldNoLock(String fieldName, Type type, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, FieldAttributes attributes)
== APP == at System.Reflection.Emit.TypeBuilder.DefineField(String fieldName, Type type, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, FieldAttributes attributes)
== APP == at Dapr.Actors.Builder.MethodBodyTypesBuilder.BuildRequestBodyType(ICodeBuilderNames codeBuilderNames, CodeBuilderContext context, MethodDescription methodDescription)
== APP == at Dapr.Actors.Builder.MethodBodyTypesBuilder.Build(ICodeBuilderNames codeBuilderNames, CodeBuilderContext context, MethodDescription methodDescription)
== APP == at Dapr.Actors.Builder.MethodBodyTypesBuilder.Build(InterfaceDescription interfaceDescription)
== APP == at Dapr.Actors.Builder.ActorCodeBuilder.BuildMethodBodyTypes(Type interfaceType)
== APP == at Dapr.Actors.Builder.ActorCodeBuilder.Dapr.Actors.Builder.ICodeBuilder.GetOrBuildMethodBodyTypes(Type interfaceType)
== APP == at Dapr.Actors.Builder.MethodDispatcherBuilder`1.Build(InterfaceDescription interfaceDescription)
== APP == at Dapr.Actors.Builder.ActorCodeBuilder.BuildMethodDispatcher(Type interfaceType)
== APP == at Dapr.Actors.Builder.ActorCodeBuilder.Dapr.Actors.Builder.ICodeBuilder.GetOrBuilderMethodDispatcher(Type interfaceType)
== APP == at Dapr.Actors.Builder.ActorCodeBuilder.GetOrCreateMethodDispatcher(Type actorInterfaceType)
== APP == at Dapr.Actors.Communication.ActorMethodDispatcherMap..ctor(IEnumerable`1 interfaceTypes)
== APP == at Dapr.Actors.Runtime.ActorManager..ctor(ActorService actorService)
== APP == at Dapr.Actors.Runtime.ActorRuntime.RegisterActor[TActor](Func`2 actorServiceFactory)
== APP == at Actors.Program.CreateHostBuilder@17-1.Invoke(ActorRuntime actorRuntime) in /home/akkie/projects/dapr-vote/actors/Program.fs:line 18
== APP == at Dapr.Actors.AspNetCore.WebHostBuilderExtensions.UseActors(IWebHostBuilder hostBuilder, Action`1 configureActorRuntime)
== APP == at Actors.Program.CreateHostBuilder@14.Invoke(IWebHostBuilder webBuilder) in /home/akkie/projects/dapr-vote/actors/Program.fs:line 15
== APP == at Microsoft.Extensions.Hosting.GenericHostBuilderExtensions.<>c__DisplayClass0_0.<ConfigureWebHostDefaults>b__0(IWebHostBuilder webHostBuilder)
== APP == at Microsoft.Extensions.Hosting.GenericHostWebHostBuilderExtensions.ConfigureWebHost(IHostBuilder builder, Action`1 configure)
== APP == at Microsoft.Extensions.Hosting.GenericHostBuilderExtensions.ConfigureWebHostDefaults(IHostBuilder builder, Action`1 configure)
== APP == at Actors.Program.CreateHostBuilder(String[] args) in /home/akkie/projects/dapr-vote/actors/Program.fs:line 13
== APP == at Actors.Program.main(String[] args) in /home/akkie/projects/dapr-vote/actors/Program.fs:line 26
Steps to Reproduce the Problem
Checkout https://github.com/PlanBGmbH/dapr-vote and execute the following command in the actors
directory:
dapr run --app-id actors --app-port 3000 dotnet run
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Akka actor throws null pointer error, reason unknown
The NullPointerException should no longer occur. However, my impression is that you could use some more training with futures, actors and ...
Read more >Null pointer exception during initialization of an object
The error message means the value of product IS null and thus failed your If condition. You got a null pointer exception when...
Read more >How to fix a NullPointerException in Android
Learn how to fix NullPointerExceptions in Kotlin, Java, and Android Studio. Then, go deeper and set breakpoints for more controlled testing.
Read more >Discuss | Null Pointer Exception Issue
I've been trying to fix this Null Pointer Exception issue, but I can't find ... Color; public class Home extends Actor { int...
Read more >What is the cause of 'Java.lang.NullPointerException'? ...
NullPointerException" error include: Using an uninitialized object reference: If you declare an object reference variable but do not initialize it with an ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Method parameter names in F# interfaces are optional.
This declaration is valid but fails:
To workaround this issue, the method must be declared as:
Yes, it can be seen as a bug when it comes to enabling F#. At this point core focus is to enable C# development and fix issues found for it.