private static async Task GetFunctionInfoFromPackageAsync(IFunctionIndex functionIndex, string functionName, string packageName, Action <IFunctionInfo, object> callback, object parameter)
        {
            IFunctionInfo fi = null;

            packageName = packageName ?? await functionIndex.GetPackageNameAsync(functionName);

            if (!string.IsNullOrEmpty(packageName))
            {
                fi = functionIndex.GetFunctionInfo(functionName, packageName);
            }
            await functionIndex.Services.MainThread().SwitchToAsync();

            callback(fi, parameter);
        }
        private static async Task GetFunctionInfoFromPackageAsync(IFunctionIndex functionIndex
                                                                  , string functionName
                                                                  , string packageName
                                                                  , Action <IFunctionInfo, object> callback
                                                                  , object parameter)
        {
            IFunctionInfo fi = null;

            packageName = packageName ?? await functionIndex.GetPackageNameAsync(functionName);

            if (!string.IsNullOrEmpty(packageName))
            {
                fi = await functionIndex.GetFunctionInfoAsync(functionName, packageName);
            }
            callback(fi, parameter);
        }
        public static async Task <IFunctionInfo> GetFunctionInfoAsync(this IFunctionIndex functionIndex, string functionName, string packageName = null)
        {
            var fi = functionIndex.GetFunctionInfo(functionName, packageName);

            if (fi != null)
            {
                return(fi);
            }

            packageName = await functionIndex.GetPackageNameAsync(functionName);

            if (!string.IsNullOrEmpty(packageName))
            {
                return(functionIndex.GetFunctionInfo(functionName, packageName));
            }

            return(null);
        }