matt-github-acct/dotnetcore-slackbot

Problem with OnMessage event

Opened this issue · 1 comments

After some seconds, the following exception is throwed:

System.ArgumentNullException: Value cannot be null.
Parameter name: uriString
   at Slackbot.SocketConnection.TryConnect()
   at Slackbot.SocketConnection.Connect()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__7_1(Object state)
   at System.Threading.QueueUserWorkItemCallback.<>c.<.cctor>b__6_0(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.QueueUserWorkItemCallback.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

The current code is the same of the example:

 var bot = new Bot(name, token);

            bot.OnMessage += (sender, message) =>
            {
                if (message.MentionedUsers.Any(m => m == name))
                    bot.SendMessage(message.Channel, $"Hi {message.User}, thanks for mentioning my name!");
            };

I running it on .NET Core 2.1 (04e15494b6), the Slackbot library version is 1.4.1.

Hey @TheNullable ! Thanks for the issue, and sorry for my delayed response.

Have you explored any fixes at all? I'm going to try to get some time to look at this, but it might be a few days (I'm sure you know how that goes).