Azure / azure-functions-host

The host/runtime that powers Azure Functions
https://functions.azure.com
MIT License
1.93k stars 441 forks source link

Better logging, documentation and/or detection for 64-bit dependencies #8851

Open liliankasem opened 2 years ago

liliankasem commented 2 years ago

When a function app has 64-bit package dependencies and is triggered, you get a 404 error. Checking the function logs you can see the following error message:

The 'MyHttpFunction' function is in error: Could not load file or assembly

To fix this, users will need to update the platform to 64-bit in the configuration -> general settings tab in the portal. However, this is difficult for new function app users to troubleshoot. To help users better figure out the issue, we can:

FinVamp1 commented 1 year ago

Severity Code Description Project File Line Suppression State Warning MSB3270 There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "ImpactReactorTest", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project. MyTestAppDebug C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets 2352

MSBuild Mismatch

This should have appeared in the build output of the Rosyln steps rather than at runtime.

The Functions host uses AssemblyLoadContext to load the customer assemblies and this will not return an error but rather a FileNotFound exception.

"Typically don't throw. It's expected that these functions return null rather than throw when unable to find the requested dependency. Throwing will prematurely end the search and propagate an exception to the caller. Throwing should be restricted to unexpected errors like a corrupted assembly or an out of memory condition." Understanding AssemblyLoadContext