- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
这就是我在控制台应用程序中使用 async/Task 的方式:
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace CaseDurableFunctionConsole
{
class Program
{
static async Task<List<string>> RunOrchestrator()
{
Console.WriteLine("Hello World!");
Console.ReadLine();
var outputs = new List<string>();
return outputs;
}
static void Main(string[] args)
{
RunOrchestrator();
}
}
}
这很好用,这是输出:
(即使不使用 await,它也会显示正确的结果。)
但是当我在 Azure Functions 中使用 async/Task 时,就像这样:
[FunctionName("Function1")]
public static async Task<List<string>> RunOrchestrator(
[OrchestrationClient] DurableOrchestrationClient orchestrationClient)
{
var outputs = new List<string>();
await Task.Delay(1);
return outputs;
}
然后启动后报错
[2019/11/25 5:50:50] Error indexing method 'Function1' [2019/11/255:50:50] Microsoft.Azure.WebJobs.Host: Error indexing method'Function1'. Microsoft.Azure.WebJobs.Host: Functions must return Taskor void, have a binding attribute for the return value, or betriggered by a binding that natively supports return values.
[2019/11/25 5:50:56] The 'Function1' function is in error:Microsoft.Azure.WebJobs.Host: Error indexing method 'Function1'.Microsoft.Azure.WebJobs.Host: Functions must return Task or void, havea binding attribute for the return value, or be triggered by a bindingthat natively supports return values.
如何通过修改我的功能代码来解决这个问题?
最佳答案
这与async-await
无关.
日志消息指出,对于该绑定(bind),该方法应返回 Task
或 void
并且您的方法返回 Task<List<string>>
.
您的函数方法不等于 RunOrchestrator
控制台应用程序中的方法。它等于 Main
方法。
关于c# - 为什么我在 Azure Function 中使用 async/Task 时出错,但在 Console App 中使用时却没有错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59025980/
已经有几个关于捕获或重定向 console.log 的问题: redirect Javascript syntax errors and console.log to somewhere else C
console.log(String(console.log('Not undefined')) === 'undefined'); console.log(String(console.log('N
我知道这是一个新手错误,但我不知道如何修复它。 public static void main (String args[]){ Console kitty = System.console(); S
我正在使用 Visual Studio 2015。 我试图打印一些语句只是为了跟踪一个非常长时间运行的测试。当使用 VSTest.Console 和/Logger:trx 时,调试输出(无论我们使用
这个问题在这里已经有了答案: Accessing console and devtools of extension's background.js (8 个回答) 5年前关闭。 我的 Chrome
我在括号中收到此错误。 我想强调一个事实,这是我第二次打开 JS 文件。 正如我强调的那样,我还想强调一个事实,即我不知道 Eslint 和 node.js 是什么。 StackOverflow 和其
我按照文档中的描述安装了 Drupal Console Launcher: curl https://drupalconsole.com/installer -L -o drupal.phar mv
Console.WriteLine() 和有什么区别和Trace.WriteLine() ? 最佳答案 从“调试”的角度来看这些。 我们开始使用 Console.WriteLine() 进行调试 后来
我一直在尝试连接到 serial console of a Raspberry Pi 3 with Android Things使用USB to TTL cable从我的 Linux (Ubuntu)
namespace Pro { class ErrorLog { public ErrorLog(RenderWindow app) {
以下代码是一个众所周知的示例,用于显示调试版本和发布版本之间的区别: using System; using System.Threading; public static class Program
if (open_date) { open_date = get_date_from_string(open_date); window.console && cons
在 Xcode 中工作时,我通常只为控制台打开一个单独的窗口,以便我可以看到尽可能多的输出行。我今天刚刚更新到 Xcode 12,在更新之前,您可以将编辑器 Pane 和控制台 Pane 之间的分隔线
在 Google Play Console 上,在所有应用程序的第一页,它会显示已安装的受众和用户获取。 我知道已安装的受众是在他们的设备上安装我的应用程序的受众。但什么是用户获取?通常,用户获取的数
Qt Quick uses qDebug执行日志记录,其中标准 Javascript 日志记录方法映射到 Qt 日志类型 console.log() -> qDebug() console.deb
Qt Quick uses qDebug执行日志记录,其中标准 Javascript 日志记录方法映射到 Qt 日志类型 console.log() -> qDebug() console.deb
我有以下代码: bool loop = true; LongbowWorkerThread Worker = new LongbowWorkerThread(); Th
我遇到了这两个 API,用于在 C# 的简单控制台应用程序中读取用户的输入: System.Console.ReadLine() System.Console.In.ReadLine() 这是一个我试
我是编程和 js 的新手,我正在尝试学习 javascript 的关键。 var obj1 = { name: 'rawn', fn: function() { con
using System; namespace ConsoleApplication1 { class Program { static void Main(strin
我是一名优秀的程序员,十分优秀!