question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Properties of inherited classes are missing on receiver side

See original GitHub issue

Scenario: 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. image

On the receiver side the Name property is missing.

image (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:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
xinchen10commented, Dec 14, 2017

This is not expected. I will look into it.

0reactions
BenjaminAbtcommented, Feb 28, 2018

@xinchen10 is there any possibility to use (existing) POCO classes without those attributes?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found