Problem
Hi, I'm facing an issue in 5.0.0-nightly-01579 where accessing the Permissions property on the DiscordMember object throws a NullReferenceException.
Exceptions
[20:05:20 ERR] Event handler exception for event READY thrown from System.Threading.Tasks.Task <<Main>$>b__0(DSharpPlus.DiscordClient, DSharpPlus.EventArgs.ReadyEventArgs
) (defined in Program+<>c__DisplayClass0_0)
System.NullReferenceException: Object reference not set to an instance of an object.
at DSharpPlus.Entities.DiscordMember.GetPermissions()
at DSharpPlus.Entities.DiscordMember.get_Permissions()
at Program.<>c__DisplayClass0_0.<<<Main>$>b__0>d.MoveNext() in C:\Users\mcpem\RiderProjects\project\Program.cs:line 31
--- End of stack trace from previous location ---
at DSharpPlus.AsyncEvents.AsyncEvent`2.<>c__DisplayClass7_0.<<InvokeAsync>b__0>d.MoveNext()
Expected Result
It gives me the Permissions object.
Code Samples
Here is nothing special, I loop through the DiscordClient's guilds and want to check the permissions, but it throws the Exception. I've checked that the DiscordMember object (clientMember) is not null, just the Permissions object.
foreach (var guild in client.Guilds.Values)
{
var clientMember = await guild.GetMemberAsync(client.CurrentUser.Id);
Console.WriteLine(clientMember.Permissions); // throws NullReferenceException
}
Specified tag was not found. Here are some suggestions: