Skip to content

Should ObjectGraphHelper include static members? #400

@grx70

Description

@grx70

Although this is not a textbook bug, I still find this to be an issue.

Namely, should ObjectGraphHelper include static members when building an object graph? From what I know, it is only used from within ShouldBeLike assertion extension method, and I don't see how static members could be of any importance in that context. On the other hand, I remember stumbling across an error, where a subject of a ShouldBeLike call was a class that exposed a static member of that same class, and it ended up in a nasty StackOverflowException.

So the proposed change would be to the ObjectGraphHelper.GetKeyValueNode method to filter out static members.

Personally I don't see why static members should be included in ShouldBeLike assertions. But I am more than welcome to be proven wrong.

I am submitting an issue over this so that it gets proper response from the community - is my reasoning sound and the change is justified, or am I missing something?

As a note - the problem with StackOverflowException seems to be resolved, but the question still stands - is it reasonable to include static members in the object graph?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions