I had the latest nuget packages in my project, however after i rolled back the version of Microsoft.Azure.Functions.Worker.Sdk to 1.15.1 from 1.16.2, i can now get the function app to run locally and after publishing it to Azure resources.
When a colleague of mine created a new project on his machine it added the 1.15.1 nuget package and ran successfully, then found below solution to use latest package but with a FunctionsEnableWorkerIndexing attribute in the project file.
https://github.com/Azure/azure-functions-dotnet-worker/issues/2072