Could not load type 'System.Diagnostics.DebuggerStepThroughAttribute'

Viewed 6701

I'm trying to make a asynconus azure function in .net 5 but when it start up i get the following error:

[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')

What i did is:

  1. create a new Azure function project in Visual studio.
  2. Make the function async by replacing void with asyc Task
  3. Change target framework to .net 5.0
  4. (Remove logger to show problem is not there)

Async works properly in 3.1 any idea how to resolve this issue?

Code + Console output

click to enlarge

1 Answers
Related