question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Updating to .NET 6 causes "The host has not yet started" with VS2019/VS2022

See original GitHub issue

Updating a sample to .NET 6 and updating all the dependencies to latest causes an F5 of VS2019/VS2022 to create an error “The host has not yet started”.

Output of VS2019 console

Azure Functions Core Tools
Core Tools Version:       3.0.3904 Commit hash: c345f7140a8f968c5dbc621f8a8374d8e3234206  (64-bit)
Function Runtime Version: 3.3.1.0

[2021-12-01T20:20:36.411Z] Found C:\git_ws\MaximRouiller\durablefunctions-apiscraping-dotnet\FanOutFanInCrawler\FanOutFanInCrawler.csproj. Using for user secrets file configuration.
[2021-12-01T20:20:43.322Z] A host error has occurred during startup operation '00fc43ca-ad44-4784-9f36-36f4d730e4b0'.
[2021-12-01T20:20:43.324Z] System.Private.CoreLib: Could not load type 'System.Diagnostics.DebuggerStepThroughAttribute' from assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

C:\Users\marouill\AppData\Local\AzureFunctionsTools\Releases\3.30.1\cli_x64\func.exe (process 29280) exited with code -1.

Repro steps

Press F5 in VS2019/VS2022 with the following configured.

csproj file

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <AzureFunctionsVersion>v3</AzureFunctionsVersion>
    <ProjectGuid>{CDA8125A-295E-4918-9FA4-70D4BEE685AA}</ProjectGuid>
    <RootNamespace>FanOutFanInCrawler</RootNamespace>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="2.6.0" />    
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.13" />
    <PackageReference Include="Octokit" Version="0.50.0" />
  </ItemGroup>
  <ItemGroup>
    <None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup>
</Project>

local.settings.json

{
  "IsEncrypted": false,
  "Values": {
    "FUNCTIONS_WORKER_RUNTIME": "dotnet",
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "AzureWebJobsDashboard": "UseDevelopmentStorage=true",
    "GitHubToken": "YOUR TOKEN HERE"
  }
}

host.json

{
  "version":  "2.0"
}

Expected behavior

Output when running from the CLI

❯ func host start
Microsoft (R) Build Engine version 17.0.0+c9eb9dd64 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  All projects are up-to-date for restore.
  FanOutFanInCrawler -> C:\git_ws\MaximRouiller\durablefunctions-apiscraping-dotnet\FanOutFanInCrawler\bin\output\FanOutFanInCrawler.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:23.24



Azure Functions Core Tools
Core Tools Version:       4.0.3971 Commit hash: d0775d487c93ebd49e9c1166d5c3c01f3c76eaaf  (64-bit)
Function Runtime Version: 4.0.1.16815

[2021-12-01T20:25:43.291Z] Found C:\git_ws\MaximRouiller\durablefunctions-apiscraping-dotnet\FanOutFanInCrawler\FanOutFanInCrawler.csproj. Using for user secrets file configuration.
[2021-12-01T20:25:48.427Z] The Dashboard setting is no longer supported. See https://aka.ms/functions-dashboard for details.

Functions:

        Orchestrator_HttpStart: [GET,POST] http://localhost:7071/api/Orchestrator_HttpStart

        GetAllRepositoriesForOrganization: activityTrigger

        GetOpenedIssues: activityTrigger

        Orchestrator: orchestrationTrigger

        SaveRepositories: activityTrigger

For detailed output, run func with --verbose flag.
[2021-12-01T20:26:05.355Z] Host lock lease acquired by instance ID '0000000000000000000000008A97D92D'.

Actual behavior

Output of VS2019 console

Azure Functions Core Tools
Core Tools Version:       3.0.3904 Commit hash: c345f7140a8f968c5dbc621f8a8374d8e3234206  (64-bit)
Function Runtime Version: 3.3.1.0

[2021-12-01T20:20:36.411Z] Found C:\git_ws\MaximRouiller\durablefunctions-apiscraping-dotnet\FanOutFanInCrawler\FanOutFanInCrawler.csproj. Using for user secrets file configuration.
[2021-12-01T20:20:43.322Z] A host error has occurred during startup operation '00fc43ca-ad44-4784-9f36-36f4d730e4b0'.
[2021-12-01T20:20:43.324Z] System.Private.CoreLib: Could not load type 'System.Diagnostics.DebuggerStepThroughAttribute' from assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

C:\Users\marouill\AppData\Local\AzureFunctionsTools\Releases\3.30.1\cli_x64\func.exe (process 29280) exited with code -1.

Known workarounds

Running in the CLI to force the Azure Functions Core Tools to run with the 4.X version.

Related information

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

11reactions
paulbatumcommented, Dec 3, 2021

The csproj needs to have <AzureFunctionsVersion>v4</AzureFunctionsVersion> . You’ll need to run in VS 2022 (.NET 6 is not supported in VS 2019).

1reaction
DavidCubelacommented, Jan 12, 2023

I managed to run the project from the Azure Cli, however, running the same thing from inside VS 2022 does not work and shows a “The host has not yet started” error. Seems to be either the problem of missing dependency or something else.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure function not running after upgrade to dotnet net6 ...
After upgrading my azure functions from dotnet core 3.1 to net6 the function is not starting. The package I reference is more recent...
Read more >
NET7 Azure Functions: the host has not yet started
NET7 Azure Functions: the host has not yet started. I want to debug on my laptop a project with Azure Functions. The language...
Read more >
Solving Azure Functions and WebJobs Tools update issue ...
When I have a Serverless Openhack with our customers, we encounter the updating issue of the Azure Functions and WebJobs tools of the...
Read more >
Creating Azure Functions with .NET 6 in Isolated Process
This command starts all the functions you have in the project. If you want to run a specific function, enter: func host start...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found