Skip to content

MessageSubscriberAsyncExtensions.FirstAsync is not working. #16

Description

@c3-hoge-fuga-piyo

Unity 6000.0.45f1

using UnityEngine;

using ZeroMessenger;

struct Message
{
}

sealed class Test : MonoBehaviour
{
    async void Start()
    {
        var broker = MessageBroker<Message>.Default;

        await broker.FirstAsync(this.destroyCancellationToken);
    }
}
ArgumentException: Message handler is already assigned.
ZeroMessenger.MessageBroker`1[T].Subscribe (ZeroMessenger.MessageHandler`1[T] handler) (at <35f312125e30466b9536671d1da5e9f6>:0)
ZeroMessenger.MessageSubscriberAsyncExtensions.FirstAsync[T] (ZeroMessenger.IMessageSubscriber`1[T] subscriber, System.Threading.CancellationToken cancellationToken) (at <35f312125e30466b9536671d1da5e9f6>:0)
Test.Start () (at Assets/Scripts/Test.cs:15)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) (at <27bd554a9f0e46179afd19da1336e638>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:156)
UnityEngine.UnitySynchronizationContext.Exec () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:84)
UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/UnitySynchronizationContext.cs:110)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions