-
Notifications
You must be signed in to change notification settings - Fork 966
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
Add resource value validation for DefaultFormatter #588
Conversation
var resourceString = Resources.GetResource(GetResourceKey(resourceKey), _culture); | ||
|
||
if (string.IsNullOrEmpty(resourceString)) | ||
throw new ArgumentException(string.Format("The resource object with key '{0}' was not found", resourceKey), nameof(resourceKey)); |
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.
You can use string interpolation.
string.Format("The resource object with key '{0}' was not found", resourceKey)
->
$"The resource object with key '{resourceKey}' was not found"
var resourceString = Resources.GetResource(GetResourceKey(resourceKey, number), _culture); | ||
|
||
if (string.IsNullOrEmpty(resourceString)) | ||
throw new ArgumentException(string.Format("The resource object with key '{0}' was not found", resourceKey), nameof(resourceKey)); |
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.
You can use string interpolation.
string.Format("The resource object with key '{0}' was not found", resourceKey)
->
$"The resource object with key '{resourceKey}' was not found"
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.
I was not using string interpolation here because if the Stylecop configured to this projects, it can break because you can't configure culture for string interpolation. Fixed now :)
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.
I was not aware of this fact. The more you know 😄
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.
Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt
I don't think so that was me :D Should I re-trigger?
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.
I checked too and I dont think so, but I cant be sure.
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.
And It's building :)
🕐 |
@Chrissx ? |
Ah sorry this was just a ping. Build was succeed. Anything that I need to do? |
You can ping @thedillonb and @onovotny from the original issue. |
@aloisdg feel free to merge when you're satisfied |
@onovotny I am not a collaborator 😉 |
@aloisdg that can be remedied. try again ;) |
@Chrissx Can you add some tests to check the |
@onovotny Done! I will try to be worthy. 😄 |
Added some resource value validation to make the missing resources errors more clear.
Connected to #551 .