diff --git a/src/libraries/Microsoft.PowerFx.Core/App/Controls/IExternalRule.cs b/src/libraries/Microsoft.PowerFx.Core/App/Controls/IExternalRule.cs index e92cdaac7..fc81c185a 100644 --- a/src/libraries/Microsoft.PowerFx.Core/App/Controls/IExternalRule.cs +++ b/src/libraries/Microsoft.PowerFx.Core/App/Controls/IExternalRule.cs @@ -24,4 +24,4 @@ namespace Microsoft.PowerFx.Core.App.Controls void SetDelegationTrackerStatus(TexlNode node, DelegationStatus status, DelegationTelemetryInfo logInfo, TexlFunction func); } -} \ No newline at end of file +} diff --git a/src/libraries/Microsoft.PowerFx.Core/Binding/BindInfo/NameLookupInfo.cs b/src/libraries/Microsoft.PowerFx.Core/Binding/BindInfo/NameLookupInfo.cs index ff2644fde..06206c960 100644 --- a/src/libraries/Microsoft.PowerFx.Core/Binding/BindInfo/NameLookupInfo.cs +++ b/src/libraries/Microsoft.PowerFx.Core/Binding/BindInfo/NameLookupInfo.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. +using Microsoft.PowerFx.Core.Entities; using Microsoft.PowerFx.Core.Types; using Microsoft.PowerFx.Core.Utils; @@ -21,11 +22,12 @@ namespace Microsoft.PowerFx.Core.Binding.BindInfo /// it has the display name of the object in Data. /// public readonly DName DisplayName; + public readonly bool IsAsync; // Optional data associated with a name. May be null. public readonly object Data; - public NameLookupInfo(BindKind kind, DType type, DPath path, int upCount, object data = null, DName displayName = default) + public NameLookupInfo(BindKind kind, DType type, DPath path, int upCount, object data = null, DName displayName = default, bool isAsync = false) { Contracts.Assert(kind >= BindKind.Min && kind < BindKind.Lim); Contracts.Assert(upCount >= 0); @@ -37,6 +39,9 @@ namespace Microsoft.PowerFx.Core.Binding.BindInfo UpCount = upCount; Data = data; DisplayName = displayName; + + // Any connectedDataSourceInfo or option set or view needs to be accessed asynchronously to allow data to be loaded. + IsAsync = Data is IExternalTabularDataSource || Kind == BindKind.OptionSet || Kind == BindKind.View || isAsync; } } } diff --git a/src/libraries/Microsoft.PowerFx.Core/Binding/Binder.cs b/src/libraries/Microsoft.PowerFx.Core/Binding/Binder.cs index 890e974ec..3b6d4476b 100644 --- a/src/libraries/Microsoft.PowerFx.Core/Binding/Binder.cs +++ b/src/libraries/Microsoft.PowerFx.Core/Binding/Binder.cs @@ -3057,8 +3057,7 @@ namespace Microsoft.PowerFx.Core.Binding _txb.ErrorContainer.EnsureError(node, TexlStrings.ErrValueMustBeFullyQualified); } - // Any connectedDataSourceInfo or option set or view needs to be accessed asynchronously to allow data to be loaded. - if (lookupInfo.Data is IExternalTabularDataSource || lookupInfo.Kind == BindKind.OptionSet || lookupInfo.Kind == BindKind.View) + if (lookupInfo.IsAsync) { _txb.FlagPathAsAsync(node); }