microsoft / botframework-solutions

Welcome to the Bot Framework Solutions repository which is the home for a set of templates and solutions to help build advanced conversational experiences using Azure Bot Service and Bot Framework. Microsoft Bot Framework is a comprehensive framework for building enterprise-grade conversational AI experiences.
https://aka.ms/bfsolutionsdocs
MIT License
1.05k stars 528 forks source link

QnA Telemetry Exception - Duplicate Key - question #1358

Closed mekinney closed 5 years ago

mekinney commented 5 years ago

Project

Virtual Assistant:

Language: C#

Description

Qna Telemetry Exception - Duplicate Key: question

To Reproduce

Build VirtualAssistantSample Run Sample Type in "What is special education" or "How do I tie my shoes" or "why do I care?"

I'm guessing it's related to a code change that updates the QnA properties so the "question" property is rational with the Luis "question" property. I can't find the discussion we had, but the net is that the "question" property in luis is the text that that the user typed in. In QnA it's documented as the matched questions. This has been changed in the code so that the QnA question property is what the user has typed in and the matchedQuestion property contains the question matched. This update makes analytics much easier, so please don't undo it. :)

Telemetry properties documentation: https://github.com/microsoft/AI/blob/master/docs/reference/analytics/telemetrylogging.md

Actually telemetry provided (please don't change this...): Capture

Expected behavior

No exception is thrown.

Additional context

Exception details:


{
  "name": "Microsoft.ApplicationInsights…..Exception",
  "time": "2019-05-14T14:38:14.1950403Z",
  "iKey": "e1c458b5-ed3f-4799-91e1-f84f00d99907",
  "tags": {
    "ai.cloud.roleInstance": "...",
    "ai.internal.sdkVersion": "dotnet:2.8.1-22898"
  },
  "data": {
    "baseType": "ExceptionData",
    "baseData": {
      "ver": 2,
      "exceptions": [
        {
          "id": 17834703,
          "outerId": 0,
          "typeName": "System.ArgumentException",
          "message": "An item with the same key has already been added. Key: question",
          "hasFullStack": true,
          "parsedStack": [
            {
              "level": 0,
              "method": "System.ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 1,
              "method": "System.Collections.Generic.Dictionary`2.TryInsert",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 2,
              "method": "Microsoft.Bot.Builder.AI.QnA.QnAMaker.FillQnAEventAsync",
              "assembly": "Microsoft.Bot.Builder.AI.QnA, Version=4.4.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
              "fileName": "d:\\a\\1\\s\\libraries\\Microsoft.Bot.Builder.AI.QnA\\QnAMaker.cs",
              "line": 256
            },
            {
              "level": 3,
              "method": "Microsoft.Bot.Builder.AI.QnA.QnAMaker+<OnQnaResultsAsync>d__22.MoveNext",
              "assembly": "Microsoft.Bot.Builder.AI.QnA, Version=4.4.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
              "fileName": "d:\\a\\1\\s\\libraries\\Microsoft.Bot.Builder.AI.QnA\\QnAMaker.cs",
              "line": 202
            },
            {
              "level": 4,
              "method": "System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 5,
              "method": "System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 6,
              "method": "Microsoft.Bot.Builder.AI.QnA.QnAMaker+<GetAnswersAsync>d__21.MoveNext",
              "assembly": "Microsoft.Bot.Builder.AI.QnA, Version=4.4.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
              "fileName": "d:\\a\\1\\s\\libraries\\Microsoft.Bot.Builder.AI.QnA\\QnAMaker.cs",
              "line": 192
            },
            {
              "level": 7,
              "method": "System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 8,
              "method": "System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 9,
              "method": "System.Runtime.CompilerServices.TaskAwaiter`1.GetResult",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 10,
              "method": "VirtualAssistantSample.Dialogs.MainDialog+<RouteAsync>d__6.MoveNext",
              "assembly": "VirtualAssistantSample, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
              "fileName": "C:\\Code\\VirtualAssistantSample\\Sample\\VirtualAssistantSample\\Dialogs\\MainDialog.cs",
              "line": 166
            },
            {
              "level": 11,
              "method": "System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 12,
              "method": "System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 13,
              "method": "Microsoft.Bot.Builder.Solutions.Dialogs.RouterDialog+<OnContinueDialogAsync>d__2.MoveNext",
              "assembly": "Microsoft.Bot.Builder.Solutions, Version=4.4.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
              "line": 0
            },
            {
              "level": 14,
              "method": "System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 15,
              "method": "System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 16,
              "method": "Microsoft.Bot.Builder.Dialogs.ComponentDialog+<ContinueDialogAsync>d__11.MoveNext",
              "assembly": "Microsoft.Bot.Builder.Dialogs, Version=4.4.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
              "fileName": "d:\\a\\1\\s\\libraries\\Microsoft.Bot.Builder.Dialogs\\ComponentDialog.cs",
              "line": 86
            },
            {
              "level": 17,
              "method": "System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 18,
              "method": "System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 19,
              "method": "Microsoft.Bot.Builder.Dialogs.DialogContext+<ContinueDialogAsync>d__21.MoveNext",
              "assembly": "Microsoft.Bot.Builder.Dialogs, Version=4.4.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
              "fileName": "d:\\a\\1\\s\\libraries\\Microsoft.Bot.Builder.Dialogs\\DialogContext.cs",
              "line": 160
            },
            {
              "level": 20,
              "method": "System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 21,
              "method": "System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 22,
              "method": "System.Runtime.CompilerServices.TaskAwaiter`1.GetResult",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 23,
              "method": "VirtualAssistantSample.Bots.DialogBot`1+<OnTurnAsync>d__3.MoveNext",
              "assembly": "VirtualAssistantSample, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
              "fileName": "C:\\Code\\VirtualAssistantSample\\Sample\\VirtualAssistantSample\\Bots\\DialogBot.cs",
              "line": 43
            },
            {
              "level": 24,
              "method": "System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 25,
              "method": "System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 26,
              "method": "Microsoft.Bot.Builder.AutoSaveStateMiddleware+<OnTurnAsync>d__7.MoveNext",
              "assembly": "Microsoft.Bot.Builder, Version=4.4.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
              "fileName": "d:\\a\\1\\s\\libraries\\Microsoft.Bot.Builder\\AutoSaveStateMiddleware.cs",
              "line": 60
            },
            {
              "level": 27,
              "method": "System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 28,
              "method": "System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 29,
              "method": "Microsoft.Bot.Builder.Solutions.Middleware.EventDebuggerMiddleware+<OnTurnAsync>d__0.MoveNext",
              "assembly": "Microsoft.Bot.Builder.Solutions, Version=4.4.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
              "line": 0
            },
            {
              "level": 30,
              "method": "System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 31,
              "method": "System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 32,
              "method": "Microsoft.Bot.Builder.Solutions.Middleware.SetLocaleMiddleware+<OnTurnAsync>d__2.MoveNext",
              "assembly": "Microsoft.Bot.Builder.Solutions, Version=4.4.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
              "line": 0
            },
            {
              "level": 33,
              "method": "System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 34,
              "method": "System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 35,
              "method": "Microsoft.Bot.Builder.ShowTypingMiddleware+<OnTurnAsync>d__3.MoveNext",
              "assembly": "Microsoft.Bot.Builder, Version=4.4.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
              "fileName": "d:\\a\\1\\s\\libraries\\Microsoft.Bot.Builder\\ShowTypingMiddleware.cs",
              "line": 71
            },
            {
              "level": 36,
              "method": "System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 37,
              "method": "System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 38,
              "method": "Microsoft.Bot.Builder.TelemetryLoggerMiddleware+<OnTurnAsync>d__7.MoveNext",
              "assembly": "Microsoft.Bot.Builder, Version=4.4.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
              "fileName": "d:\\a\\1\\s\\libraries\\Microsoft.Bot.Builder\\TelemetryLoggerMiddleware.cs",
              "line": 109
            },
            {
              "level": 39,
              "method": "System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 40,
              "method": "System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 41,
              "method": "Microsoft.Bot.Builder.TranscriptLoggerMiddleware+<OnTurnAsync>d__3.MoveNext",
              "assembly": "Microsoft.Bot.Builder, Version=4.4.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
              "fileName": "d:\\a\\1\\s\\libraries\\Microsoft.Bot.Builder\\TranscriptLoggerMiddleware.cs",
              "line": 108
            },
            {
              "level": 42,
              "method": "System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 43,
              "method": "System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 44,
              "method": "Microsoft.Bot.Builder.BotFrameworkAdapter+TenantIdWorkaroundForTeamsMiddleware+<OnTurnAsync>d__0.MoveNext",
              "assembly": "Microsoft.Bot.Builder, Version=4.4.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
              "fileName": "d:\\a\\1\\s\\libraries\\Microsoft.Bot.Builder\\BotFrameworkAdapter.cs",
              "line": 964
            },
            {
              "level": 45,
              "method": "System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 46,
              "method": "System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 47,
              "method": "Microsoft.Bot.Builder.MiddlewareSet+<ReceiveActivityWithStatusAsync>d__3.MoveNext",
              "assembly": "Microsoft.Bot.Builder, Version=4.4.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
              "fileName": "d:\\a\\1\\s\\libraries\\Microsoft.Bot.Builder\\MiddlewareSet.cs",
              "line": 55
            },
            {
              "level": 48,
              "method": "System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 49,
              "method": "System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification",
              "assembly": "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
              "line": 0
            },
            {
              "level": 50,
              "method": "Microsoft.Bot.Builder.BotAdapter+<RunPipelineAsync>d__13.MoveNext",
              "assembly": "Microsoft.Bot.Builder,Version=4.4.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
              "fileName": "d:\\a\\1\\s\\libraries\\Microsoft.Bot.Builder\\BotAdapter.cs",
              "line": 167
            }
          ]
        }
      ]
    }
  }
}
'''
mekinney commented 5 years ago

Found the problem and created a pull request for it. https://github.com/microsoft/botbuilder-dotnet/pull/1899

darrenj commented 5 years ago

Thanks @mekinney :-)