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

Fix null parms in String.Format #144

Merged
merged 6 commits into from
Jun 7, 2021
Merged

Conversation

edleno2
Copy link
Contributor

@edleno2 edleno2 commented Jun 7, 2021

Description

  • Check all parm objects passed to String.Format for null. If null treat the result as an empty string
  • Do not call ToString from a null object
  • Update unit tests to test String.Format with and without null parms

Motivation and Context

How Has This Been Tested?

Unit tests on Win32

Screenshots

Types of changes

  • Improvement (non-breaking change that improves a feature, code or algorithm)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Config and build (change in the configuration and build system, has no impact on code or features)
  • Dependencies (update dependencies and changes associated, has no impact on code or features)
  • Unit Tests (work on Unit Tests, has no impact on code or features)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

String.Format should not call ToString() on null objects, or throw a null exception is a parm is null.  It it so treat the parm as an empty string.  This is consistent with .net core.

Fix #772
edleno2 and others added 5 commits June 6, 2021 22:48
String.Format should not call ToString() on null objects, or throw a null exception is a parm is null.  It it so treat the parm as an empty string.  This is consistent with .net core.

Added unit tests with/without nulls, tested interpolated strings.

Fix #772
@josesimoes josesimoes marked this pull request as ready for review June 7, 2021 18:08
Copy link
Member

@josesimoes josesimoes left a comment

Choose a reason for hiding this comment

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

LGMT!

@josesimoes
Copy link
Member

Ignoring failed Unit Tests.

@josesimoes josesimoes merged commit fc8c2c0 into nanoframework:develop Jun 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ToString() fails with null object
3 participants