Skip to content

Commit

Permalink
Require user defined conversion for multicast
Browse files Browse the repository at this point in the history
  • Loading branch information
glopesdev committed Jul 6, 2023
1 parent 7dcd6af commit 54ffac5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Bonsai.Core/Expressions/MulticastSubject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ public override Expression Build(IEnumerable<Expression> arguments)
var subjectType = subjectExpression.Type.GetGenericArguments()[0];
if (observableType != subjectType)
{
if (!HasConversion(observableType, subjectType))
{
throw new InvalidOperationException(
$"No coercion operator is defined between types '{observableType}' and '{subjectType}'."
);
}

source = CoerceMethodArgument(typeof(IObservable<>).MakeGenericType(subjectType), source);
observableType = subjectType;
}
Expand Down

0 comments on commit 54ffac5

Please sign in to comment.