CosmosDBTrigger:对象引用未设置为对象的实例

CosmosDBTrigger: Object reference not set to an instance of an object

当我尝试使用 CosmosDBTrigger 执行新创建的 azure 函数时,使用 cosmosdb 触发器时出现上述函数异常

调查资料

环境: Visual Studio 2017 15.3.5

引用的包:

重现问题的步骤

提供重现问题所需的步骤:

这是代码示例

    public static class AddEventInEventStore
    {
        [FunctionName("AddEventInEventStore")]
        public static void Run([CosmosDBTrigger("db", "Items",
            ConnectionStringSetting = "AzureWebJobsDocumentDBConnectionString",
            LeaseCollectionName = "leases", LeaseDatabaseName = "db"
            )]
            IReadOnlyList<Document> changeList, TraceWriter log)
        {
            if (changeList != null && changeList.Count > 0)
            {
                log.Verbose("Documents modified " + changeList.Count);
                foreach (var change in changeList)
                {
                    log.Verbose("First document Id " + change.Id);
                }
            }

        }
    }

更新您的 Azure Functions 和 Web 作业工具(工具 -> 扩展和更新)。

我可以看到您使用的是 1.0.0 版本(控制台标题),而 1.0.4 已经可用。