Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Serialization KeyNotFoundException when looking up serializers #2356

Merged
merged 2 commits into from
Nov 1, 2016

Conversation

ayoung
Copy link
Contributor

@ayoung ayoung commented Oct 31, 2016

A KeyNotFoundException can occur if the serializer dll is not present in the search paths for binaries. This can occur when there is a proj A that depends on B and B depends on Akka. There is no direct reference to any of the serializers in either A or B besides being referenced in HOCON. MSBuild likes to optimize dlls out of the output if they are not directly referenced in code.

@Aaronontheweb
Copy link
Member

@ayoung I like it. Seen this come up when working with Akka.Persistence and using Wire only.

@ayoung
Copy link
Contributor Author

ayoung commented Oct 31, 2016

@Aaronontheweb Yes. That was precisely my problem. Spent about an hour trying to figure out what was happening. What is the common solution for this problem? Currently I've been having to do dirty things like this in my code to force msbuild not to ignore those dlls.

public static readonly Type[] References =
{
    typeof (IActorRef),
    typeof (Akka.Cluster.Cluster),
    typeof (Akka.Serialization.WireSerializer)
};

@ayoung
Copy link
Contributor Author

ayoung commented Oct 31, 2016

Also, its not a NullRefEx. Its a KeyNotFoundException. I'll update soon.

A KeyNotFoundException can occur if the serializer dll is not present
in the search paths for binaries. This can occure when there is a
proj A that depends on B and B depends on Akka. There is no direct
reference to any of the serializers in either A or B besides being
referenced in HOCON. MSBuild likes to optimize dlls out of the out-
put if they are not directly referenced in code.
@ayoung ayoung force-pushed the fix-serialization-nullrefex branch from 9bae11f to 6bd6128 Compare October 31, 2016 18:24
@ayoung ayoung changed the title Fix Serialization NullRefEx when looking up serializers. Fix Serialization KeyNotFoundException when looking up serializers Oct 31, 2016
@marcpiechura marcpiechura merged commit 7b3ba05 into akkadotnet:dev Nov 1, 2016
@ayoung ayoung deleted the fix-serialization-nullrefex branch November 1, 2016 18:05
@Aaronontheweb Aaronontheweb modified the milestone: 1.1.3 Jan 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants