0

更新 Microsoft botbuilder 和 botbuilder-dialog 版本 4.11.0 后,我遇到了错误。它适用于早期版本。

更新到版本 4.11.0 后遇到以下错误

{ TypeError: Cannot read property 'trackTrace' of undefined
  at Object.<anonymous> (/Users/ashokmanseta/Projects/botbuilder-adapter/node_modules/botbuilder-dialogs/src/dialogContainer.ts:49:40)
  at Generator.next (<anonymous>)
  at fulfilled (/Users/ashokmanseta/Projects/botbuilder-adapter/node_modules/botbuilder-dialogs/lib/dialogContainer.js:4:58)
  at process._tickCallback (internal/process/next_tick.js:68:7)
name: 'DialogContextError',
dialogContext:
 { activeDialog: 'dialog-0.2220127757',
   parent: undefined,
   stack: [ [Object] ] } }

如果有任何解决方法,请提供帮助。

4

1 回答 1

0

实际上,代码在为 dialogContainer 中的对话框检查遥测客户端时死掉了

dc.dialogs.telemetryClient.trackTrace({
message: traceMessage,
severityLevel: botbuilder_core_1.Severity.Warning,
});

添加可以是 NullTelemetryClient 的遥测客户端

检查您在主对话框上创建 dialogContext 的位置,

//Example
const dialogContext = await dialogSet.createContext(context);

把这条线放在那里

import { NullTelemetryClient } from "botbuilder";
dialogContext.dialogs.telemetryClient=new NullTelemetryClient()
于 2021-09-10T13:58:59.430 回答