IMessageActivity som parameter

stemmer
0

Ifølge denne tråden, Hvordan få aktivitet Info fra en IDialogContext jeg endret alle mine metode-hensikter i kode:

Jeg kaller min LuisDialog fra MessagesController på denne måten:

 await Conversation.SendAsync(activity, () => new RootLuisDialog());

og deretter i fremgangsmåten:

    [LuisIntent(test-intent)]
            public async Task help(IDialogContext context, IAwaitable<IMessageActivity> activity  LuisResult result)
            {

 await Conversation.SendAsync(activity  , () => SimpleFacebookAuthDialog.dialog);

    }

Så når jeg kjører dette det kaster et unntak:

{;Ingen}

og stakksporing:

ved Microsoft.Bot.Builder.Dialogs.LuisDialog.d__0.MoveNext () \ r \ n ved System.Linq.Enumerable.ToDictionary [TSource, TKey, TElement] (IEnumerable 1 source, Func2 keySelector, Func- 2 elementSelector, IEqualityComparer1 SAMMENLIGN) \ r \ n ved Microsoft .Bot.Builder.Dialogs.LuisDialog 1.d__6.MoveNext () \ r \ n --- End of stabel spor fra forrige sted hvor unntak oppsto --- \ r \ n i System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (oppgave oppgave) \ r \ n ved System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (oppgave oppgave) \ r \ n ved Microsoft.Bot.Builder.Dialogs.Internals.DialogTask.ThunkResume 2.-PollAsync> d__19.MoveNext () \ r \ n --- End of stabel spor fra forrige sted hvor unntak oppsto --- \ r \ n ved System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (oppgave oppgave) \ r \ n i System.Runtime.CompilerServices. TaskAwaiter.HandleNonSuccessAndDebuggerNotification (oppgave oppgave) \ r \ n ved Microsoft.Bot.Builder.Internals.Fibers.Frame 1.-PollAsync> d__13.MoveNext () \ r \ n --- End of stabel spor fra foregående sted hvor e xception ble kastet --- \ r \ n i System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () \ r \ n ved Microsoft.Bot.Builder.Internals.Fibers.Wait 1.d__3.MoveNext () \ r \ n- - Slutt på stakk spor fra forrige sted hvor unntak oppsto --- \ r \ n ved System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (oppgave oppgave) \ r \ n ved System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (oppgave oppgaven) \ r \ n ved Microsoft.Bot.Builder.Dialogs.Internals.DialogTask.ThunkResume 2.-PollAsync> d__19.MoveNext () \ r \ n --- End of stabel spor fra forrige sted hvor unntak oppsto - - \ r \ n ved System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (oppgave oppgave) \ r \ n ved System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (oppgave oppgave) \ r \ n i Microsoft.Bot.Builder.Internals. Fibers.Frame 1.-PollAsync> d__13.MoveNext () \ r \ n --- End of stabel spor fra forrige sted hvor unntak oppsto --- \ r \ n i System.Runtime.CompilerServices.TaskAwait er.ThrowForNonSuccess (Oppgave oppgave) \ r \ n ved System.Runtime.CompilerServic es.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (Oppgave oppgave) \ r \ n ved Microsoft.Bot.Builder.Dialogs.Internals.DialogTask.d__21 1.MoveNext () \ r \ n --- End of stabel spor fra forrige sted hvor unntak oppsto --- \ r \ n ved System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (oppgave oppgave) \ r \ n i System.Runtime.CompilerServices.TaskAwaiter .HandleNonSuccessAndDebuggerNotification (oppgave oppgave) \ r \ n ved Microsoft.Bot.Builder.Dialogs.Internals.LocalizedDialogTask.d__2 1.d__6 1.MoveNext () \ r \ n --- End of stabel spor fra forrige sted hvor unntak oppsto --- \ r \ n i Microsoft.Bot.Builder.Dialogs.Internals.PersistentDialogTask.d__6`1.MoveNext () \ r \ n --- End of stabel spor fra forrige sted hvor unntak oppsto --- \ r \ n ved System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (oppgave oppgave) \ r \ n ved System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (oppgave oppgave) \ r \ n ved Microsoft.Bot.Builder.Dialogs.Conversation.d__4.MoveNext () \ r \ n --- End of stabel spor fra forrige sted hvor unntak oppsto --- \ r \ n i System.Runtime.CompilerServices.TaskAwaiter. ThrowForNonSuccess (oppgave oppgave) \ r \ n ved System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (oppgave oppgave) \ r \ n i Microsoft.Bot.Builder.Dialogs.Conversation.d__2.MoveNext () \ r \ n --- slutten av stabelen spor fra forrige sted hvor unntak oppsto --- \ r \ n ved System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (oppgave oppgave) \ r \ n ved System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (oppgave oppgave) \ r \ n i system .Runtime.CompilerServices.TaskAwaiter.GetResult () \ r \ n i MessengerBot.MessagesController.d__1.MoveNext () i C: \ app \ Controllers \ MessagesController.cs: linje 521.GetHandlersByIntent()\r\n
at Microsoft.Bot.Builder.Dialogs.LuisDialog
1.<Rest>d__4.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification( Task task)\r\n at Microsoft.Bot.Builder.Internals.Fibers.Wait1.<Microsoft-Bot-Builder-Internals-Fibers-IFrameLoop<C>-PollAsync>d__7.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Internals.Fibers.Fiber
2.Microsoft.Bot.Builder.Internals.Fibers.IAwaiter<T>.GetResult()\r\n at Microsoft.Bot.Builder.Dialogs.Chain.LoopDialog1.<Rest>d__4.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Internals.Fibers.Wait1.<Microsoft-Bot-Builder-Internals-Fibers-IFrameLoop<C>-PollAsync>d__7.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Internals.Fibers.Fiber1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.ReactiveDialogTask.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__5 1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.ScoringDialogTask1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.PersistentDialogTask.<Microsoft-Bot-Builder-Dialogs-Internals-IPostToBot-PostAsync>d__6

Publisert på 24/01/2017 klokken 12:13
kilden bruker
På andre språk...                            


2 svar

stemmer
1

Du trenger å "vente" for IAwaitable<IMessageActivity>parameteren:

[LuisIntent("test-intent")]
public async Task help(IDialogContext context, IAwaitable<IMessageActivity> argument, LuisResult result)
{
    var activity = await argument;
    await Conversation.SendAsync(activity, () => SimpleFacebookAuthDialog.dialog);
}
Svarte 24/01/2017 kl. 12:28
kilden bruker

stemmer
0

Alt du trenger å gjøre er å oppgradere din gamle bot til den nyeste versjonen. Gjør som vil gi deg context.Activity. Lag din egen valg.

Svarte 24/01/2017 kl. 13:18
kilden bruker

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more