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

Handle empty string parameter value in MetadataLoadContext #61457

Merged
merged 2 commits into from
Nov 24, 2021

Conversation

svick
Copy link
Contributor

@svick svick commented Nov 11, 2021

Fixes #57238.

Also add test for null parameter default value, since that is another special case.

@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Nov 11, 2021
@ghost
Copy link

ghost commented Nov 11, 2021

Tagging subscribers to this area: @buyaa-n
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #57238.

Also add test for null parameter default value, since that is another special case.

Author: svick
Assignees: -
Labels:

area-System.Reflection.Metadata

Milestone: -

@@ -198,6 +198,8 @@ public class ParametersWithDefaultValues
public void Foo4(short s = -34) { }
public void Foo5(decimal d = 1234m) { }
public void Foo6([DateTimeConstant(ticks: 8736726782)] DateTime dt) { }
public void Foo7(string s1 = "foo", string s2 = "") { }
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: maybe add a test case for null default?

Suggested change
public void Foo7(string s1 = "foo", string s2 = "") { }
public void Foo7(string s1 = "foo", string s2 = "", string s3 = null) { }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, done.

Copy link
Contributor

@buyaa-n buyaa-n left a comment

Choose a reason for hiding this comment

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

Left and NIT, overall LGTM, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Reflection.Metadata community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ParameterInfo.RawDefaultValue throws when default value is string.empty
3 participants