question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Null pointer exception on actor initialization (when using F#)

See original GitHub issue

Expected 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:open
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
akkiecommented, Jul 15, 2020

Method parameter names in F# interfaces are optional.

This declaration is valid but fails:

abstract Vote: Animal -> Task<Votes>

To workaround this issue, the method must be declared as:

 abstract Vote: animal: Animal -> Task<Votes>
0reactions
amanbhacommented, Jul 17, 2020

This seems like a bug that could be fixed though right? Is this a protocol limitation or just a bug in the IL generation code?

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found