Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/Foundation/NSUrlSessionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public NSUrlSessionHandler () : this (CreateConfig ())
public NSUrlSessionHandler (NSUrlSessionConfiguration configuration)
{
if (configuration is null)
throw new ArgumentNullException (nameof (configuration));
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (configuration));

// HACK: we need to store the following because session.Configuration gets a copy of the object and the value gets lost
sessionType = configuration.SessionType;
Expand Down Expand Up @@ -578,7 +578,7 @@ public int MaxAutomaticRedirections {
set {
// I believe it's possible to implement support for MaxAutomaticRedirections (it just has to be done)
if (value != int.MaxValue)
throw new ArgumentOutOfRangeException (nameof (value), value, "It's not possible to lower the max number of automatic redirections.");;
ObjCRuntime.ThrowHelper.ThrowArgumentOutOfRangeException (nameof (value), value, "It's not possible to lower the max number of automatic redirections.");;
}
}

Expand Down Expand Up @@ -669,7 +669,7 @@ public bool UseProxy {
get => true;
set {
if (!value)
throw new ArgumentOutOfRangeException (nameof (value), value, "It's not possible to disable the use of system proxies.");;
ObjCRuntime.ThrowHelper.ThrowArgumentOutOfRangeException (nameof (value), value, "It's not possible to disable the use of system proxies.");;
}
}
#endif // NET
Expand Down Expand Up @@ -1083,10 +1083,10 @@ public MonoStreamContent (Stream content)
public MonoStreamContent (Stream content, int bufferSize)
{
if (content is null)
throw new ArgumentNullException ("content");
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (content));

if (bufferSize <= 0)
throw new ArgumentOutOfRangeException ("bufferSize");
ObjCRuntime.ThrowHelper.ThrowArgumentOutOfRangeException (nameof (bufferSize), bufferSize, "Buffer size must be >0");

this.content = content;
this.bufferSize = bufferSize;
Expand Down
6 changes: 6 additions & 0 deletions src/ObjCRuntime/ThrowHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ public static void ThrowArgumentOutOfRangeException (string argumentName, string
throw new ArgumentOutOfRangeException (argumentName, message);
}

[DoesNotReturn]
public static void ThrowArgumentOutOfRangeException (string argumentName, object actualValue, string message)
{
throw new ArgumentOutOfRangeException (argumentName, actualValue, message);
}

[DoesNotReturn]
public static void ThrowObjectDisposedException (object o)
{
Expand Down