Skip to content

Conversation

ghost
Copy link

@ghost ghost commented Apr 30, 2019

While running some unit tests using a PersistentActor a NullReferenceException was encountered. The culprit seems to be that when producer.Produce() throws an exception, the creation of the TypeLoadException throws a NullReferenceException when Arguments is null. The relevant excerpt from Props lines 568-577

        public virtual ActorBase NewActor()
        {
            var type = Type;
            var arguments = Arguments;
            try {
                return producer.Produce();
            } catch (Exception e) {
                throw new TypeLoadException($"Error while creating actor instance of type {type} with {arguments.Length} args: ({StringFormat.SafeJoin(",", arguments)})", e);
            }
        }

This fix ensures that no matter how the Props is constructed, Arguments will not be null fixing the above issue. This problem might be related to issue #2026.

Copy link
Member

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Aaronontheweb
Copy link
Member

Test failure was unrelated - re-running it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant