Skip to content
This repository was archived by the owner on May 15, 2024. It is now read-only.

Throw ArgumentNullException when passing null to a Share request#1413

Merged
mattleibow merged 3 commits intoxamarin:mainfrom
RodgerLeblanc:issue-963
Oct 7, 2020
Merged

Throw ArgumentNullException when passing null to a Share request#1413
mattleibow merged 3 commits intoxamarin:mainfrom
RodgerLeblanc:issue-963

Conversation

@RodgerLeblanc
Copy link
Copy Markdown
Contributor

Description of Change

Ensures that all supported platforms throws the same exception when passing invalid argument to a Share request.
No sample added as this behavior can be validated by running the samples and sending a Share request without any arguments.

Bugs Fixed

API Changes

None.

Behavioral Changes

All platforms will now throw an ArgumentNullException when passing null as parameter to Share API. Previously, the Tizen platform was throwing an ArgumentNullException and the other platforms would throw a NullReferenceException when trying to access a property of a null object.

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Changes adhere to coding standard
  • Updated documentation (see walkthrough)

@ghost
Copy link
Copy Markdown

ghost commented Oct 4, 2020

CLA assistant check
All CLA requirements met.

Comment on lines +12 to +17
if (request == null)
throw new ArgumentNullException(nameof(request));

if (string.IsNullOrEmpty(request.Text) && string.IsNullOrEmpty(request.Uri))
throw new ArgumentNullException(nameof(request.Text));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe we can move this to the shard layer? Then we don't need to duplicate the code in every platform.

@mattleibow
Copy link
Copy Markdown
Member

/azp run

Copy link
Copy Markdown
Contributor

@Mrnikbobjeff Mrnikbobjeff left a comment

Choose a reason for hiding this comment

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

Looking good just some minor nitpicks. The Exception nameof parameter is the most important change IMHO which needs to be adressed

Copy link
Copy Markdown
Member

@mattleibow mattleibow left a comment

Choose a reason for hiding this comment

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

I think I quite like this.

@mattleibow mattleibow merged commit 0dba844 into xamarin:main Oct 7, 2020
@mattleibow mattleibow added this to the 1.6.0 milestone Oct 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants