microsoft / microsoft/CopilotStudioSamples

System.ArrayTypeMismatchException Error when trying to initialize DirectLineClient

Open
#279 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
797
Forks
491
PR merge metrics
No merged PRs in 30d

Description

Background:
Trying to connect to copilot studio agent using Direct Line.

  1. Fetch the DirectLineToken using the web channel security key. Result is success i.e., able to fetch the token.
  2. URI used to generate the token in step 1 is https://directline.botframework.com/v3/directline/tokens/generate
  3. Use the token from step 1, initialize the var directLineClient = new DirectLineClient(token),
  4. Error is thrown as below: System.ArrayTypeMismatchException: Attempted to access an element as a type incompatible with the array.
    at System.Collections.Generic.List`1.Add(T item)
    at Microsoft.Bot.Connector.DirectLine.DirectLineClient.Initialize()

Expected behavior
Should be able to initialize the Client.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Sample code taken from https://github.com/microsoft/CopilotStudioSamples/blob/master/BotConnectorApp/BotConnectorApp/BotConnectorApp/Program.cs
Package version of Microsoft.Bot.Connector.DirectLine used is 3.0.2 (latest stable version)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the referenced BotConnectorApp/Program.cs sample and the Microsoft.Bot.Connector.DirectLine 3.0.2 package, then reproduce the DirectLineClient(token) initialization using the token-generation URI described in the issue. Trace the reported System.ArrayTypeMismatchException in DirectLineClient.Initialize(); done means the client initializes without that exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.