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.

NullReferenceException when using InteractivityExtension.WaitForEventArgsAsync<T>(Func<T, bool> predicate)

See original GitHub issue

Hello, these errors are occurring every time a user interacts with components “catched” by a InteractivityExtension.WaitForEventArgsAsync<T>(Func<T, bool> predicate):

[2021-10-17 02:02:12 -03:00] [104 /EventHandler] [Error] Event handler exception for event COMPONENT_INTERACTED thrown from System.Threading.Tasks.Task HandleEvent(DSharpPlus.DiscordClient, DSharpPlus.EventArgs.ComponentInteractionCreateEventArgs) (defined in DSharpPlus.Interactivity.EventHandling.EventWaiter`1[DSharpPlus.EventArgs.ComponentInteractionCreateEventArgs])
System.NullReferenceException: Object reference not set to an instance of an object.
   at DSharpPlus.Interactivity.EventHandling.EventWaiter`1.HandleEvent(DiscordClient client, T eventargs)
   at Emzi0767.Utilities.AsyncEvent`2.InvokeAsync(TSender sender, TArgs e, AsyncEventExceptionMode exceptionMode)
[2021-10-17 02:02:12 -03:00] [42  /HossamBot   ] [Error] Exception occured
System.NullReferenceException: Object reference not set to an instance of an object.
   at DSharpPlus.Interactivity.EventHandling.EventWaiter`1.HandleEvent(DiscordClient client, T eventargs)
   at Emzi0767.Utilities.AsyncEvent`2.InvokeAsync(TSender sender, TArgs e, AsyncEventExceptionMode exceptionMode)

I’m using the ComponentInteractionCreateEventArgs for the parameters T and p => p?.Message?.Id == msgId for the predicate.

The args is returned fine, but the log screen has a lot of these errors.

v4.1.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
DWafflescommented, Apr 10, 2022

Just tried to reproduce this using the following code with no success (no errors on my side), does it still happen in the latest nightly version?

I believe this was fixed in #1230.

0reactions
akiraveliaracommented, May 2, 2022

That’s a bit outdated (we’re at 4.3.0 nightlies now) but I don’t think there has been any change to it. I’ll look into it at some point

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Invoking a predicate throws NullReferenceException
I can't find a property to check against the nullity of the current provider, whether on the Func<T,bool> or the Expression<Func<Media,T>> . Do ......
Read more >
C# Task - LazyAsyncResult - NullReferenceException
You are using async/await so when something goes wrong inside the auto-generated code to support this the debugger throws you into the framework ......
Read more >
[Solved] Calling public boolean function with return leads ...
I call a public bool function from a script. private ... Calling public boolean function with return leads to NullReferenceException.
Read more >

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