-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Fix Issue #41822 Add IsNullOrEmpty or IsNullOrWhiteSpace check for method parameters throws an empty "message" #42101
Conversation
...atures/Core/Portable/InitializeParameter/AbstractAddParameterCheckCodeRefactoringProvider.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/CSharpTest/InitializeParameter/AddParameterCheckTests.cs
Outdated
Show resolved
Hide resolved
...atures/Core/Portable/InitializeParameter/AbstractAddParameterCheckCodeRefactoringProvider.cs
Outdated
Show resolved
Hide resolved
...atures/Core/Portable/InitializeParameter/AbstractAddParameterCheckCodeRefactoringProvider.cs
Outdated
Show resolved
Hide resolved
...atures/Core/Portable/InitializeParameter/AbstractAddParameterCheckCodeRefactoringProvider.cs
Outdated
Show resolved
Hide resolved
add localized text
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need review
src/Workspaces/VisualBasic/Portable/CodeGeneration/VisualBasicSyntaxGenerator.vb
Show resolved
Hide resolved
@@ -1460,6 +1460,16 @@ This version used in: {2}</value> | |||
<data name="Implement_explicitly" xml:space="preserve"> | |||
<value>Implement explicitly</value> | |||
</data> | |||
<data name="cannot_be_null_or_empty" xml:space="preserve"> | |||
<value>cannot be null or empty</value> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a {0}
place holder for replacement with the parameter name. Constructing this string with concatenation may not make sense for all languages.
@@ -330,17 +330,17 @@ public C(string a, string b, string c) | |||
{ | |||
if (string.IsNullOrEmpty(a)) | |||
{ | |||
throw new ArgumentException(""message"", nameof(a)); | |||
throw new ArgumentException($""'{nameof(a)}' cannot be null or empty"", nameof(a)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests will fail on spanish leg if they reference english strings.
<data name="Struct_contains_assignment_to_this_outside_of_constructor_Make_readonly_fields_writable" xml:space="preserve"> | ||
<value>Struct contains assignment to 'this' outside of constructor. Make readonly fields writable</value> | ||
<comment>{Locked="Struct"}{Locked="this"} these are C#/VB keywords and should not be localized.</comment> | ||
</data> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this added?
return generator.ObjectCreationExpression( | ||
GetTypeNode(compilation, generator, typeof(ArgumentException)), | ||
generator.LiteralExpression("message"), | ||
generator.InterpolatedStringExpression( | ||
generator.CreateInterpolatedStringStartToken(false).WithLeadingTrivia(content.First().GetLeadingTrivia()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
named arg for false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the first/last content nodes won't have any trivia. so i don't know why w're taking trivia from them and adding to the interpolated string.
<source>{0} can be simplified</source> | ||
<target state="translated">{0} se dá zjednodušit.</target> | ||
<note /> | ||
</trans-unit> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this aded?
@Sliptory If you'd like, we can pick up this PR from you and finish it. Thanks! |
Ok, Thanks!) |
@JoeRobich i can take this unless you wanted to :) |
@CyrusNajmabadi Please, be my guest =) |
@JoeRobich this is ready for review. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Auto-approval
Thanks @Sliptory . Sorry that took so long :) |
#41822