Skip to content

Fix ArgumentNullException in EchoBot when joining via short Teams meeting URL#859

Draft
Copilot wants to merge 2 commits intosasthana/fix-short-teams-url-parsingfrom
copilot/sub-pr-858
Draft

Fix ArgumentNullException in EchoBot when joining via short Teams meeting URL#859
Copilot wants to merge 2 commits intosasthana/fix-short-teams-url-parsingfrom
copilot/sub-pr-858

Conversation

Copy link

Copilot AI commented Feb 25, 2026

JoinInfo.ParseJoinURL returns an empty ChatInfo (null ThreadId) for short URLs (https://teams.microsoft.com/meet/<id>?p=<passcode>). BotService used ChatInfo.ThreadId directly as a ConcurrentDictionary key, throwing ArgumentNullException on every short URL join attempt.

Changes — BotService.cs

  • JoinCallAsync: Guard duplicate-call check against null ThreadId; short URL joins skip the pre-join check and proceed directly to AddAsync
  • CallsOnUpdated: Use call.Resource.ChatInfo?.ThreadId ?? call.Id as the tracking key so handlers are always stored/removed with a valid non-null key
// Before — throws ArgumentNullException when ThreadId is null
if (!this.CallHandlers.TryGetValue(joinParams.ChatInfo.ThreadId, out CallHandler? call))

// After — safe for short URL joins where ThreadId is unknown pre-join
var threadId = joinParams.ChatInfo.ThreadId;
if (!string.IsNullOrEmpty(threadId) && this.CallHandlers.TryGetValue(threadId, out CallHandler? _))
{
    throw new Exception("Call has already been added");
}

// CallsOnUpdated — fall back to call.Id when ChatInfo.ThreadId is absent
var threadId = call.Resource.ChatInfo?.ThreadId ?? call.Id;

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…vice

For short Teams meeting URLs, JoinInfo.ParseJoinURL returns an empty
ChatInfo with a null ThreadId. This caused an ArgumentNullException in
JoinCallAsync (used as ConcurrentDictionary key) and potential
NullReferenceExceptions in CallsOnUpdated.

Changes to BotService.cs:
- JoinCallAsync: only perform duplicate-call check when ThreadId is
  non-null/empty; short URL joins proceed directly to AddAsync
- CallsOnUpdated: use null-conditional ChatInfo access and fall back to
  call.Id when ThreadId is absent, ensuring handlers are always stored
  and removed with a valid non-null key

Co-authored-by: samarthasthana <3836631+samarthasthana@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for short Teams meeting URLs Fix ArgumentNullException in EchoBot when joining via short Teams meeting URL Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants