Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should ObjectGraphHelper include static members? #400

Open
grx70 opened this issue Feb 11, 2020 · 1 comment
Open

Should ObjectGraphHelper include static members? #400

grx70 opened this issue Feb 11, 2020 · 1 comment
Milestone

Comments

@grx70
Copy link

grx70 commented Feb 11, 2020

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?

@AngusMcIntyreLTS
Copy link

It is my opinion that this absolutely shouldn't for the reasons you suggest.

@robertcoltheart robertcoltheart added this to the 2.0.0 milestone Dec 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants