Cosmos icon indicating copy to clipboard operation
Cosmos copied to clipboard

Implement MulticastDelegate for event support

Open ascpixi opened this issue 1 year ago • 1 comments

What is the usecase for this plug In order to support events, an implementation of multicast delegates is needed. Currently, it seems like the plugs for this class are missing.

Complexity of plug As a multicast delegate is an invocation list, this should be trivial to implement.

Describe alternatives you've considered A possible alternative is using a List<T>, where T is the delegate type.

Additional context Currently, using events results in the following method being unplugged:

1>  Need plug for: System.MulticastDelegate  System.Delegate.InternalAllocLike(System.Delegate)(Plug Signature: System_MulticastDelegate__System_Delegate_InternalAllocLike_System_Delegate_ ).
1>  Static: True
1>  Assembly: System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
1>  Called from:
1>System.MulticastDelegate::System.MulticastDelegate NewMulticastDelegate(System.Object[], Int32, Boolean)
1>System.MulticastDelegate::System.Delegate CombineImpl(System.Delegate)
1>System.Delegate::System.Delegate CombineImpl(System.Delegate)

Interestingly enough, Cosmos seems to have a plug related to multicast delegates: https://github.com/CosmosOS/Cosmos/blob/master/source/Cosmos.Core_Plugs/System/DelegateImpl.cs#L35

This is possibly a software regression.

ascpixi avatar Sep 07 '23 19:09 ascpixi

This looks like a regression, since the plug seems to exist as pointed out

quajak avatar Sep 08 '23 15:09 quajak