diff --git a/libraries/AdaptiveExpressions/AdaptiveExpressions.csproj b/libraries/AdaptiveExpressions/AdaptiveExpressions.csproj
index cb8c07f9f2..b937cae08e 100644
--- a/libraries/AdaptiveExpressions/AdaptiveExpressions.csproj
+++ b/libraries/AdaptiveExpressions/AdaptiveExpressions.csproj
@@ -34,6 +34,7 @@
+
all
runtime; build; native; contentfiles; analyzers
diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/DeleteProperties.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/DeleteProperties.cs
index dcf63f656e..e0ddd4ff25 100644
--- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/DeleteProperties.cs
+++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/DeleteProperties.cs
@@ -71,7 +71,7 @@ public DeleteProperties([CallerFilePath] string callerPath = "", [CallerLineNumb
}
}
- return await dc.EndDialogAsync();
+ return await dc.EndDialogAsync(cancellationToken).ConfigureAwait(false);
}
}
}
diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/DeleteProperty.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/DeleteProperty.cs
index d54de2f6bf..21c6ab4230 100644
--- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/DeleteProperty.cs
+++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/DeleteProperty.cs
@@ -72,7 +72,7 @@ public DeleteProperty(string property, [CallerFilePath] string callerPath = "",
}
dc.State.RemoveValue(Property.GetValue(dc.State));
- return await dc.EndDialogAsync();
+ return await dc.EndDialogAsync().ConfigureAwait(false);
}
}
}
diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/EditArray.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/EditArray.cs
index b250c681bc..3707abd4ef 100644
--- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/EditArray.cs
+++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/EditArray.cs
@@ -231,7 +231,7 @@ public enum ArrayChangeType
dc.State.SetValue(this.ResultProperty.GetValue(dc.State), result);
}
- return await dc.EndDialogAsync(result);
+ return await dc.EndDialogAsync(result).ConfigureAwait(false);
}
protected override string OnComputeId()
diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/HttpRequest.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/HttpRequest.cs
index 2ee019be29..f11cfc3c39 100644
--- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/HttpRequest.cs
+++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/HttpRequest.cs
@@ -217,7 +217,7 @@ public enum HttpMethod
// Bind each string token to the data in state
if (instanceBody != null)
{
- await ReplaceJTokenRecursively(dc, instanceBody);
+ await ReplaceJTokenRecursivelyAsync(dc, instanceBody, cancellationToken).ConfigureAwait(false);
}
// Set headers
@@ -243,14 +243,14 @@ public enum HttpMethod
case HttpMethod.POST:
if (instanceBody == null)
{
- response = await client.PostAsync(instanceUrl, null);
+ response = await client.PostAsync(instanceUrl, content: null, cancellationToken: cancellationToken).ConfigureAwait(false);
}
else
{
var postContent = new StringContent(instanceBody.ToString(), Encoding.UTF8, contentType);
traceInfo.request.content = instanceBody.ToString();
traceInfo.request.headers = JObject.FromObject(postContent?.Headers.ToDictionary(t => t.Key, t => (object)t.Value?.FirstOrDefault()));
- response = await client.PostAsync(instanceUrl, postContent);
+ response = await client.PostAsync(instanceUrl, postContent, cancellationToken).ConfigureAwait(false);
}
break;
@@ -259,7 +259,7 @@ public enum HttpMethod
if (instanceBody == null)
{
var request = new HttpRequestMessage(new System.Net.Http.HttpMethod("PATCH"), instanceUrl);
- response = await client.SendAsync(request);
+ response = await client.SendAsync(request, cancellationToken).ConfigureAwait(false);
}
else
{
@@ -267,7 +267,7 @@ public enum HttpMethod
request.Content = new StringContent(instanceBody.ToString(), Encoding.UTF8, contentType);
traceInfo.request.content = instanceBody.ToString();
traceInfo.request.headers = JObject.FromObject(request.Content.Headers.ToDictionary(t => t.Key, t => (object)t.Value?.FirstOrDefault()));
- response = await client.SendAsync(request);
+ response = await client.SendAsync(request, cancellationToken).ConfigureAwait(false);
}
break;
@@ -275,24 +275,24 @@ public enum HttpMethod
case HttpMethod.PUT:
if (instanceBody == null)
{
- response = await client.PutAsync(instanceUrl, null);
+ response = await client.PutAsync(instanceUrl, content: null, cancellationToken: cancellationToken).ConfigureAwait(false);
}
else
{
var putContent = new StringContent(instanceBody.ToString(), Encoding.UTF8, contentType);
traceInfo.request.content = instanceBody.ToString();
traceInfo.request.headers = JObject.FromObject(putContent.Headers.ToDictionary(t => t.Key, t => (object)t.Value?.FirstOrDefault()));
- response = await client.PutAsync(instanceUrl, putContent);
+ response = await client.PutAsync(instanceUrl, putContent, cancellationToken).ConfigureAwait(false);
}
break;
case HttpMethod.DELETE:
- response = await client.DeleteAsync(instanceUrl);
+ response = await client.DeleteAsync(instanceUrl, cancellationToken).ConfigureAwait(false);
break;
case HttpMethod.GET:
- response = await client.GetAsync(instanceUrl);
+ response = await client.GetAsync(instanceUrl, cancellationToken).ConfigureAwait(false);
break;
}
@@ -302,7 +302,7 @@ public enum HttpMethod
ReasonPhrase = response.ReasonPhrase,
};
- object content = (object)await response.Content.ReadAsStringAsync();
+ object content = (object)await response.Content.ReadAsStringAsync().ConfigureAwait(false);
switch (this.ResponseType.GetValue(dc.State))
{
@@ -348,7 +348,7 @@ public enum HttpMethod
}
// return the actionResult as the result of this operation
- return await dc.EndDialogAsync(result: requestResult, cancellationToken: cancellationToken);
+ return await dc.EndDialogAsync(result: requestResult, cancellationToken: cancellationToken).ConfigureAwait(false);
}
protected override string OnComputeId()
@@ -356,14 +356,14 @@ protected override string OnComputeId()
return $"{this.GetType().Name}[{Method} {Url?.ToString()}]";
}
- private async Task ReplaceJTokenRecursively(DialogContext dc, JToken token)
+ private async Task ReplaceJTokenRecursivelyAsync(DialogContext dc, JToken token, CancellationToken cancellationToken = default(CancellationToken))
{
switch (token.Type)
{
case JTokenType.Object:
foreach (var child in token.Children())
{
- await ReplaceJTokenRecursively(dc, child);
+ await ReplaceJTokenRecursivelyAsync(dc, child, cancellationToken).ConfigureAwait(false);
}
break;
@@ -372,13 +372,13 @@ private async Task ReplaceJTokenRecursively(DialogContext dc, JToken token)
// NOTE: ToList() is required because JToken.Replace will break the enumeration.
foreach (var child in token.Children().ToList())
{
- await ReplaceJTokenRecursively(dc, child);
+ await ReplaceJTokenRecursivelyAsync(dc, child, cancellationToken).ConfigureAwait(false);
}
break;
case JTokenType.Property:
- await ReplaceJTokenRecursively(dc, ((JProperty)token).Value);
+ await ReplaceJTokenRecursivelyAsync(dc, ((JProperty)token).Value, cancellationToken).ConfigureAwait(false);
break;
default:
diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/AdaptiveDialog.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/AdaptiveDialog.cs
index 5eb6711749..21227d6692 100644
--- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/AdaptiveDialog.cs
+++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/AdaptiveDialog.cs
@@ -151,7 +151,7 @@ public override async Task BeginDialogAsync(DialogContext dc,
EnsureDependenciesInstalled();
- await this.CheckForVersionChangeAsync(dc).ConfigureAwait(false);
+ await this.CheckForVersionChangeAsync(dc, cancellationToken).ConfigureAwait(false);
if (!dc.State.ContainsKey(DialogPath.EventCounter))
{
@@ -217,10 +217,10 @@ public override async Task ContinueDialogAsync(DialogContext d
{
EnsureDependenciesInstalled();
- await this.CheckForVersionChangeAsync(dc).ConfigureAwait(false);
+ await this.CheckForVersionChangeAsync(dc, cancellationToken).ConfigureAwait(false);
// Continue step execution
- return await ContinueActionsAsync(dc, null, cancellationToken).ConfigureAwait(false);
+ return await ContinueActionsAsync(dc, options: null, cancellationToken).ConfigureAwait(false);
}
public override async Task ResumeDialogAsync(DialogContext dc, DialogReason reason, object result = null, CancellationToken cancellationToken = default)
@@ -230,14 +230,14 @@ public override async Task ResumeDialogAsync(DialogContext dc,
throw new ArgumentException($"{nameof(result)} cannot be a cancellation token");
}
- await this.CheckForVersionChangeAsync(dc).ConfigureAwait(false);
+ await this.CheckForVersionChangeAsync(dc, cancellationToken).ConfigureAwait(false);
// Containers are typically leaf nodes on the stack but the dev is free to push other dialogs
// on top of the stack which will result in the container receiving an unexpected call to
// resumeDialog() when the pushed on dialog ends.
// To avoid the container prematurely ending we need to implement this method and simply
// ask our inner dialog stack to re-prompt.
- await RepromptDialogAsync(dc.Context, dc.ActiveDialog).ConfigureAwait(false);
+ await RepromptDialogAsync(dc.Context, dc.ActiveDialog, cancellationToken).ConfigureAwait(false);
return EndOfTurn;
}
@@ -464,7 +464,7 @@ protected override async Task OnPostBubbleEventAsync(DialogContext dc, Dia
if (activity.Type == ActivityTypes.Message)
{
// Recognize utterance
- var recognizedResult = await OnRecognize(actionContext, activity, cancellationToken).ConfigureAwait(false);
+ var recognizedResult = await OnRecognizeAsync(actionContext, activity, cancellationToken).ConfigureAwait(false);
// TODO figure out way to not use turn state to pass this value back to caller.
actionContext.State.SetValue(TurnPath.Recognized, recognizedResult);
@@ -681,7 +681,7 @@ protected async Task OnEndOfActionsAsync(ActionContext actionC
return new DialogTurnResult(DialogTurnStatus.Cancelled);
}
- protected async Task OnRecognize(ActionContext actionContext, Activity activity, CancellationToken cancellationToken = default)
+ protected async Task OnRecognizeAsync(ActionContext actionContext, Activity activity, CancellationToken cancellationToken = default)
{
if (Recognizer != null)
{
@@ -823,7 +823,7 @@ private async Task ProcessQueuesAsync(ActionContext actionContext, Cancell
if (nextAssignment != null && nextAssignment.Event != AdaptiveEvents.AssignEntity)
{
assignments.Dequeue(actionContext);
- handled = await this.ProcessQueuesAsync(actionContext, cancellationToken);
+ handled = await this.ProcessQueuesAsync(actionContext, cancellationToken).ConfigureAwait(false);
}
}
@@ -837,7 +837,7 @@ private string GetUniqueInstanceId(DialogContext dc)
private async Task QueueFirstMatchAsync(ActionContext actionContext, DialogEvent dialogEvent, bool preBubble, CancellationToken cancellationToken)
{
- var selection = await Selector.Select(actionContext, cancellationToken).ConfigureAwait(false);
+ var selection = await Selector.SelectAsync(actionContext, cancellationToken).ConfigureAwait(false);
if (selection.Any())
{
var condition = selection.First();
diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Generators/MultiLanguageGeneratorBase.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Generators/MultiLanguageGeneratorBase.cs
index 9d7153cfd5..a49d3c4af3 100644
--- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Generators/MultiLanguageGeneratorBase.cs
+++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Generators/MultiLanguageGeneratorBase.cs
@@ -40,7 +40,7 @@ public MultiLanguageGeneratorBase()
/// The template.
/// data to bind to.
/// The generator.
- public override async Task
+
diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/CrossTrainedRecognizerSet.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/CrossTrainedRecognizerSet.cs
index dabbfa0e9d..1381e1e2a7 100644
--- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/CrossTrainedRecognizerSet.cs
+++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/CrossTrainedRecognizerSet.cs
@@ -87,7 +87,7 @@ public override async Task RecognizeAsync(DialogContext dialog
var result = await recognizer.RecognizeAsync(dialogContext, activity, cancellationToken, telemetryProperties, telemetryMetrics).ConfigureAwait(false);
result.Properties["id"] = recognizer.Id;
return result;
- }));
+ })).ConfigureAwait(false);
var result = ProcessResults(results);
diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/EntityRecognizers/EntityRecognizer.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/EntityRecognizers/EntityRecognizer.cs
index c82f7f527a..3de2764f5a 100644
--- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/EntityRecognizers/EntityRecognizer.cs
+++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/EntityRecognizers/EntityRecognizer.cs
@@ -16,22 +16,22 @@ public EntityRecognizer()
{
}
- public virtual Task> RecognizeEntities(DialogContext dialogContext, IEnumerable entities, CancellationToken cancellationToken = default)
+ public virtual Task> RecognizeEntitiesAsync(DialogContext dialogContext, IEnumerable entities, CancellationToken cancellationToken = default)
{
- return this.RecognizeEntities(dialogContext, dialogContext.Context.Activity, entities, cancellationToken);
+ return this.RecognizeEntitiesAsync(dialogContext, dialogContext.Context.Activity, entities, cancellationToken);
}
- public virtual async Task> RecognizeEntities(DialogContext dialogContext, Activity activity, IEnumerable entities, CancellationToken cancellationToken = default)
+ public virtual async Task> RecognizeEntitiesAsync(DialogContext dialogContext, Activity activity, IEnumerable entities, CancellationToken cancellationToken = default)
{
if (activity.Type == ActivityTypes.Message)
{
- return await this.RecognizeEntities(dialogContext, activity.Text, activity.Locale, entities, cancellationToken).ConfigureAwait(false);
+ return await this.RecognizeEntitiesAsync(dialogContext, activity.Text, activity.Locale, entities, cancellationToken).ConfigureAwait(false);
}
return new List();
}
- public virtual Task> RecognizeEntities(DialogContext dialogContext, string text, string locale, IEnumerable entities, CancellationToken cancellationToken = default)
+ public virtual Task> RecognizeEntitiesAsync(DialogContext dialogContext, string text, string locale, IEnumerable entities, CancellationToken cancellationToken = default)
{
return Task.FromResult>(Array.Empty());
}
diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/EntityRecognizers/EntityRecognizerSet.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/EntityRecognizers/EntityRecognizerSet.cs
index 9cb99bbe40..bd4f05abd0 100644
--- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/EntityRecognizers/EntityRecognizerSet.cs
+++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/EntityRecognizers/EntityRecognizerSet.cs
@@ -30,9 +30,9 @@ public EntityRecognizerSet(IEnumerable recognizers)
/// Context for the current turn of conversation.
/// if no entities are passed in, it will generate a for turnContext.Activity.Text and then generate entities off of that.
/// list.
- public virtual Task> RecognizeEntities(DialogContext dialogContext, IEnumerable entities = null)
+ public virtual Task> RecognizeEntitiesAsync(DialogContext dialogContext, IEnumerable entities = null)
{
- return this.RecognizeEntities(dialogContext, dialogContext.Context.Activity, entities);
+ return this.RecognizeEntitiesAsync(dialogContext, dialogContext.Context.Activity, entities);
}
///
@@ -42,11 +42,11 @@ public virtual Task> RecognizeEntities(DialogContext dialogContext
/// activity to recognize against.
/// if no entities are passed in, it will generate a for turnContext.Activity.Text and then generate entities off of that.
/// list.
- public virtual async Task> RecognizeEntities(DialogContext dialogContext, Activity activity, IEnumerable entities = null)
+ public virtual async Task> RecognizeEntitiesAsync(DialogContext dialogContext, Activity activity, IEnumerable entities = null)
{
if (activity.Type == ActivityTypes.Message)
{
- return await this.RecognizeEntities(dialogContext, activity.Text, activity.Locale, entities).ConfigureAwait(false);
+ return await this.RecognizeEntitiesAsync(dialogContext, activity.Text, activity.Locale, entities).ConfigureAwait(false);
}
return new List();
@@ -60,7 +60,7 @@ public virtual async Task> RecognizeEntities(DialogContext dialogC
/// locale to use.
/// if no entities are passed in, it will generate a for turnContext.Activity.Text and then generate entities off of that.
/// list.
- public virtual async Task> RecognizeEntities(DialogContext dialogContext, string text, string locale, IEnumerable entities = null)
+ public virtual async Task> RecognizeEntitiesAsync(DialogContext dialogContext, string text, string locale, IEnumerable entities = null)
{
List allNewEntities = new List();
List entitiesToProcess = new List(entities ?? Array.Empty());
@@ -84,7 +84,7 @@ public virtual async Task> RecognizeEntities(DialogContext dialogC
try
{
// get new entities
- var newEntities = await recognizer.RecognizeEntities(dialogContext, text, locale, entitiesToProcess).ConfigureAwait(false);
+ var newEntities = await recognizer.RecognizeEntitiesAsync(dialogContext, text, locale, entitiesToProcess).ConfigureAwait(false);
foreach (var newEntity in newEntities)
{
diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/EntityRecognizers/TextEntityRecognizer.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/EntityRecognizers/TextEntityRecognizer.cs
index 31811013af..eefe99c971 100644
--- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/EntityRecognizers/TextEntityRecognizer.cs
+++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/EntityRecognizers/TextEntityRecognizer.cs
@@ -21,7 +21,7 @@ public TextEntityRecognizer()
{
}
- public override Task> RecognizeEntities(DialogContext dialogContext, string text, string locale, IEnumerable entities, CancellationToken cancellationToken = default)
+ public override Task> RecognizeEntitiesAsync(DialogContext dialogContext, string text, string locale, IEnumerable entities, CancellationToken cancellationToken = default)
{
List newEntities = new List();
var culture = Culture.MapToNearestLanguage(locale ?? string.Empty);
diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/RecognizerSet.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/RecognizerSet.cs
index 83148fdd51..60670d7475 100644
--- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/RecognizerSet.cs
+++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/RecognizerSet.cs
@@ -56,7 +56,7 @@ public override async Task RecognizeAsync(DialogContext dialog
}
// run all of the recognizers in parallel
- var results = await Task.WhenAll(Recognizers.Select(r => r.RecognizeAsync(dialogContext, activity, cancellationToken, telemetryProperties, telemetryMetrics)));
+ var results = await Task.WhenAll(Recognizers.Select(r => r.RecognizeAsync(dialogContext, activity, cancellationToken, telemetryProperties, telemetryMetrics))).ConfigureAwait(false);
// merge intents
var result = MergeResults(results);
diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/RegexRecognizer.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/RegexRecognizer.cs
index c6e7a576e2..ab223ab10b 100644
--- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/RegexRecognizer.cs
+++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Recognizers/RegexRecognizer.cs
@@ -115,7 +115,7 @@ public override async Task RecognizeAsync(DialogContext dialog
{
// process entities using EntityRecognizerSet
var entitySet = new EntityRecognizerSet(this.Entities);
- var newEntities = await entitySet.RecognizeEntities(dialogContext, text, locale, entityPool).ConfigureAwait(false);
+ var newEntities = await entitySet.RecognizeEntitiesAsync(dialogContext, text, locale, entityPool).ConfigureAwait(false);
if (newEntities.Any())
{
entityPool.AddRange(newEntities);
diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/ConditionalSelector.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/ConditionalSelector.cs
index 61a5dc2eb9..6f3d78a921 100644
--- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/ConditionalSelector.cs
+++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/ConditionalSelector.cs
@@ -55,7 +55,7 @@ public override void Initialize(IEnumerable conditionals, bool eval
_evaluate = evaluate;
}
- public override async Task> Select(ActionContext actionContext, CancellationToken cancel = default)
+ public override async Task> SelectAsync(ActionContext actionContext, CancellationToken cancel = default)
{
var (eval, _) = Condition.TryGetValue(actionContext.State);
TriggerSelector selector;
@@ -70,7 +70,7 @@ public override async Task> Select(ActionContext acti
IfFalse.Initialize(_conditionals, _evaluate);
}
- return await selector.Select(actionContext, cancel).ConfigureAwait(false);
+ return await selector.SelectAsync(actionContext, cancel).ConfigureAwait(false);
}
}
}
diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/FirstSelector.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/FirstSelector.cs
index af75916483..3ddc78e9ee 100644
--- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/FirstSelector.cs
+++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/FirstSelector.cs
@@ -27,7 +27,7 @@ public override void Initialize(IEnumerable conditionals, bool eval
_evaluate = evaluate;
}
- public override Task> Select(ActionContext context, CancellationToken cancel)
+ public override Task> SelectAsync(ActionContext context, CancellationToken cancel)
{
OnCondition selection = null;
var lowestPriority = int.MaxValue;
diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/MostSpecificSelector.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/MostSpecificSelector.cs
index 5dcb6bb386..1bbc0d019a 100644
--- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/MostSpecificSelector.cs
+++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/MostSpecificSelector.cs
@@ -37,7 +37,7 @@ public override void Initialize(IEnumerable conditionals, bool eval
}
}
- public override async Task> Select(ActionContext context, CancellationToken cancel)
+ public override async Task> SelectAsync(ActionContext context, CancellationToken cancel)
{
var triggers = _tree.Matches(context.State);
var matches = new List();
@@ -50,7 +50,7 @@ public override async Task> Select(ActionContext cont
if (Selector != null)
{
Selector.Initialize(matches, false);
- selections = await Selector.Select(context, cancel).ConfigureAwait(false);
+ selections = await Selector.SelectAsync(context, cancel).ConfigureAwait(false);
}
return selections;
diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/RandomSelector.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/RandomSelector.cs
index 53bb2b3c57..1f6f07dcf4 100644
--- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/RandomSelector.cs
+++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/RandomSelector.cs
@@ -52,7 +52,7 @@ public override void Initialize(IEnumerable conditionals, bool eval
}
}
- public override Task> Select(ActionContext context, CancellationToken cancel = default)
+ public override Task> SelectAsync(ActionContext context, CancellationToken cancel = default)
{
var candidates = _conditionals;
if (_evaluate)
diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/TrueSelector.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/TrueSelector.cs
index 6a21e57406..80585e78bc 100644
--- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/TrueSelector.cs
+++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Selectors/TrueSelector.cs
@@ -27,7 +27,7 @@ public override void Initialize(IEnumerable conditionals, bool eval
_evaluate = evaluate;
}
- public override Task> Select(ActionContext context, CancellationToken cancel = default)
+ public override Task> SelectAsync(ActionContext context, CancellationToken cancel = default)
{
var candidates = _conditionals;
if (_evaluate)
diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Templates/ActivityTemplate.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Templates/ActivityTemplate.cs
index e998df2b99..dc305e1a7b 100644
--- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Templates/ActivityTemplate.cs
+++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Templates/ActivityTemplate.cs
@@ -47,7 +47,7 @@ public virtual async Task BindAsync(DialogContext dialogContext, objec
var languageGenerator = dialogContext.Services.Get();
if (languageGenerator != null)
{
- var lgStringResult = await languageGenerator.Generate(dialogContext, this.Template, data ?? dialogContext.State).ConfigureAwait(false);
+ var lgStringResult = await languageGenerator.GenerateAsync(dialogContext, this.Template, data ?? dialogContext.State).ConfigureAwait(false);
var result = ActivityFactory.FromObject(lgStringResult);
return result;
}
diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Templates/TextTemplate.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Templates/TextTemplate.cs
index 59374cae13..c21afbb25b 100644
--- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Templates/TextTemplate.cs
+++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Templates/TextTemplate.cs
@@ -43,7 +43,7 @@ public virtual async Task BindAsync(DialogContext dialogContext, object
LanguageGenerator languageGenerator = dialogContext.Services.Get();
if (languageGenerator != null)
{
- var result = await languageGenerator.Generate(
+ var result = await languageGenerator.GenerateAsync(
dialogContext,
template: Template,
data: data ?? dialogContext.State).ConfigureAwait(false);
diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/TriggerConditions/OnCondition.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/TriggerConditions/OnCondition.cs
index e24a4135be..c0c64bb4aa 100644
--- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/TriggerConditions/OnCondition.cs
+++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/TriggerConditions/OnCondition.cs
@@ -226,7 +226,7 @@ public void AddExternalCondition(string condition)
///
/// Context.
/// A with plan change list.
- public virtual async Task> ExecuteAsync(ActionContext actionContext)
+ public virtual Task> ExecuteAsync(ActionContext actionContext)
{
if (RunOnce)
{
@@ -234,7 +234,7 @@ public virtual async Task> ExecuteAsync(ActionContext act
actionContext.State.SetValue($"{AdaptiveDialog.ConditionTracker}.{Id}.lastRun", count);
}
- return await Task.FromResult(new List()
+ return Task.FromResult(new List()
{
this.OnCreateChangeList(actionContext)
});
diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/TriggerSelector.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/TriggerSelector.cs
index 429393b466..d047215f7d 100644
--- a/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/TriggerSelector.cs
+++ b/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/TriggerSelector.cs
@@ -26,6 +26,6 @@ public abstract class TriggerSelector
/// Dialog context for evaluation.
/// Cancellation token.
/// Best rule in original list to execute or -1 if none.
- public abstract Task> Select(ActionContext actionContext, CancellationToken cancel = default);
+ public abstract Task> SelectAsync(ActionContext actionContext, CancellationToken cancel = default);
}
}
diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Debugging/Microsoft.Bot.Builder.Dialogs.Debugging.csproj b/libraries/Microsoft.Bot.Builder.Dialogs.Debugging/Microsoft.Bot.Builder.Dialogs.Debugging.csproj
index e297291d93..89f709d131 100644
--- a/libraries/Microsoft.Bot.Builder.Dialogs.Debugging/Microsoft.Bot.Builder.Dialogs.Debugging.csproj
+++ b/libraries/Microsoft.Bot.Builder.Dialogs.Debugging/Microsoft.Bot.Builder.Dialogs.Debugging.csproj
@@ -27,6 +27,7 @@
+
diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Microsoft.Bot.Builder.Dialogs.Declarative.csproj b/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Microsoft.Bot.Builder.Dialogs.Declarative.csproj
index 5978838744..b3096b6641 100644
--- a/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Microsoft.Bot.Builder.Dialogs.Declarative.csproj
+++ b/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Microsoft.Bot.Builder.Dialogs.Declarative.csproj
@@ -34,7 +34,7 @@
-
+
diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Resources/FileResource.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Resources/FileResource.cs
index 43f6ccee60..82373004eb 100644
--- a/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Resources/FileResource.cs
+++ b/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Resources/FileResource.cs
@@ -13,7 +13,6 @@ namespace Microsoft.Bot.Builder.Dialogs.Declarative.Resources
public class FileResource : Resource
{
private Task contentTask;
- private Task textTask;
///
/// Initializes a new instance of the class.
diff --git a/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Resources/ResourceExplorer.cs b/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Resources/ResourceExplorer.cs
index 368b9bfed3..2bed334411 100644
--- a/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Resources/ResourceExplorer.cs
+++ b/libraries/Microsoft.Bot.Builder.Dialogs.Declarative/Resources/ResourceExplorer.cs
@@ -165,7 +165,7 @@ public async Task LoadTypeAsync(Resource resource)
try
{
var sourceContext = new SourceContext();
- var (json, range) = await ReadTokenRangeAsync(resource, sourceContext);
+ var (json, range) = await ReadTokenRangeAsync(resource, sourceContext).ConfigureAwait(false);
using (new SourceScope(sourceContext, range))
{
var result = Load(json, sourceContext);
@@ -388,7 +388,7 @@ public async Task ResolveRefAsync(JToken refToken, SourceContext sourceC
}
}
- var (json, range) = await ReadTokenRangeAsync(resource, sourceContext);
+ var (json, range) = await ReadTokenRangeAsync(resource, sourceContext).ConfigureAwait(false);
foreach (JProperty prop in refToken.Children())
{
diff --git a/libraries/Microsoft.Bot.Builder.Dialogs/DialogContainer.cs b/libraries/Microsoft.Bot.Builder.Dialogs/DialogContainer.cs
index 08867f1bbe..e42c545826 100644
--- a/libraries/Microsoft.Bot.Builder.Dialogs/DialogContainer.cs
+++ b/libraries/Microsoft.Bot.Builder.Dialogs/DialogContainer.cs
@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Text;
+using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json;
@@ -53,7 +54,24 @@ protected virtual string GetInternalVersion()
///
/// This should be called at the start of `beginDialog()`, `continueDialog()`, and `resumeDialog()`.
///
- protected virtual async Task CheckForVersionChangeAsync(DialogContext dc)
+ protected virtual Task CheckForVersionChangeAsync(DialogContext dc)
+ {
+ return CheckForVersionChangeAsync(dc, default(CancellationToken));
+ }
+
+ ///
+ /// CheckForVersionChangeAsync.
+ ///
+ /// dialog context.
+ /// cancellationToken.
+ /// task.
+ ///
+ /// Checks to see if a containers child dialogs have changed since the current dialog instance
+ /// was started.
+ ///
+ /// This should be called at the start of `beginDialog()`, `continueDialog()`, and `resumeDialog()`.
+ ///
+ protected virtual async Task CheckForVersionChangeAsync(DialogContext dc, CancellationToken cancellationToken)
{
var current = dc.ActiveDialog.Version;
dc.ActiveDialog.Version = this.GetInternalVersion();
diff --git a/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Profiling/Program.cs b/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Profiling/Program.cs
index 44e7ca9783..8e3c6a1d1f 100644
--- a/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Profiling/Program.cs
+++ b/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Profiling/Program.cs
@@ -105,7 +105,7 @@ public static void Main(string[] args)
Console.WriteLine($" loading took {loading} ms");
var iterationTime = 0L;
- var firstTime = 0l;
+ var firstTime = 0L;
for (var iter = 0; iter < iterations; ++iter)
{
timer.Restart();
diff --git a/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Templates.Tests/LGGeneratorTests.cs b/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Templates.Tests/LGGeneratorTests.cs
index 2c72551dcb..2e85f917a3 100644
--- a/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Templates.Tests/LGGeneratorTests.cs
+++ b/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Templates.Tests/LGGeneratorTests.cs
@@ -30,7 +30,7 @@ public async Task TestNotFoundTemplate()
{
var context = GetDialogContext(string.Empty);
var lg = new TemplateEngineLanguageGenerator();
- await lg.Generate(context, "${tesdfdfsst()}", null);
+ await lg.GenerateAsync(context, "${tesdfdfsst()}", null);
}
[TestMethod]
@@ -43,35 +43,35 @@ public async Task TestMultiLangImport()
var resource = resourceExplorer.GetResource("a.en-US.lg") as FileResource;
var generator = new TemplateEngineLanguageGenerator(resource.FullName, lgResourceGroup);
- var result = await generator.Generate(GetDialogContext(), "${templatea()}", null);
+ var result = await generator.GenerateAsync(GetDialogContext(), "${templatea()}", null);
Assert.AreEqual("from a.en-us.lg", result);
// import b.en-us.lg
- result = await generator.Generate(GetDialogContext(), "${templateb()}", null);
+ result = await generator.GenerateAsync(GetDialogContext(), "${templateb()}", null);
Assert.AreEqual("from b.en-us.lg", result);
// fallback to c.en.lg
- result = await generator.Generate(GetDialogContext(), "${templatec()}", null);
+ result = await generator.GenerateAsync(GetDialogContext(), "${templatec()}", null);
Assert.AreEqual("from c.en.lg", result);
// there is no 'greeting' template in b.en-us.lg, no more fallback to b.lg
- var ex = await Assert.ThrowsExceptionAsync(async () => await generator.Generate(GetDialogContext(), "${greeting()}", null));
+ var ex = await Assert.ThrowsExceptionAsync(async () => await generator.GenerateAsync(GetDialogContext(), "${greeting()}", null));
Assert.IsTrue(ex.Message.Contains("greeting does not have an evaluator"));
resource = resourceExplorer.GetResource("a.lg") as FileResource;
generator = new TemplateEngineLanguageGenerator(resource.FullName, lgResourceGroup);
- result = await generator.Generate(GetDialogContext(), "${templatea()}", null);
+ result = await generator.GenerateAsync(GetDialogContext(), "${templatea()}", null);
Assert.AreEqual("from a.lg", result);
- result = await generator.Generate(GetDialogContext(), "${templateb()}", null);
+ result = await generator.GenerateAsync(GetDialogContext(), "${templateb()}", null);
Assert.AreEqual("from b.lg", result);
// ignore the "en" in c.en.lg, just load c.lg
- result = await generator.Generate(GetDialogContext(), "${templatec()}", null);
+ result = await generator.GenerateAsync(GetDialogContext(), "${templatec()}", null);
Assert.AreEqual("from c.lg", result);
- result = await generator.Generate(GetDialogContext(), "${greeting()}", null);
+ result = await generator.GenerateAsync(GetDialogContext(), "${greeting()}", null);
Assert.AreEqual("hi", result);
}
@@ -86,19 +86,19 @@ public override async Task BeginDialogAsync(DialogContext dial
Assert.IsNotNull(lg, "ILanguageGenerator should not be null");
Assert.IsNotNull(dialogContext.Services.Get(), "ResourceExplorer should not be null");
- var result = await lg.Generate(dialogContext, "${templatea()}", null);
+ var result = await lg.GenerateAsync(dialogContext, "${templatea()}", null);
Assert.AreEqual("from a.en-us.lg", result);
// import b.en-us.lg
- result = await lg.Generate(dialogContext, "${templateb()}", null);
+ result = await lg.GenerateAsync(dialogContext, "${templateb()}", null);
Assert.AreEqual("from b.en-us.lg", result);
// fallback to c.en.lg
- result = await lg.Generate(dialogContext, "${templatec()}", null);
+ result = await lg.GenerateAsync(dialogContext, "${templatec()}", null);
Assert.AreEqual("from c.en.lg", result);
// there is no 'greeting' template in b.en-us.lg, fallback to a.lg to find it.
- result = await lg.Generate(dialogContext, "${greeting()}", null);
+ result = await lg.GenerateAsync(dialogContext, "${greeting()}", null);
Assert.AreEqual("hi", result);
//en locale
@@ -106,34 +106,34 @@ public override async Task BeginDialogAsync(DialogContext dial
Assert.IsNotNull(lg, "ILanguageGenerator should not be null");
Assert.IsNotNull(dialogContext.Services.Get(), "ResourceExplorer should not be null");
- result = await lg.Generate(dialogContext, "${templatea()}", null);
+ result = await lg.GenerateAsync(dialogContext, "${templatea()}", null);
Assert.AreEqual("from a.lg", result);
// import b.en-us.lg
- result = await lg.Generate(dialogContext, "${templateb()}", null);
+ result = await lg.GenerateAsync(dialogContext, "${templateb()}", null);
Assert.AreEqual("from b.lg", result);
// c.en.lg is ignore in b.lg
- result = await lg.Generate(dialogContext, "${templatec()}", null);
+ result = await lg.GenerateAsync(dialogContext, "${templatec()}", null);
Assert.AreEqual("from c.lg", result);
// there is no 'greeting' template in b.en-us.lg, fallback to a.lg to find it.
- result = await lg.Generate(dialogContext, "${greeting()}", null);
+ result = await lg.GenerateAsync(dialogContext, "${greeting()}", null);
Assert.AreEqual("hi", result);
// empty locale
dialogContext.Context.Activity.Locale = string.Empty;
- result = await lg.Generate(dialogContext, "${templatea()}", null);
+ result = await lg.GenerateAsync(dialogContext, "${templatea()}", null);
Assert.AreEqual("from a.lg", result);
- result = await lg.Generate(dialogContext, "${templateb()}", null);
+ result = await lg.GenerateAsync(dialogContext, "${templateb()}", null);
Assert.AreEqual("from b.lg", result);
// ignore the "en" in c.en.lg, just load c.lg
- result = await lg.Generate(dialogContext, "${templatec()}", null);
+ result = await lg.GenerateAsync(dialogContext, "${templatec()}", null);
Assert.AreEqual("from c.lg", result);
- result = await lg.Generate(dialogContext, "${greeting()}", null);
+ result = await lg.GenerateAsync(dialogContext, "${greeting()}", null);
Assert.AreEqual("hi", result);
return await dialogContext.EndDialogAsync();
@@ -174,18 +174,18 @@ public async Task TestMultiLanguageGenerator()
lg.LanguageGenerators["fr"] = new TemplateEngineLanguageGenerator(resourceExplorer.GetResource("test.fr.lg").ReadTextAsync().Result, "test.fr.lg", multilanguageresources);
// test targeted in each language
- Assert.AreEqual("english-us", await lg.Generate(GetDialogContext(locale: "en-us"), "${test()}", null));
- Assert.AreEqual("english-gb", await lg.Generate(GetDialogContext(locale: "en-gb"), "${test()}", null));
- Assert.AreEqual("english", await lg.Generate(GetDialogContext(locale: "en"), "${test()}", null));
- Assert.AreEqual("default", await lg.Generate(GetDialogContext(locale: string.Empty), "${test()}", null));
- Assert.AreEqual("default", await lg.Generate(GetDialogContext(locale: "foo"), "${test()}", null));
+ Assert.AreEqual("english-us", await lg.GenerateAsync(GetDialogContext(locale: "en-us"), "${test()}", null));
+ Assert.AreEqual("english-gb", await lg.GenerateAsync(GetDialogContext(locale: "en-gb"), "${test()}", null));
+ Assert.AreEqual("english", await lg.GenerateAsync(GetDialogContext(locale: "en"), "${test()}", null));
+ Assert.AreEqual("default", await lg.GenerateAsync(GetDialogContext(locale: string.Empty), "${test()}", null));
+ Assert.AreEqual("default", await lg.GenerateAsync(GetDialogContext(locale: "foo"), "${test()}", null));
// test fallback for en-us -> en -> default
//Assert.AreEqual("default2", await lg.Generate(GetTurnContext(locale: "en-us"), "${test2()}", null));
- Assert.AreEqual("default2", await lg.Generate(GetDialogContext(locale: "en-gb"), "${test2()}", null));
- Assert.AreEqual("default2", await lg.Generate(GetDialogContext(locale: "en"), "${test2()}", null));
- Assert.AreEqual("default2", await lg.Generate(GetDialogContext(locale: string.Empty), "${test2()}", null));
- Assert.AreEqual("default2", await lg.Generate(GetDialogContext(locale: "foo"), "${test2()}", null));
+ Assert.AreEqual("default2", await lg.GenerateAsync(GetDialogContext(locale: "en-gb"), "${test2()}", null));
+ Assert.AreEqual("default2", await lg.GenerateAsync(GetDialogContext(locale: "en"), "${test2()}", null));
+ Assert.AreEqual("default2", await lg.GenerateAsync(GetDialogContext(locale: string.Empty), "${test2()}", null));
+ Assert.AreEqual("default2", await lg.GenerateAsync(GetDialogContext(locale: "foo"), "${test2()}", null));
}
[TestMethod]
@@ -194,19 +194,19 @@ public async Task TestResourceMultiLanguageGenerator()
var lg = new ResourceMultiLanguageGenerator("test.lg");
// test targeted in each language
- Assert.AreEqual("english-us", await lg.Generate(GetDialogContext("en-us", lg), "${test()}", null));
- Assert.AreEqual("english-us", await lg.Generate(GetDialogContext("en-us", lg), "${test()}", new { country = "us" }));
- Assert.AreEqual("english-gb", await lg.Generate(GetDialogContext("en-gb", lg), "${test()}", null));
- Assert.AreEqual("english", await lg.Generate(GetDialogContext("en", lg), "${test()}", null));
- Assert.AreEqual("default", await lg.Generate(GetDialogContext(string.Empty, lg), "${test()}", null));
- Assert.AreEqual("default", await lg.Generate(GetDialogContext("foo", lg), "${test()}", null));
+ Assert.AreEqual("english-us", await lg.GenerateAsync(GetDialogContext("en-us", lg), "${test()}", null));
+ Assert.AreEqual("english-us", await lg.GenerateAsync(GetDialogContext("en-us", lg), "${test()}", new { country = "us" }));
+ Assert.AreEqual("english-gb", await lg.GenerateAsync(GetDialogContext("en-gb", lg), "${test()}", null));
+ Assert.AreEqual("english", await lg.GenerateAsync(GetDialogContext("en", lg), "${test()}", null));
+ Assert.AreEqual("default", await lg.GenerateAsync(GetDialogContext(string.Empty, lg), "${test()}", null));
+ Assert.AreEqual("default", await lg.GenerateAsync(GetDialogContext("foo", lg), "${test()}", null));
// test fallback for en-us -> en -> default
//Assert.AreEqual("default2", await lg.Generate(GetTurnContext("en-us", lg), "${test2()}", null));
- Assert.AreEqual("default2", await lg.Generate(GetDialogContext("en-gb", lg), "${test2()}", null));
- Assert.AreEqual("default2", await lg.Generate(GetDialogContext("en", lg), "${test2()}", null));
- Assert.AreEqual("default2", await lg.Generate(GetDialogContext(string.Empty, lg), "${test2()}", null));
- Assert.AreEqual("default2", await lg.Generate(GetDialogContext("foo", lg), "${test2()}", null));
+ Assert.AreEqual("default2", await lg.GenerateAsync(GetDialogContext("en-gb", lg), "${test2()}", null));
+ Assert.AreEqual("default2", await lg.GenerateAsync(GetDialogContext("en", lg), "${test2()}", null));
+ Assert.AreEqual("default2", await lg.GenerateAsync(GetDialogContext(string.Empty, lg), "${test2()}", null));
+ Assert.AreEqual("default2", await lg.GenerateAsync(GetDialogContext("foo", lg), "${test2()}", null));
}
public class TestLanguageGeneratorMiddlewareDialog : Dialog
@@ -216,7 +216,7 @@ public async override Task BeginDialogAsync(DialogContext dial
var lg = dialogContext.Services.Get();
Assert.IsNotNull(lg, "ILanguageGenerator should not be null");
Assert.IsNotNull(dialogContext.Services.Get(), "ResourceExplorer should not be null");
- var text = await lg.Generate(dialogContext, "${test()}", null);
+ var text = await lg.GenerateAsync(dialogContext, "${test()}", null);
Assert.AreEqual("english-us", text, "template should be there");
return await dialogContext.EndDialogAsync();
}
@@ -359,7 +359,7 @@ public async override Task BeginDialogAsync(DialogContext dial
{
var lg = dialogContext.Services.Get();
- var result = await lg.Generate(dialogContext, "This is ${test.name}", new
+ var result = await lg.GenerateAsync(dialogContext, "This is ${test.name}", new
{
test = new
{
@@ -473,7 +473,7 @@ private TestFlow CreateNoResourceExplorerFlow(BotCallbackHandler handler)
public class MockLanguageGenerator : LanguageGenerator
{
- public override Task Generate(DialogContext dialogContext, string template, object data)
+ public override Task GenerateAsync(DialogContext dialogContext, string template, object data)
{
return Task.FromResult((object)template);
}
diff --git a/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/EntityRecognizerTests.cs b/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/EntityRecognizerTests.cs
index c46bea6cbb..3523d2b6d4 100644
--- a/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/EntityRecognizerTests.cs
+++ b/tests/Microsoft.Bot.Builder.Dialogs.Adaptive.Tests/EntityRecognizerTests.cs
@@ -46,7 +46,7 @@ public class EntityRecognizerTests
public void TestAge()
{
var turnContext = GetTurnContext("This is a test of one, 2, three years old");
- var results = recognizers.Value.RecognizeEntities(turnContext).Result;
+ var results = recognizers.Value.RecognizeEntitiesAsync(turnContext).Result;
Assert.AreEqual(6, results.Count, "Should be 5 entities found");
Assert.AreEqual(1, results.Where(entity => entity.Type == "age").Count(), "Should have 1 age entity");
@@ -56,7 +56,7 @@ public void TestAge()
public void TestConfirmation()
{
var turnContext = GetTurnContext("yes, please");
- var results = recognizers.Value.RecognizeEntities(turnContext).Result;
+ var results = recognizers.Value.RecognizeEntitiesAsync(turnContext).Result;
Assert.AreEqual(2, results.Count, "Should be 1 entities found");
Assert.AreEqual(1, results.Where(entity => entity.Type == "boolean").Count(), "Should have 1 boolean results");
@@ -66,7 +66,7 @@ public void TestConfirmation()
public void TestCurrency()
{
var turnContext = GetTurnContext("I would pay four dollars for that.");
- var results = recognizers.Value.RecognizeEntities(turnContext).Result;
+ var results = recognizers.Value.RecognizeEntitiesAsync(turnContext).Result;
Assert.AreEqual(3, results.Count, "Should be 2 entities found");
Assert.AreEqual(1, results.Where(entity => entity.Type == "currency").Count(), "Should have 1 currency result");
@@ -76,7 +76,7 @@ public void TestCurrency()
public void TestDateTime()
{
var turnContext = GetTurnContext("Next thursday at 4pm.");
- var results = recognizers.Value.RecognizeEntities(turnContext).Result;
+ var results = recognizers.Value.RecognizeEntitiesAsync(turnContext).Result;
Assert.AreEqual(4, results.Count, "Should be 3 entities found");
Assert.AreEqual(1, results.Where(entity => entity.Type == "datetimeV2.datetime").Count(), "Should have 1 datetime result");
@@ -88,7 +88,7 @@ public void TestDateTime()
public void TestDimension()
{
var turnContext = GetTurnContext("I think he's 5 foot ten");
- var results = recognizers.Value.RecognizeEntities(turnContext).Result;
+ var results = recognizers.Value.RecognizeEntitiesAsync(turnContext).Result;
Assert.AreEqual(4, results.Count, "Should be 3 entities found");
Assert.AreEqual(1, results.Where(entity => entity.Type == "dimension").Count(), "Should have 1 dimension result");
@@ -98,7 +98,7 @@ public void TestDimension()
public void TestEmail()
{
var turnContext = GetTurnContext("my email address is foo@att.uk.co");
- var results = recognizers.Value.RecognizeEntities(turnContext).Result;
+ var results = recognizers.Value.RecognizeEntitiesAsync(turnContext).Result;
Assert.AreEqual(2, results.Count, "Should be 1 entities found");
Assert.AreEqual(1, results.Where(entity => entity.Type == "email").Count(), "Should have 1 email result");
@@ -109,7 +109,7 @@ public void TestGuid()
{
var guid = Guid.Empty;
var turnContext = GetTurnContext($"my account number is {guid}...");
- var results = recognizers.Value.RecognizeEntities(turnContext).Result;
+ var results = recognizers.Value.RecognizeEntitiesAsync(turnContext).Result;
Assert.AreEqual(7, results.Count, "Should be 6 entities found");
Assert.AreEqual(1, results.Where(entity => entity.Type == "guid").Count(), "Should have 1 guid result");
@@ -119,7 +119,7 @@ public void TestGuid()
public void TestHashtag()
{
var turnContext = GetTurnContext($"I'm so cool #cool #groovy...");
- var results = recognizers.Value.RecognizeEntities(turnContext).Result;
+ var results = recognizers.Value.RecognizeEntitiesAsync(turnContext).Result;
Assert.AreEqual(3, results.Count, "Should be 2 entities found");
Assert.AreEqual(2, results.Where(entity => entity.Type == "hashtag").Count(), "Should have 2 hashtag result");
@@ -129,7 +129,7 @@ public void TestHashtag()
public void TestIp()
{
var turnContext = GetTurnContext($"My address is 1.2.3.4");
- var results = recognizers.Value.RecognizeEntities(turnContext).Result;
+ var results = recognizers.Value.RecognizeEntitiesAsync(turnContext).Result;
Assert.AreEqual(6, results.Count, "Should be 5 entities found");
Assert.AreEqual(1, results.Where(entity => entity.Type == "ip").Count(), "Should have 1 ip result");
@@ -139,7 +139,7 @@ public void TestIp()
public void TestMention()
{
var turnContext = GetTurnContext($"Tell @joesmith I'm coming...");
- var results = recognizers.Value.RecognizeEntities(turnContext).Result;
+ var results = recognizers.Value.RecognizeEntitiesAsync(turnContext).Result;
Assert.AreEqual(2, results.Count, "Should be 1 entities found");
Assert.AreEqual(1, results.Where(entity => entity.Type == "mention").Count(), "Should have 1 mention result");
@@ -149,7 +149,7 @@ public void TestMention()
public void TestNumber()
{
var turnContext = GetTurnContext("This is a test of one, 2, three");
- var results = recognizers.Value.RecognizeEntities(turnContext).Result;
+ var results = recognizers.Value.RecognizeEntitiesAsync(turnContext).Result;
Assert.AreEqual(4, results.Count, "Should be 3 numbers found");
Assert.AreEqual(3, results.Where(entity => entity.Type == "number").Count(), "Should have 3 numbers");
@@ -159,7 +159,7 @@ public void TestNumber()
public void TestNumberRange()
{
var turnContext = GetTurnContext("there are 3 to 5 of them");
- var results = recognizers.Value.RecognizeEntities(turnContext).Result;
+ var results = recognizers.Value.RecognizeEntitiesAsync(turnContext).Result;
Assert.AreEqual(4, results.Count, "Should be 3 entities found");
Assert.AreEqual(1, results.Where(entity => entity.Type == "numberrange").Count(), "Should have 1 number range");
@@ -169,7 +169,7 @@ public void TestNumberRange()
public void TestOrdinal()
{
var turnContext = GetTurnContext("First, second or third");
- var results = recognizers.Value.RecognizeEntities(turnContext).Result;
+ var results = recognizers.Value.RecognizeEntitiesAsync(turnContext).Result;
Assert.AreEqual(4, results.Count, "Should be 3 entities found");
Assert.AreEqual(3, results.Where(entity => entity.Type == "ordinal").Count(), "Should have 3 ordinals");
@@ -179,7 +179,7 @@ public void TestOrdinal()
public void TestPercentage()
{
var turnContext = GetTurnContext("The population hit 33.3%");
- var results = recognizers.Value.RecognizeEntities(turnContext).Result;
+ var results = recognizers.Value.RecognizeEntitiesAsync(turnContext).Result;
Assert.AreEqual(3, results.Count, "Should be 2 entities found");
Assert.AreEqual(1, results.Where(entity => entity.Type == "percentage").Count(), "Should have 1 percentage");
@@ -189,7 +189,7 @@ public void TestPercentage()
public void TestPhoneNumber()
{
var turnContext = GetTurnContext("Call 425-882-8080");
- var results = recognizers.Value.RecognizeEntities(turnContext).Result;
+ var results = recognizers.Value.RecognizeEntitiesAsync(turnContext).Result;
Assert.AreEqual(5, results.Count, "Should be 4 entities found");
Assert.AreEqual(1, results.Where(entity => entity.Type == "phonenumber").Count(), "Should have 1 phonenumber");
@@ -199,7 +199,7 @@ public void TestPhoneNumber()
public void TestTemperature()
{
var turnContext = GetTurnContext("set the oven to 350 degrees");
- var results = recognizers.Value.RecognizeEntities(turnContext).Result;
+ var results = recognizers.Value.RecognizeEntitiesAsync(turnContext).Result;
Assert.AreEqual(3, results.Count, "Should be 2 entities found");
Assert.AreEqual(1, results.Where(entity => entity.Type == "temperature").Count(), "Should have 1 temperature");
@@ -209,7 +209,7 @@ public void TestTemperature()
public void TestUrl()
{
var turnContext = GetTurnContext("go to http://about.me for more info");
- var results = recognizers.Value.RecognizeEntities(turnContext).Result;
+ var results = recognizers.Value.RecognizeEntitiesAsync(turnContext).Result;
Assert.AreEqual(2, results.Count, "Should be 1 entities found");
Assert.AreEqual(1, results.Where(entity => entity.Type == "url").Count(), "Should have 1 url");
@@ -220,7 +220,7 @@ public void TestRegEx()
{
// I would like {order}
var turnContext = GetTurnContext("I would like a red or Blue cat");
- var results = recognizers.Value.RecognizeEntities(turnContext).Result;
+ var results = recognizers.Value.RecognizeEntitiesAsync(turnContext).Result;
Assert.AreEqual(3, results.Count, "Should be 2 entities found");
Assert.AreEqual(2, results.Where(entity => entity.Type == "color").Count(), "Should have 2 color results");