LeeSanderson / Azure.Functions.Testing

Integration testing helper library for Azure Functions in the style of WebApplicationFactory (Microsoft.AspNetCore.Mvc.Testing)
MIT License
1 stars 1 forks source link

func.exe fails to start with exit code 1 after updating Azure Functions Core Tools to 4.0.5413 #5

Closed MvO-Codurance closed 11 months ago

MvO-Codurance commented 11 months ago

Something seems to have changed between Azure Function Core Tools between v4.0.5390 and 4.0.5413. Whilst the former version works fine, the latter fails to start func.exe with the following error:

'func' failed to start (Exited prematurely with exit code 1). Check log for more details

(not quite sure what log the message is referring to)

In my fork linked below I have added a new test to ensure func.exe starts if the project folder is valid. Debugging this new test and setting a breakpoint on https://github.com/LeeSanderson/Azure.Functions.Testing/blob/37f5b0b17aba13d89df396b334895965f901894a/Src/Azure.Functions.Testing/Executable.cs#L113 yields a number of errors, the first being:

Can't determine project language from files. Please use one of [--csharp, --javascript, --typescript, --java, --python, --powershell, --custom]

Adding --csharp to the options at https://github.com/LeeSanderson/Azure.Functions.Testing/blob/37f5b0b17aba13d89df396b334895965f901894a/Src/Azure.Functions.Testing/FunctionApplicationFactory.cs#L32 then yields the next error:

System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Azure.WebJobs.Script.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3c5b9424214e8f8c'. The system cannot find the file specified.

My fork is at this point: https://github.com/MvO-Codurance/Azure.Functions.Testing

I will try to look into this further when I get more time but wanted to flag it up here as well.

For now the workaround is to roll back to Azure Function Core Tools v4.0.5390.

Azure Function Core Tools releases: https://github.com/Azure/azure-functions-core-tools/releases

MvO-Codurance commented 11 months ago

Ok, so it seems like the Azure Function Core Tools like to be uninstalled and then installed afresh, rather than installing over the top of an existing installation (on Windows). Doing an uninstall then install makes everything work fine again. (sigh)

LeeSanderson commented 11 months ago

Ah. Thanks @MvO-Codurance . Good to know that a reinstall fixes the problem.