Properties of inherited classes are missing on receiver side
See original GitHub issueScenario: We have a common base project for message contents, for example:
public abstract class BaseQueueElement
{
[AmqpMember]
public string Name {get;set;}
}
Now for the implementation projects we use something like:
[AmqpContract(Name = "PositionQueueElement", Encoding = EncodingType.SimpleMap)]
public sealed class PositionQueueElement : BaseQueueElement
{
[AmqpMember]
public int X { get; set; }
[AmqpMember]
public int Y { get; set; }
[AmqpMember]
public int Z { get; set; }
}
Because we’re using .NET Core we have to use the AmqpValue where TElement is PositionQueueElement
AmqpValue<TElement> ser = new AmqpValue<TElement>(element);
Message message = new Message { BodySection = ser };
await _senderLink.SendAsync(message);
In the debugger we can see the serialization of AmqpValue
and Message
works fine.
On the receiver side the Name property is missing.
(the different values of X/Y/Z are just because I’ve debugged different messages).
Is this a serialization issue? Or by design?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
c# - Cannot access public properties in derived class
It will not have access to the Child class properties. Though the object is instantiated with a child Class, the reference still points...
Read more >Why inherit a class without adding properties?
I think it's worth pointing out that a new class inheriting from another does add a new property - the name of the...
Read more >Using classes - JavaScript - MDN Web Docs - Mozilla
JavaScript is a prototype-based language — an object's behaviors are specified by its own properties and its prototype's properties.
Read more >Inheritance Basics - Visual Basic
The Inherits statement is used to declare a new class, called a derived class, based on an existing class, known as a base...
Read more >Inheritance Is Evil. Stop Using It. | by Nicolò Pignatelli
Using inheritance is not the only way to extend a class behavior, but definitely is the most dangerous and harmful one.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is not expected. I will look into it.
@xinchen10 is there any possibility to use (existing) POCO classes without those attributes?