Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Add some tests for invalid inputs to MemberAccess expressions - #10940

Merged
stephentoub merged 3 commits into
dotnet:masterfrom
hughbe:memberaccess-test-additions
Aug 19, 2016
Merged

Add some tests for invalid inputs to MemberAccess expressions#10940
stephentoub merged 3 commits into
dotnet:masterfrom
hughbe:memberaccess-test-additions

Conversation

@hughbe

@hughbe hughbe commented Aug 17, 2016

Copy link
Copy Markdown

Contributes to #1198

/cc @stephentoub

public static MemberExpression Field(Expression expression, string fieldName)
{
RequiresCanRead(expression, nameof(expression));
ContractUtils.RequiresNotNull(fieldName, nameof(fieldName));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this changing an exception type / message / parameter name / etc. that's getting thrown?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the parameter name only. Without it you get the same exception but an empty Parm name - I put it in here to be consistent with Property that checks before calling Type.GetProperty

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Ok.

@stephentoub

Copy link
Copy Markdown
Member

Thanks. LGTM.

cc: @VSadov

@hughbe

hughbe commented Aug 18, 2016

Copy link
Copy Markdown
Author

@stephentoub I've also just added a new test, but had to rebase to add a dependency in the tests on System.Reflection.Emit, sorry if this means you need to re-review, but the commits are the same

Let's hope this doesn't cause merge conflict hell

@stephentoub

Copy link
Copy Markdown
Member

Thanks, Hugh.

@stephentoub
stephentoub merged commit 258b51d into dotnet:master Aug 19, 2016
@hughbe
hughbe deleted the memberaccess-test-additions branch August 19, 2016 18:56
@karelz karelz modified the milestone: 1.1.0 Dec 3, 2016
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…/corefx#10940)

* Add some tests for invalid inputs to MemberAccess expressions

* Address PR feedback

* Add test for no accessors in ProperyInfo


Commit migrated from dotnet/corefx@258b51d
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants