Title: DiscordGuild.GetRoleAsync throws NullReferenceException if called on a guild the bot is in before GuildDownloadCompleted has fired · Issue #2372 · DSharpPlus/DSharpPlus · GitHub
Open Graph Title: DiscordGuild.GetRoleAsync throws NullReferenceException if called on a guild the bot is in before GuildDownloadCompleted has fired · Issue #2372 · DSharpPlus/DSharpPlus
X Title: DiscordGuild.GetRoleAsync throws NullReferenceException if called on a guild the bot is in before GuildDownloadCompleted has fired · Issue #2372 · DSharpPlus/DSharpPlus
Description: Summary Opening an issue as per @Plerx2493 's request on the discord. Under some circumstances role related properties & methods on DiscordGuild can throw due to the "Roles" property being null if accessed before GuildDownloadCompleted f...
Open Graph Description: Summary Opening an issue as per @Plerx2493 's request on the discord. Under some circumstances role related properties & methods on DiscordGuild can throw due to the "Roles" property being null if ...
X Description: Summary Opening an issue as per @Plerx2493 's request on the discord. Under some circumstances role related properties & methods on DiscordGuild can throw due to the "Roles" prope...
Opengraph URL: https://github.com/DSharpPlus/DSharpPlus/issues/2372
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"DiscordGuild.GetRoleAsync throws NullReferenceException if called on a guild the bot is in before GuildDownloadCompleted has fired","articleBody":"### Summary\n\nOpening an issue as per @Plerx2493 's request on the discord. Under some circumstances role related properties \u0026 methods on DiscordGuild can throw due to the \"Roles\" property being null if accessed before GuildDownloadCompleted fires\n\n### What version of the library are you using?\n\nv5.0.0-nightly (make sure you are using the latest nightly!)\n\n### What .NET version are you using? Make sure to use the latest patch release for your major version.\n\n.NET 9.0\n\n### Operating System\n\nWindows 11\n\n### Reproduction Steps\n\n1. Run a bot that is a member of at least one guild\n2. After connecting, immediately call DiscordClient.GetGuildAsync()\n3. On one of the returned guilds, call DiscordGuild.GetRoleAsync passing the guild id or access DiscordGuild.EveryoneRole\n4. NullReferenceException will be thrown\n\n### Trace Logs\n\n```log\n\n```\n\n### Exceptions or other error messages\n\n```txt\n\n```\n\n### Anything else you'd like to share\n\n_No response_","author":{"url":"https://github.com/Autoquark","@type":"Person","name":"Autoquark"},"datePublished":"2025-09-05T09:27:46.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/2372/DSharpPlus/issues/2372"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8fd32c48-5727-aa42-2348-8a3540833e73 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A41C:B8C14:B344F3:E91C7C:698D6B75 |
| html-safe-nonce | 1a603b415c50c8d861b677c5f1101ea1f720bfec05da1442a9df1c3e241758b4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNDFDOkI4QzE0OkIzNDRGMzpFOTFDN0M6Njk4RDZCNzUiLCJ2aXNpdG9yX2lkIjoiMTUxNjgzODU0MjMwMTg2ODY5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 73260aa9be14a5a6490360311df366405c234b621e869ee54ba39fe1d4d83613 |
| hovercard-subject-tag | issue:3386890899 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/DSharpPlus/DSharpPlus/2372/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5850f23ef4a5937cfd13499fb11fee83089a497398fbb930d329dc7c3ccd3918/DSharpPlus/DSharpPlus/issues/2372 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5850f23ef4a5937cfd13499fb11fee83089a497398fbb930d329dc7c3ccd3918/DSharpPlus/DSharpPlus/issues/2372 |
| og:image:alt | Summary Opening an issue as per @Plerx2493 's request on the discord. Under some circumstances role related properties & methods on DiscordGuild can throw due to the "Roles" property being null if ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Autoquark |
| hostname | github.com |
| expected-hostname | github.com |
| None | c0818105fa276287e9369cfdefa0a0fa7953719791ceff9b94d69623c0a4fe8a |
| turbo-cache-control | no-preview |
| go-import | github.com/DSharpPlus/DSharpPlus git https://github.com/DSharpPlus/DSharpPlus.git |
| octolytics-dimension-user_id | 36208721 |
| octolytics-dimension-user_login | DSharpPlus |
| octolytics-dimension-repository_id | 67243489 |
| octolytics-dimension-repository_nwo | DSharpPlus/DSharpPlus |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 67243489 |
| octolytics-dimension-repository_network_root_nwo | DSharpPlus/DSharpPlus |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 715890fa442134f528fb422ab338c0ad55c7a025 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width