Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not load type 'System.Diagnostics.DebuggerStepThroughAttribute'

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

like image 645
Erwin6 Avatar asked Sep 01 '26 03:09

Erwin6


1 Answers

Azure functions is currently not supported with .Net 5. Microsoft plans to release a preview at end of 2020.

So you have to use .Net Core 3.1.

// Edit

A .NET5 compatible Azure Functions .NET Worker is now released as stable.

like image 147
magicandre1981 Avatar answered Sep 04 '26 15:09

magicandre1981



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!