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

NoSender is changed to null (Fixes for NoSender serialization bugs) #1041

Merged

Conversation

ssoshchepkov
Copy link
Contributor

Fixes for NoSender actor reference serialization bugs described in #1036.
NoSender actor reference is changed to null as discussed in #1037.

@rogeralsing
Copy link
Contributor

There seems to be some side effect to this.
Possibly just an error in some spec

System.NullReferenceException : Object reference not set to an instance of an object.
   at System.Object.GetType()
   at Akka.TestKit.TestKitBase.InternalExpectMsgEnvelope[T](Nullable`1 timeout, Action`2 assert, String hint, Boolean shouldLog) in d:\BuildAgent\work\49b164d63843fb4\src\core\Akka.TestKit\TestKitBase_Expect.cs:line 202
   at Akka.TestKit.TestKitBase.InternalExpectMsg[T](Nullable`1 timeout, Action`2 assert, String hint) in d:\BuildAgent\work\49b164d63843fb4\src\core\Akka.TestKit\TestKitBase_Expect.cs:line 166
   at Akka.TestKit.TestKitBase.ExpectMsg[T](Predicate`1 isMessage, Nullable`1 timeout, String hint) in d:\BuildAgent\work\49b164d63843fb4\src\core\Akka.TestKit\TestKitBase_Expect.cs:line 57
   at Akka.Testkit.Tests.NoImplicitSenderSpec.When_Not_ImplicitSender_then_testActor_is_not_sender() in d:\BuildAgent\work\49b164d63843fb4\src\core\Akka.TestKit.Tests\NoImplicitSenderSpec.cs:line 22

@ssoshchepkov
Copy link
Contributor Author

Yes, in this spec actor sends NoSender as a message:

public class NoImplicitSenderSpec : AkkaSpec, INoImplicitSender
    {
        [Fact]
        public void When_Not_ImplicitSender_then_testActor_is_not_sender()
        {
            var echoActor = Sys.ActorOf(c => c.ReceiveAny((m, ctx) => TestActor.Tell(ctx.Sender)));
            echoActor.Tell("message");
            ExpectMsg<IActorRef>(actorRef => Equals(actorRef, ActorRefs.NoSender));
        }

    }

TestActor.Tell(ctx.Sender) sends null and then message.GetType() for this message causes NullReferenceException:

_assertions.Fail(failMessage2, typeof(T), message.GetType(), message, hint ?? "", sender);

@rogeralsing
Copy link
Contributor

Could you mark the failing test with skip attribute?
Just so we dont merge failing tests that confuse others before the test itself is cleaned up or removed

rogeralsing added a commit that referenced this pull request Jun 5, 2015
…-1036

NoSender is changed to null (Fixes for NoSender serialization bugs)
@rogeralsing rogeralsing merged commit 5ff3e12 into akkadotnet:dev Jun 5, 2015
@rogeralsing
Copy link
Contributor

Thanks!

@ssoshchepkov ssoshchepkov deleted the nosender-serialization-fix-1036 branch June 6, 2015 09:04
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.

2 participants