无法加载类型 'System.Diagnostics.DebuggerStepThroughAttribute'

Could not load type 'System.Diagnostics.DebuggerStepThroughAttribute'

我正在尝试在 .net 5 中创建一个 asynconus azure 函数,但是当它启动时出现以下错误:

[2020-11-16T10:41:06.023Z] A host error has occurred during startup operation '7cd2e743-b753-46ec-806e-d3b3dec14894'. [2020-11-16T10:41:06.026Z] System.Private.CoreLib: Could not load type 'System.Diagnostics.DebuggerStepThroughAttribute' from assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Value cannot be null. (Parameter 'provider')

我做的是:

  1. 在 Visual studio 中创建一个新的 Azure 函数项目。
  2. 通过用 asyc Task 替换 void 使函数异步
  3. 将目标框架更改为 .net 5.0
  4. (删除记录器以显示问题不存在)

Async 在 3.1 中正常工作知道如何解决这个问题吗?



点击放大

蔚蓝functions is currently not supported with .Net 5。微软计划在 2020 年底发布预览版。

所以你必须使用.Net Core 3.1。

// 编辑

.NET5 compatible Azure Functions .NET Worker 现已稳定发布。