Skip to content

Commit 3b81c64

Browse files
rmarinhoCopilot
andauthored
Include parameter name in ArgumentNullException for SDK version types (#186)
Add nameof(version) to all ArgumentNullException throws in AppleSdkVersion, IPhoneSdkVersion, and MacOSXSdkVersion constructors for better diagnostics. The int[] overload in AppleSdkVersion already did this correctly; this makes the other constructors consistent. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent a200df6 commit 3b81c64

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

Xamarin.MacDev/AppleSdkVersion.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public struct AppleSdkVersion : IComparable<AppleSdkVersion>, IEquatable<AppleSd
3838
public AppleSdkVersion (Version version)
3939
{
4040
if (version == null)
41-
throw new ArgumentNullException ();
41+
throw new ArgumentNullException (nameof (version));
4242

4343
if (version.Build != -1) {
4444
this.version = new int [3];

Xamarin.MacDev/IPhoneSdkVersion.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public struct IPhoneSdkVersion : IComparable<IPhoneSdkVersion>, IEquatable<IPhon
3838
public IPhoneSdkVersion (Version version)
3939
{
4040
if (version == null)
41-
throw new ArgumentNullException ();
41+
throw new ArgumentNullException (nameof (version));
4242

4343
if (version.Build != -1) {
4444
this.version = new int [3];
@@ -54,7 +54,7 @@ public IPhoneSdkVersion (Version version)
5454
public IPhoneSdkVersion (params int [] version)
5555
{
5656
if (version == null)
57-
throw new ArgumentNullException ();
57+
throw new ArgumentNullException (nameof (version));
5858

5959
this.version = version;
6060
}

Xamarin.MacDev/MacOSXSdkVersion.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public struct MacOSXSdkVersion : IComparable<MacOSXSdkVersion>, IEquatable<MacOS
3636
public MacOSXSdkVersion (params int [] version)
3737
{
3838
if (version == null)
39-
throw new ArgumentNullException ();
39+
throw new ArgumentNullException (nameof (version));
4040
this.version = version;
4141
}
4242

@@ -48,7 +48,7 @@ void IAppleSdkVersion.SetVersion (int [] version)
4848
public MacOSXSdkVersion (Version version)
4949
{
5050
if (version == null)
51-
throw new ArgumentNullException ();
51+
throw new ArgumentNullException (nameof (version));
5252
this.version = new [] { version.Major, version.Minor };
5353
}
5454

0 commit comments

Comments
 (0)