question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nightly 790/791 breaks EventArgs and/or intents

See original GitHub issue

Make sure you familiarize yourself with our contributing guidelines.

Summary

When using the latest nightlies (This bug persists in 790 and 791, which changed intents, afaik), trying to access properties that are known to be null (e.g. XEventArgs.Guild in DMs), the property throws a NullReferenceException.

Details

Using .NET 5, DSharpPlus version 4.0.0-nightly-00791.

Even if you provide the null propagation operator (?.), and not accessing any of the null’s properties, a NRE is still thrown, as seen below. The EventArgs object is not null, yet trying access the Guild property at all throws an exception. Interestingly, in DMs, accessing the channel is fine, yet null(?). Not sure if that’s intentional behavior?

Steps to reproduce

  • Update to 790/791
  • Hook into MessageX'd and access XEventArgs.Guild, but not any of it’s properties
  • Trigger said event on a guild
  • Notice normal flow
  • Trigger event in DMs
  • Observe NRE, even if you don’t access XEventArgs.Guild.Whatever

Notes

I also tested with DiscordIntents.All, to the same effect. This only applies to DMs, and trying to access the Guild property of any Event Args.

Expected behavior / pre-790

Behavior expressed in 790/791

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Emzi0767commented, Feb 6, 2021

And so the tradition of first build being broken is upheld. Smh @Neuheit

This could be related to some experiments removing the DM channel stuff?

0reactions
Neuheitcommented, Feb 6, 2021

Updated ^

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found