Currently can not create this.
[Union(0, typeof(RemotableNotificationOnNext<>))]
[Union(1, typeof(RemotableNotificationOnError<>))]
[Union(2, typeof(RemotableNotificationOnCompleted<>))]
public interface IRemotableNotification<T>
{
}
[MessagePackObject]
public class RemotableNotificationOnNext<T> : IRemotableNotification<T>
{
[Key(0)]
public T Value { get; private set; }
[SerializationConstructor]
public RemotableNotificationOnNext(T value)
{
this.Value = value;
}
}
[MessagePackObject]
public class RemotableNotificationOnError<T> : IRemotableNotification<T>
{
[Key(0)]
public string ErrorMessage { get; private set; }
[SerializationConstructor]
public RemotableNotificationOnError(string errorMessage)
{
this.ErrorMessage = errorMessage;
}
}
[MessagePackObject]
public class RemotableNotificationOnCompleted<T> : IRemotableNotification<T>
{
}
Is there any chance this will be supported? I'm currently having the same issue.
Yes, it would be amazing to get this work in the near future. We're struggeling with this issue for a while.
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days.
Hi - this is going to be a major problem for me - can you please help? I have a class hierarchy requirement like this:
[MessagePack.MessagePackObject]
[MessagePack.Union(0, typeof(ClassB<>)] // Note the requirement to register that ClassB is generic here
abstract class ClassA
{...}
[MessagePack.MessagePackObject]
[MessagePack.Union(0, typeof(ClassC)]
abstract class ClassB<T> : ClassA
{...}
[MessagePack.MessagePackObject]
class ClassC : ClassB<ClassD>
{...}
class ClassD
{...}
Can the unions for ClassA directly reference ClassC?
We close inactive issues to allow us to better focus on high impact issues that impact a great number of folks. This hasn't shown up high on the list. If you'd like to offer to send a PR to fix it and include tests, we can reactivate and assign the issue to you.
@AArnott I worked out that this is what I need to do, and so have no requirement for a change to the current UnionAttribute:
[MessagePack.MessagePackObject]
[MessagePack.Union(0, typeof(ClassC)] // Reference double inherited ClassC directly here!!!
abstract class ClassA
{...}
[MessagePack.MessagePackObject]
abstract class ClassB<T> : ClassA
{...}
[MessagePack.MessagePackObject]
class ClassC : ClassB<ClassD>
{...}
class ClassD
{...}
Many thanks for great library, Simon
Most helpful comment
Is there any chance this will be supported? I'm currently having the same issue.