diff --git a/src/Discord.Net.Core/Entities/Emotes/Emote.cs b/src/Discord.Net.Core/Entities/Emotes/Emote.cs
index d8a4d4088..a59f10546 100644
--- a/src/Discord.Net.Core/Entities/Emotes/Emote.cs
+++ b/src/Discord.Net.Core/Entities/Emotes/Emote.cs
@@ -1,5 +1,4 @@
using System;
-using System.Diagnostics;
using System.Globalization;
namespace Discord
@@ -70,7 +69,7 @@ namespace Discord
{
if (TryParse(text, out Emote result))
return result;
- throw new ArgumentException("Invalid emote format.", nameof(text));
+ throw new ArgumentException(message: "Invalid emote format", paramName: nameof(text));
}
/// Tries to parse an from its raw format.
diff --git a/src/Discord.Net.Core/Entities/Messages/EmbedBuilder.cs b/src/Discord.Net.Core/Entities/Messages/EmbedBuilder.cs
index 6c5d780ca..18e084aa0 100644
--- a/src/Discord.Net.Core/Entities/Messages/EmbedBuilder.cs
+++ b/src/Discord.Net.Core/Entities/Messages/EmbedBuilder.cs
@@ -49,7 +49,7 @@ namespace Discord
get => _title;
set
{
- if (value?.Length > MaxTitleLength) throw new ArgumentException($"Title length must be less than or equal to {MaxTitleLength}.", nameof(Title));
+ if (value?.Length > MaxTitleLength) throw new ArgumentException(message: $"Title length must be less than or equal to {MaxTitleLength}.", paramName: nameof(Title));
_title = value;
}
}
@@ -62,7 +62,7 @@ namespace Discord
get => _description;
set
{
- if (value?.Length > MaxDescriptionLength) throw new ArgumentException($"Description length must be less than or equal to {MaxDescriptionLength}.", nameof(Description));
+ if (value?.Length > MaxDescriptionLength) throw new ArgumentException(message: $"Description length must be less than or equal to {MaxDescriptionLength}.", paramName: nameof(Description));
_description = value;
}
}
@@ -75,7 +75,7 @@ namespace Discord
get => _url;
set
{
- if (!value.IsNullOrUri()) throw new ArgumentException("Url must be a well-formed URI.", nameof(Url));
+ if (!value.IsNullOrUri()) throw new ArgumentException(message: "Url must be a well-formed URI", paramName: nameof(Url));
_url = value;
}
}
@@ -87,7 +87,7 @@ namespace Discord
get => _thumbnail?.Url;
set
{
- if (!value.IsNullOrUri()) throw new ArgumentException("Url must be a well-formed URI.", nameof(ThumbnailUrl));
+ if (!value.IsNullOrUri()) throw new ArgumentException(message: "Url must be a well-formed URI", paramName: nameof(ThumbnailUrl));
_thumbnail = new EmbedThumbnail(value, null, null, null);
}
}
@@ -99,7 +99,7 @@ namespace Discord
get => _image?.Url;
set
{
- if (!value.IsNullOrUri()) throw new ArgumentException("Url must be a well-formed URI.", nameof(ImageUrl));
+ if (!value.IsNullOrUri()) throw new ArgumentException(message: "Url must be a well-formed URI", paramName: nameof(ImageUrl));
_image = new EmbedImage(value, null, null, null);
}
}
@@ -115,8 +115,8 @@ namespace Discord
get => _fields;
set
{
- if (value == null) throw new ArgumentNullException(nameof(Fields), "Cannot set an embed builder's fields collection to null.");
- if (value.Count > MaxFieldCount) throw new ArgumentException($"Field count must be less than or equal to {MaxFieldCount}.", nameof(Fields));
+ if (value == null) throw new ArgumentNullException(paramName: nameof(Fields), message: "Cannot set an embed builder's fields collection to null");
+ if (value.Count > MaxFieldCount) throw new ArgumentException(message: $"Field count must be less than or equal to {MaxFieldCount}.", paramName: nameof(Fields));
_fields = value;
}
}
@@ -390,7 +390,7 @@ namespace Discord
{
if (Fields.Count >= MaxFieldCount)
{
- throw new ArgumentException($"Field count must be less than or equal to {MaxFieldCount}.", nameof(field));
+ throw new ArgumentException(message: $"Field count must be less than or equal to {MaxFieldCount}.", paramName: nameof(field));
}
Fields.Add(field);
@@ -463,8 +463,8 @@ namespace Discord
get => _name;
set
{
- if (string.IsNullOrWhiteSpace(value)) throw new ArgumentException("Field name must not be null, empty or entirely whitespace.", nameof(Name));
- if (value.Length > MaxFieldNameLength) throw new ArgumentException($"Field name length must be less than or equal to {MaxFieldNameLength}.", nameof(Name));
+ if (string.IsNullOrWhiteSpace(value)) throw new ArgumentException(message: "Field name must not be null, empty or entirely whitespace.", paramName: nameof(Name));
+ if (value.Length > MaxFieldNameLength) throw new ArgumentException(message: $"Field name length must be less than or equal to {MaxFieldNameLength}.", paramName: nameof(Name));
_name = value;
}
}
@@ -486,8 +486,8 @@ namespace Discord
set
{
var stringValue = value?.ToString();
- if (string.IsNullOrEmpty(stringValue)) throw new ArgumentException("Field value must not be null or empty.", nameof(Value));
- if (stringValue.Length > MaxFieldValueLength) throw new ArgumentException($"Field value length must be less than or equal to {MaxFieldValueLength}.", nameof(Value));
+ if (string.IsNullOrEmpty(stringValue)) throw new ArgumentException(message: "Field value must not be null or empty.", paramName: nameof(Value));
+ if (stringValue.Length > MaxFieldValueLength) throw new ArgumentException(message: $"Field value length must be less than or equal to {MaxFieldValueLength}.", paramName: nameof(Value));
_value = stringValue;
}
}
@@ -574,7 +574,7 @@ namespace Discord
get => _name;
set
{
- if (value?.Length > MaxAuthorNameLength) throw new ArgumentException($"Author name length must be less than or equal to {MaxAuthorNameLength}.", nameof(Name));
+ if (value?.Length > MaxAuthorNameLength) throw new ArgumentException(message: $"Author name length must be less than or equal to {MaxAuthorNameLength}.", paramName: nameof(Name));
_name = value;
}
}
@@ -590,7 +590,7 @@ namespace Discord
get => _url;
set
{
- if (!value.IsNullOrUri()) throw new ArgumentException("Url must be a well-formed URI.", nameof(Url));
+ if (!value.IsNullOrUri()) throw new ArgumentException(message: "Url must be a well-formed URI", paramName: nameof(Url));
_url = value;
}
}
@@ -606,7 +606,7 @@ namespace Discord
get => _iconUrl;
set
{
- if (!value.IsNullOrUri()) throw new ArgumentException("Url must be a well-formed URI.", nameof(IconUrl));
+ if (!value.IsNullOrUri()) throw new ArgumentException(message: "Url must be a well-formed URI", paramName: nameof(IconUrl));
_iconUrl = value;
}
}
@@ -692,7 +692,7 @@ namespace Discord
get => _text;
set
{
- if (value?.Length > MaxFooterTextLength) throw new ArgumentException($"Footer text length must be less than or equal to {MaxFooterTextLength}.", nameof(Text));
+ if (value?.Length > MaxFooterTextLength) throw new ArgumentException(message: $"Footer text length must be less than or equal to {MaxFooterTextLength}.", paramName: nameof(Text));
_text = value;
}
}
@@ -708,7 +708,7 @@ namespace Discord
get => _iconUrl;
set
{
- if (!value.IsNullOrUri()) throw new ArgumentException("Url must be a well-formed URI.", nameof(IconUrl));
+ if (!value.IsNullOrUri()) throw new ArgumentException(message: "Url must be a well-formed URI", paramName: nameof(IconUrl));
_iconUrl = value;
}
}
diff --git a/src/Discord.Net.Core/Entities/Permissions/ChannelPermissions.cs b/src/Discord.Net.Core/Entities/Permissions/ChannelPermissions.cs
index 3011d8330..c6454c528 100644
--- a/src/Discord.Net.Core/Entities/Permissions/ChannelPermissions.cs
+++ b/src/Discord.Net.Core/Entities/Permissions/ChannelPermissions.cs
@@ -31,7 +31,7 @@ namespace Discord
case ICategoryChannel _: return Category;
case IDMChannel _: return DM;
case IGroupChannel _: return Group;
- default: throw new ArgumentException("Unknown channel type.", nameof(channel));
+ default: throw new ArgumentException(message: "Unknown channel type", paramName: nameof(channel));
}
}
diff --git a/src/Discord.Net.Core/Utils/ConcurrentHashSet.cs b/src/Discord.Net.Core/Utils/ConcurrentHashSet.cs
index bbdc59087..308f08460 100644
--- a/src/Discord.Net.Core/Utils/ConcurrentHashSet.cs
+++ b/src/Discord.Net.Core/Utils/ConcurrentHashSet.cs
@@ -161,7 +161,7 @@ namespace Discord
public ConcurrentHashSet(IEnumerable collection, IEqualityComparer comparer)
: this(comparer)
{
- if (collection == null) throw new ArgumentNullException(nameof(collection));
+ if (collection == null) throw new ArgumentNullException(paramName: nameof(collection));
InitializeFromCollection(collection);
}
///
@@ -170,17 +170,17 @@ namespace Discord
public ConcurrentHashSet(int concurrencyLevel, IEnumerable collection, IEqualityComparer comparer)
: this(concurrencyLevel, DefaultCapacity, false, comparer)
{
- if (collection == null) throw new ArgumentNullException(nameof(collection));
- if (comparer == null) throw new ArgumentNullException(nameof(comparer));
+ if (collection == null) throw new ArgumentNullException(paramName: nameof(collection));
+ if (comparer == null) throw new ArgumentNullException(paramName: nameof(comparer));
InitializeFromCollection(collection);
}
public ConcurrentHashSet(int concurrencyLevel, int capacity, IEqualityComparer comparer)
: this(concurrencyLevel, capacity, false, comparer) { }
internal ConcurrentHashSet(int concurrencyLevel, int capacity, bool growLockArray, IEqualityComparer comparer)
{
- if (concurrencyLevel < 1) throw new ArgumentOutOfRangeException(nameof(concurrencyLevel));
- if (capacity < 0) throw new ArgumentOutOfRangeException(nameof(capacity));
- if (comparer == null) throw new ArgumentNullException(nameof(comparer));
+ if (concurrencyLevel < 1) throw new ArgumentOutOfRangeException(paramName: nameof(concurrencyLevel));
+ if (capacity < 0) throw new ArgumentOutOfRangeException(paramName: nameof(capacity));
+ if (comparer == null) throw new ArgumentNullException(paramName: nameof(comparer));
if (capacity < concurrencyLevel)
capacity = concurrencyLevel;
@@ -201,7 +201,7 @@ namespace Discord
{
foreach (var value in collection)
{
- if (value == null) throw new ArgumentNullException(nameof(value));
+ if (value == null) throw new ArgumentNullException(paramName: "key");
if (!TryAddInternal(value, _comparer.GetHashCode(value), false))
throw new ArgumentException();
@@ -213,7 +213,7 @@ namespace Discord
/// is null
public bool ContainsKey(T value)
{
- if (value == null) throw new ArgumentNullException(nameof(value));
+ if (value == null) throw new ArgumentNullException(paramName: "key");
return ContainsKeyInternal(value, _comparer.GetHashCode(value));
}
private bool ContainsKeyInternal(T value, int hashcode)
@@ -237,7 +237,7 @@ namespace Discord
/// is null
public bool TryAdd(T value)
{
- if (value == null) throw new ArgumentNullException(nameof(value));
+ if (value == null) throw new ArgumentNullException(paramName: "key");
return TryAddInternal(value, _comparer.GetHashCode(value), true);
}
private bool TryAddInternal(T value, int hashcode, bool acquireLock)
@@ -287,7 +287,7 @@ namespace Discord
/// is null
public bool TryRemove(T value)
{
- if (value == null) throw new ArgumentNullException(nameof(value));
+ if (value == null) throw new ArgumentNullException(paramName: "key");
return TryRemoveInternal(value);
}
private bool TryRemoveInternal(T value)
diff --git a/src/Discord.Net.Core/Utils/MentionUtils.cs b/src/Discord.Net.Core/Utils/MentionUtils.cs
index 7e6b22619..051044abc 100644
--- a/src/Discord.Net.Core/Utils/MentionUtils.cs
+++ b/src/Discord.Net.Core/Utils/MentionUtils.cs
@@ -45,7 +45,7 @@ namespace Discord
{
if (TryParseUser(text, out ulong id))
return id;
- throw new ArgumentException("Invalid mention format.", nameof(text));
+ throw new ArgumentException(message: "Invalid mention format", paramName: nameof(text));
}
///
/// Tries to parse a provided user mention string.
@@ -74,7 +74,7 @@ namespace Discord
{
if (TryParseChannel(text, out ulong id))
return id;
- throw new ArgumentException("Invalid mention format.", nameof(text));
+ throw new ArgumentException(message: "Invalid mention format", paramName: nameof(text));
}
///
/// Tries to parse a provided channel mention string.
@@ -100,7 +100,7 @@ namespace Discord
{
if (TryParseRole(text, out ulong id))
return id;
- throw new ArgumentException("Invalid mention format.", nameof(text));
+ throw new ArgumentException(message: "Invalid mention format", paramName: nameof(text));
}
///
/// Tries to parse a provided role mention string.
diff --git a/src/Discord.Net.Core/Utils/Preconditions.cs b/src/Discord.Net.Core/Utils/Preconditions.cs
index 569917312..d04d3be50 100644
--- a/src/Discord.Net.Core/Utils/Preconditions.cs
+++ b/src/Discord.Net.Core/Utils/Preconditions.cs
@@ -10,8 +10,8 @@ namespace Discord
private static ArgumentNullException CreateNotNullException(string name, string msg)
{
- if (msg == null) return new ArgumentNullException(name);
- else return new ArgumentNullException(name, msg);
+ if (msg == null) return new ArgumentNullException(paramName: name);
+ else return new ArgumentNullException(paramName: name, message: msg);
}
//Strings
@@ -45,10 +45,7 @@ namespace Discord
}
private static ArgumentException CreateNotEmptyException(string name, string msg)
- {
- if (msg == null) return new ArgumentException("Argument cannot be blank", name);
- else return new ArgumentException(name, msg);
- }
+ => new ArgumentException(message: msg ?? "Argument cannot be blank.", paramName: name);
//Numerics
public static void NotEqual(sbyte obj, sbyte value, string name, string msg = null) { if (obj == value) throw CreateNotEqualException(name, msg, value); }
@@ -85,11 +82,8 @@ namespace Discord
public static void NotEqual(Optional obj, ulong value, string name, string msg = null) { if (obj.IsSpecified && obj.Value == value) throw CreateNotEqualException(name, msg, value); }
private static ArgumentException CreateNotEqualException(string name, string msg, T value)
- {
- if (msg == null) return new ArgumentException($"Value may not be equal to {value}.", name);
- else return new ArgumentException(msg, name);
- }
-
+ => new ArgumentException(message: msg ?? $"Value may not be equal to {value}", paramName: name);
+
public static void AtLeast(sbyte obj, sbyte value, string name, string msg = null) { if (obj < value) throw CreateAtLeastException(name, msg, value); }
public static void AtLeast(byte obj, byte value, string name, string msg = null) { if (obj < value) throw CreateAtLeastException(name, msg, value); }
public static void AtLeast(short obj, short value, string name, string msg = null) { if (obj < value) throw CreateAtLeastException(name, msg, value); }
@@ -108,10 +102,7 @@ namespace Discord
public static void AtLeast(Optional obj, ulong value, string name, string msg = null) { if (obj.IsSpecified && obj.Value < value) throw CreateAtLeastException(name, msg, value); }
private static ArgumentException CreateAtLeastException(string name, string msg, T value)
- {
- if (msg == null) return new ArgumentException($"Value must be at least {value}.", name);
- else return new ArgumentException(msg, name);
- }
+ => new ArgumentException(message: msg ?? $"Value must be at least {value}", paramName: name);
public static void GreaterThan(sbyte obj, sbyte value, string name, string msg = null) { if (obj <= value) throw CreateGreaterThanException(name, msg, value); }
public static void GreaterThan(byte obj, byte value, string name, string msg = null) { if (obj <= value) throw CreateGreaterThanException(name, msg, value); }
@@ -131,10 +122,7 @@ namespace Discord
public static void GreaterThan(Optional obj, ulong value, string name, string msg = null) { if (obj.IsSpecified && obj.Value <= value) throw CreateGreaterThanException(name, msg, value); }
private static ArgumentException CreateGreaterThanException(string name, string msg, T value)
- {
- if (msg == null) return new ArgumentException($"Value must be greater than {value}.", name);
- else return new ArgumentException(msg, name);
- }
+ => new ArgumentException(message: msg ?? $"Value must be greater than {value}", paramName: name);
public static void AtMost(sbyte obj, sbyte value, string name, string msg = null) { if (obj > value) throw CreateAtMostException(name, msg, value); }
public static void AtMost(byte obj, byte value, string name, string msg = null) { if (obj > value) throw CreateAtMostException(name, msg, value); }
@@ -154,10 +142,7 @@ namespace Discord
public static void AtMost(Optional obj, ulong value, string name, string msg = null) { if (obj.IsSpecified && obj.Value > value) throw CreateAtMostException(name, msg, value); }
private static ArgumentException CreateAtMostException(string name, string msg, T value)
- {
- if (msg == null) return new ArgumentException($"Value must be at most {value}.", name);
- else return new ArgumentException(msg, name);
- }
+ => new ArgumentException(message: msg ?? $"Value must be at most {value}", paramName: name);
public static void LessThan(sbyte obj, sbyte value, string name, string msg = null) { if (obj >= value) throw CreateLessThanException(name, msg, value); }
public static void LessThan(byte obj, byte value, string name, string msg = null) { if (obj >= value) throw CreateLessThanException(name, msg, value); }
@@ -177,10 +162,7 @@ namespace Discord
public static void LessThan(Optional obj, ulong value, string name, string msg = null) { if (obj.IsSpecified && obj.Value >= value) throw CreateLessThanException(name, msg, value); }
private static ArgumentException CreateLessThanException(string name, string msg, T value)
- {
- if (msg == null) return new ArgumentException($"Value must be less than {value}.", name);
- else return new ArgumentException(msg, name);
- }
+ => new ArgumentException(message: msg ?? $"Value must be less than {value}", paramName: name);
// Bulk Delete
/// Messages are younger than 2 weeks.
@@ -200,7 +182,7 @@ namespace Discord
for (var i = 0; i < roles.Length; i++)
{
if (roles[i] == guildId)
- throw new ArgumentException("The everyone role cannot be assigned to a user.", name);
+ throw new ArgumentException(message: "The everyone role cannot be assigned to a user", paramName: name);
}
}
}
diff --git a/src/Discord.Net.Core/Utils/TokenUtils.cs b/src/Discord.Net.Core/Utils/TokenUtils.cs
index 45d769441..bfc915252 100644
--- a/src/Discord.Net.Core/Utils/TokenUtils.cs
+++ b/src/Discord.Net.Core/Utils/TokenUtils.cs
@@ -18,7 +18,7 @@ namespace Discord
{
// A Null or WhiteSpace token of any type is invalid.
if (string.IsNullOrWhiteSpace(token))
- throw new ArgumentNullException(nameof(token), "A token cannot be null, empty, or contain only whitespace.");
+ throw new ArgumentNullException(paramName: nameof(token), message: "A token cannot be null, empty, or contain only whitespace.");
switch (tokenType)
{
@@ -33,11 +33,11 @@ namespace Discord
// this value was determined by referencing examples in the discord documentation, and by comparing with
// pre-existing tokens
if (token.Length < 59)
- throw new ArgumentException("A Bot token must be at least 59 characters in length.", nameof(token));
+ throw new ArgumentException(message: "A Bot token must be at least 59 characters in length.", paramName: nameof(token));
break;
default:
// All unrecognized TokenTypes (including User tokens) are considered to be invalid.
- throw new ArgumentException($"Unrecognized {nameof(token)}.", nameof(token));
+ throw new ArgumentException(message: "Unrecognized TokenType.", paramName: nameof(token));
}
}
diff --git a/src/Discord.Net.Rest/DiscordRestApiClient.cs b/src/Discord.Net.Rest/DiscordRestApiClient.cs
index ed100287a..83803b282 100644
--- a/src/Discord.Net.Rest/DiscordRestApiClient.cs
+++ b/src/Discord.Net.Rest/DiscordRestApiClient.cs
@@ -82,7 +82,7 @@ namespace Discord.API
case TokenType.Bearer:
return $"Bearer {token}";
default:
- throw new ArgumentException("Unknown OAuth token type.", nameof(tokenType));
+ throw new ArgumentException(message: "Unknown OAuth token type", paramName: nameof(tokenType));
}
}
internal virtual void Dispose(bool disposing)
@@ -478,7 +478,7 @@ namespace Discord.API
Preconditions.NotNullOrEmpty(args.Content, nameof(args.Content));
if (args.Content?.Length > DiscordConfig.MaxMessageSize)
- throw new ArgumentOutOfRangeException($"Message content is too long, length must be less or equal to {DiscordConfig.MaxMessageSize}.", nameof(args.Content));
+ throw new ArgumentException(message: $"Message content is too long, length must be less or equal to {DiscordConfig.MaxMessageSize}.", paramName: nameof(args.Content));
options = RequestOptions.CreateOrClone(options);
var ids = new BucketIds(channelId: channelId);
@@ -497,7 +497,7 @@ namespace Discord.API
Preconditions.NotNullOrEmpty(args.Content, nameof(args.Content));
if (args.Content?.Length > DiscordConfig.MaxMessageSize)
- throw new ArgumentOutOfRangeException($"Message content is too long, length must be less or equal to {DiscordConfig.MaxMessageSize}.", nameof(args.Content));
+ throw new ArgumentException(message: $"Message content is too long, length must be less or equal to {DiscordConfig.MaxMessageSize}.", paramName: nameof(args.Content));
options = RequestOptions.CreateOrClone(options);
return await SendJsonAsync("POST", () => $"webhooks/{webhookId}/{AuthToken}?wait=true", args, new BucketIds(), clientBucket: ClientBucketType.SendEdit, options: options).ConfigureAwait(false);
diff --git a/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs b/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs
index f5903c0be..baf02414b 100644
--- a/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs
+++ b/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs
@@ -149,7 +149,7 @@ namespace Discord.Rest
public static async Task CreateTextChannelAsync(IGuild guild, BaseDiscordClient client,
string name, RequestOptions options, Action func = null)
{
- if (name == null) throw new ArgumentNullException(nameof(name));
+ if (name == null) throw new ArgumentNullException(paramName: nameof(name));
var props = new TextChannelProperties();
func?.Invoke(props);
@@ -167,7 +167,7 @@ namespace Discord.Rest
public static async Task CreateVoiceChannelAsync(IGuild guild, BaseDiscordClient client,
string name, RequestOptions options, Action func = null)
{
- if (name == null) throw new ArgumentNullException(nameof(name));
+ if (name == null) throw new ArgumentNullException(paramName: nameof(name));
var props = new VoiceChannelProperties();
func?.Invoke(props);
@@ -185,7 +185,7 @@ namespace Discord.Rest
public static async Task CreateCategoryChannelAsync(IGuild guild, BaseDiscordClient client,
string name, RequestOptions options)
{
- if (name == null) throw new ArgumentNullException(nameof(name));
+ if (name == null) throw new ArgumentNullException(paramName: nameof(name));
var args = new CreateGuildChannelParams(name, ChannelType.Category);
var model = await client.ApiClient.CreateGuildChannelAsync(guild.Id, args, options).ConfigureAwait(false);
@@ -226,7 +226,7 @@ namespace Discord.Rest
public static async Task CreateRoleAsync(IGuild guild, BaseDiscordClient client,
string name, GuildPermissions? permissions, Color? color, bool isHoisted, RequestOptions options)
{
- if (name == null) throw new ArgumentNullException(nameof(name));
+ if (name == null) throw new ArgumentNullException(paramName: nameof(name));
var model = await client.ApiClient.CreateGuildRoleAsync(guild.Id, options).ConfigureAwait(false);
var role = RestRole.Create(client, guild, model);
@@ -362,7 +362,7 @@ namespace Discord.Rest
public static async Task ModifyEmoteAsync(IGuild guild, BaseDiscordClient client, ulong id, Action func,
RequestOptions options)
{
- if (func == null) throw new ArgumentNullException(nameof(func));
+ if (func == null) throw new ArgumentNullException(paramName: nameof(func));
var props = new EmoteProperties();
func(props);