matt-github-acct/dotnetcore-slackbot

NullReferenceExceptions on background thread?

Closed this issue · 6 comments

Hi, I'm running your bot in LinqPad, but am getting an NRE when it hears a message. I think the error is on a background thread, which LinqPad is catching automatically, but it might cause issies on other hosts.

image

The bot still seems to work, but it's maybe only because LinqPad catches the error safely

PS your bot is awesome I've got lots of people at work using it on a hackday :)

@mcintyre321 I'm glad that the bot is being useful! I have a guess on what this error might be, but not positive. Would you be willing to share the code you have in LINQPad?

I think it was the code which parses the message text for mentions. Some messages (maybe likes etc.? have null text values)

@mcintyre321 thank you for finding this one. I think I got it fixed. I was able to replicate the issue by sending a message and then editing it. Checked in the fix with commit b0408b2

Would you be willing to verify that it works on your end as well?

Getting another error with the latest version from Nuget
image

Well, crap! I'll get a fix on, thank you for finding this.

@mcintyre321 I don't have the premium edition of LinqPad, so this was a bit difficult to reproduce. I did get it to occur on my end, though. Version 1.2.3 of Slackbot has the fixes that worked for me.

The fix is a bit of a stopgap, I'm working on a broader solution now. I'd love to hear whether or not it works on your end.