Skip to content

Conversation

@dragoni7
Copy link
Contributor

@dragoni7 dragoni7 commented Nov 8, 2023

Resolved / Related Issues

Validation
How did you test these changes?

  • Did you build the app and test your changes?
  • Did you check for accessibility? You can use Accessibility Insights for this.
  • Did you remove any strings from the en-us resource file?
    • Did you search the solution to see if the string is still being used?
  • Did you implement any design changes to an existing feature?
    • Was this change approved?
  • Are there any other steps that were used to validate these changes?
    1. Tested code snippet in external test project to ensure System.FormatException was handled

Screenshots (optional)
Add screenshots here.

@yaira2 yaira2 changed the title Handle format exception raised by Convert.ToInt32 Fix: Handle format exception raised by Convert.ToInt32 Nov 8, 2023
@yaira2 yaira2 added the ready for review Pull requests that are ready for review label Nov 8, 2023
@gave92
Copy link
Member

gave92 commented Nov 8, 2023

Hi @dragoni7 thanks for this PR! Please see https://github.com/dragoni7/Files/pull/1/files for suggested changes.

  • Backup conversion should not be needed because Convert.ToInt32() calls int.Parse(string) internally.
  • The exception you're trying to solve is from this line { "FormatDuration", input => TimeSpanToString(new TimeSpan(Convert.ToInt64(input)))}, (note the "ToInt64()" like in the stacktrace) so a try catch is also needed around DisplayFunction.Invoke()
@gave92 gave92 added ready to merge Pull requests that are approved and ready to merge and removed ready for review Pull requests that are ready for review labels Nov 8, 2023
@gave92 gave92 self-requested a review November 8, 2023 20:05
@yaira2 yaira2 merged commit f4ab096 into files-community:main Nov 8, 2023
@yaira2
Copy link
Member

yaira2 commented Nov 9, 2023

@dragoni7 thank you for contributing to Files!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready to merge Pull requests that are approved and ready to merge

3 participants