You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Bot Framework V4调用Skill时uriString空值异常排查求助

Value cannot be null (Parameter 'uriString') when Calling a Composer-Integrated Skill in Bot Framework

I've been working through the Bot Framework Integrate Composer Into Skill Project tutorial to integrate Composer dialogs into a Skill project, including calling a Skill dialog built with Composer. Everything was going smoothly until I hit a roadblock: when triggering the Skill call, I get the error:

"Value cannot be null. (Parameter 'uriString')"

Reproduction Steps

  • Switch to the skill-setting-issue branch of the repository, and install Bot Emulator.
  • Open Integrate-Composer-Dialog-Using-Skill.sln in Visual Studio, set a breakpoint at line 79 of DefaultAdapter.cs.
  • Start debugging, connect to http://localhost:3978/api/messages via Bot Emulator.
  • Type "Greeting"—the Bot returns the expected response, confirming the Composer dialog integration works fine.
  • Type "Skill"—the breakpoint hits, and the above error is thrown.

Root Cause Analysis

The error fires at line 156 of BeginDialogAsync in Microsoft.Bot.Builder.Dialogs.Adaptive.BeginSkill, when populating DialogOptions.SkillHostEndpoint. After digging into the code, I suspect the configuration values in lines 52-57 of Composer-With-Skill.dialog (like "skillHostEndpoint": "=settings.skillHostEndpoint") aren't being resolved from ComposerDialogs\settings\appsettings.json. If I hardcode the actual values instead of using the settings reference, the Skill call works perfectly (as seen in the master branch).

I did add the Composer settings file in line 51 of Startup.cs as per the tutorial, but the configuration doesn't seem to be taking effect.

Troubleshooting Attempts

  • Adding skillHostEndpoint directly to the main appsettings.json works, but this isn't the desired setup per the tutorial.
  • Moving the Composer settings file to different locations, renaming it, and updating Startup.cs accordingly didn't fix the issue.
  • Removing the configuration from the main appsettings.json didn't change anything—BeginSkill.cs still couldn't access the values, confirming the Startup.cs config setup isn't working.

Solutions to Fix the Configuration Resolution

Here are the steps I found to resolve this issue:

  1. Verify Configuration Loading Logic in Startup.cs
    Make sure the Composer settings file is added to the configuration builder in the correct order (after the main appsettings, so it doesn't get overridden). Your code should look something like this:
var builder = new ConfigurationBuilder()
    .SetBasePath(env.ContentRootPath)
    .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
    .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
    // Load Composer's settings file
    .AddJsonFile("ComposerDialogs/settings/appsettings.json", optional: true, reloadOnChange: true)
    .AddEnvironmentVariables();
Configuration = builder.Build();

Double-check the file path matches where your Composer settings are stored.

  1. Confirm the Settings File is Copied to Output
    Right-click ComposerDialogs/settings/appsettings.json in Visual Studio, go to Properties, and set Copy to Output Directory to Copy if newer or Copy always. This ensures the file is available in the debug folder when the app runs.

  2. Validate Configuration is Loaded
    Add a quick debug check in Startup.cs after building the configuration to confirm the value is being pulled in:

var skillHostEndpoint = Configuration["skillHostEndpoint"];
Console.WriteLine($"Loaded skillHostEndpoint: {skillHostEndpoint}");

If this outputs null, your file path is incorrect or the file isn't being copied correctly.

  1. Check Adaptive Dialog Expression Syntax
    Ensure the expression in Composer-With-Skill.dialog matches how your configuration is structured. If your appsettings.json has a nested settings object like:
{
  "settings": {
    "skillHostEndpoint": "http://your-endpoint"
  }
}

Then the expression should be "=settings.skillHostEndpoint". If the value is at the root level of the config file, use "=skillHostEndpoint" instead. Some Bot Framework versions also use configuration as the prefix, so you can try "=configuration.skillHostEndpoint" if needed.

  1. Ensure Dialog Manager Has Access to Configuration
    When initializing your DialogManager or AdaptiveDialog, make sure the configuration is passed into the dialog context. For example, you can bind the configuration to the dialog's state so the adaptive expressions can resolve the settings variables correctly.

Final Notes

This issue boils down to the Composer settings file not being properly loaded into the Bot Framework's configuration system, so the adaptive dialog can't resolve the settings references. By fixing the configuration loading logic and verifying the file is accessible, you should be able to resolve the uriString null error.

内容的提问来源于stack exchange,提问作者alexabru

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.11 08:23:50