Azure / azure-functions-core-tools

Command line tools for Azure Functions
MIT License
1.3k stars 430 forks source link

Core Tools updates to use out-of-process host by default #3744

Open mattchenderson opened 2 months ago

mattchenderson commented 2 months ago

The Core Tools should switch to use the out-of-process host for out-of-process stacks. Today, it still uses the .NET 6 in-process host, unless it knows it needs to use the .NET 8 in-process host.

This item requires additional design. A few quick notes:

We should expect this to be at least a minor version bump.

aishwaryabh commented 1 month ago

This is the format we will be using: func <command> --runtime default|inproc6|inproc8

alesrosina commented 3 weeks ago

Is there a way to run in proc locally already? On Azure there is a env var that needs to be set FUNCTIONS_INPROC_NET8_ENABLED to 1.

Is this what you are talking about here? and when can we expect this function?

I'm interested, since from upgrade to .net 8 of our project I cannot develop locally on linux machine with this tools installed. Maybe I'm doing sth wrong, but on Windows it was resolved with grabing latest version.

Error configuring services in an external startup class. Microsoft.Azure.WebJobs.Extensions.OpenApi.Configuration.AppSettings: Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
A host error has occurred during startup operation 'c5b747ea-a46e-423c-aafe-969ea9df9f6e'.
Microsoft.Azure.WebJobs.Script: Error configuring services in an external startup class. Microsoft.Azure.WebJobs.Extensions.OpenApi.Configuration.AppSettings: Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

Value cannot be null. (Parameter 'provider')
mattchenderson commented 4 days ago

Is there a way to run in proc locally already? On Azure there is a env var that needs to be set FUNCTIONS_INPROC_NET8_ENABLED to 1.

Is this what you are talking about here? and when can we expect this function?

I'm interested, since from upgrade to .net 8 of our project I cannot develop locally on linux machine with this tools installed. Maybe I'm doing sth wrong, but on Windows it was resolved with grabing latest version.

Error configuring services in an external startup class. Microsoft.Azure.WebJobs.Extensions.OpenApi.Configuration.AppSettings: Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
A host error has occurred during startup operation 'c5b747ea-a46e-423c-aafe-969ea9df9f6e'.
Microsoft.Azure.WebJobs.Script: Error configuring services in an external startup class. Microsoft.Azure.WebJobs.Extensions.OpenApi.Configuration.AppSettings: Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

Value cannot be null. (Parameter 'provider')

@alesrosina To use the Core Tools with .NET 8 on the in-process model, you must provide the FUNCTIONS_INPROC_NET8_ENABLED setting in the local environment, typically through local.settings.json. You must also explicitly have FUNCTIONS_WORKER_RUNTIME set to "dotnet". There was an issue with Linux that was identified (#3766) which has since been addressed, though that does present a different error than the one you shared. Your error implies to me that a .NET 8 project is being loaded by a .NET 6 host. Regardless, I would recommend re-attempting your Linux tests with the latest version, and ensuring both of those settings are included in your local.settings.json. If you are still seeing something wrong after that, please open a new issue.

The work tracked by this item is separate, though it will introduce an additional option (the flag mentioned in Aishwarya's comment above) when invoking directly via the command line. When we originally introduced support for .NET 8 on the in-process model, we had to change some mechanics of how the Core Tools and the host interact. This work extends and generalizes those changes a bit. Other than the introduction of that new flag, we expect no changes for .NET 8 on the in-process model as a result of this.

alesrosina commented 3 days ago

FUNCTIONS_INPROC_NET8_ENABLED

@mattchenderson this was my issue, yes. I guess I've missed this somewhere, that this should be in local.settings.json. Thanks, it works now for me!