Skip to content

WeakEventManager not thread safe #1

@mojoe-playground

Description

@mojoe-playground

Sometimes I'm getting NullReferenceException when trying to register listeners from multiple threads at the same time.

Call stack:
at System.Collections.Generic.Dictionary'2.Insert(TKey key, TValue value, Boolean add)
at MissingFrom.Net.WeakEventManager.AddWeakEventListener[T](T source, Action'2 handler)

Locking around usages of _listeners dictionary should make the class thread safe

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions