After upgrading Microsoft.NET.Sdk.Functions from 3.0.9 to 3.0.11, I'm seeing new warnings on build locally in Visual Studio:
>C:\Users\Noah\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.2.0\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets(37,5): warning : Could not evaluate 'Cosmos.CRTCompat.dll' for extension metadata. Exception message: Format of the executable (.exe) or library (.dll) is invalid.
>C:\Users\Noah\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.2.0\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets(37,5): warning : Could not evaluate 'Magick.Native-Q8-x64.dll' for extension metadata. Exception message: Format of the executable (.exe) or library (.dll) is invalid.
>C:\Users\Noah\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.2.0\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets(37,5): warning : Could not evaluate 'Microsoft.Azure.Cosmos.ServiceInterop.dll' for extension metadata. Exception message: Format of the executable (.exe) or library (.dll) is invalid.
>C:\Users\Noah\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.2.0\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets(37,5): warning : Could not evaluate 'Microsoft.Azure.Documents.ServiceInterop.dll' for extension metadata. Exception message: Format of the executable (.exe) or library (.dll) is invalid.
There were no such warnings with 3.0.9, which has worked perfectly. Here are my project settings:
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
<PlatformTarget>x64</PlatformTarget>
<Nullable>enable</Nullable>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
</PropertyGroup>
I'm targeting x64 and Windows specifically to avoid generating Linux/macos runtime & native folders and DLLs in the build output, which doubles the publish size. It's not for a self-contained deployment, as CI publish uses --self-contained false.
Reverting to 3.0.9 resolves the warnings. Happy to provide additional info that can help.
A minimal repro, consisting of empty project with one dependency (Magick.NET x64) and PlatformTarget + RuntimeIdentifier configured for project:
I just ran into this as well. {{slaps hand for choosing latest}}.
@madelinegordon Able to repro the Issue.Can you please look into this further.
1>BuildWarningRepro -> C:\BuildWarningRepro\BuildWarningRepro\bin\Debug\netcoreapp3.1\win10-x64\BuildWarningRepro.dll
1>C:\Users\v-thek\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.2.0\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets(37,5): warning : Could not evaluate 'Cosmos.CRTCompat.dll' for extension metadata. Exception message: Format of the executable (.exe) or library (.dll) is invalid.
1>C:\Users\v-thek\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.2.0\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets(37,5): warning : Could not evaluate 'Magick.Native-Q8-x64.dll' for extension metadata. Exception message: Format of the executable (.exe) or library (.dll) is invalid.
1>C:\Users\v-thek\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.2.0\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets(37,5): warning : Could not evaluate 'Microsoft.Azure.Cosmos.ServiceInterop.dll' for extension metadata. Exception message: Format of the executable (.exe) or library (.dll) is invalid
We ran into this issue as well and had to downgrade to 3.0.9. (Warnings are bad and we don't want to have them :-)
In version 3.0.10 the issue exists too.
Would be nice if there would be a fix as soon as possible.
Tagging @fabiocav , for more insights here.
1>BuildWarningRepro -> C:\BuildWarningRepro\BuildWarningRepro\bin\Debugnetcoreapp3.1\win10-x64\BuildWarningRepro.dll 1>C:\Users\v-thek.nuget\packagesmicrosoft.azure.webjobs.script.extensionsmetadatagenerator\1.2.0\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets(37,5): warning : Could not evaluate 'Cosmos.CRTCompat.dll' for extension metadata. Exception message: Format of the executable (.exe) or library (.dll) is invalid. 1>C:\Users\v-thek.nuget\packagesmicrosoft.azure.webjobs.script.extensionsmetadatagenerator\1.2.0\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets(37,5): warning : Could not evaluate 'Magick.Native-Q8-x64.dll' for extension metadata. Exception message: Format of the executable (.exe) or library (.dll) is invalid. 1>C:\Users\v-thek.nuget\packagesmicrosoft.azure.webjobs.script.extensionsmetadatagenerator\1.2.0\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets(37,5): warning : Could not evaluate 'Microsoft.Azure.Cosmos.ServiceInterop.dll' for extension metadata. Exception message: Format of the executable (.exe) or library (.dll) is invalid
Adding to sprint 91 so we can take a closer look. This looks like exceptions logged by the metadata generator.
Apologies for the delay on this. Assigning to sprint 93 for investigation.
We have warnings-as-errors so this breaks our build.
What is the impact of these warnings? Is something broken or is it okay to upgrade and supress them?
Also seeing these warnings in a .NET 5 functions app... ok to ignore?
I created an issue for the same problem over here...
https://github.com/Azure/azure-functions-vs-build-sdk/issues/487
Not sure which repo it belongs in? Anyway, the same problem popped up in an earlier SDK version, and was fixed in v3.0.7. This appears to be a regression in v3.0.10.
Earlier issue that resulted in v3.0.7 fix...
https://github.com/Azure/azure-functions-host/issues/5963
@fabiocav Any news on that?
@fabiocav Any news on your Sprint 93? Maybe this is a very long sprint? 馃檪
@fabiocav +1 for a fix to this
+1 for fix to this
I hit the same issue and after some investigation I think this change is the root cause
https://github.com/Azure/azure-functions-host/commit/8ee1fb5af64a7d9311e73d486385068e683805a0#diff-a11275288a9a75bece2473411c40dbffbd2dddb303e3b932d123995861752786L55
Before
catch (Exception ex) when (ex is FileNotFoundException || ex is BadImageFormatException)
{
// Don't log this as an error. This will almost always happen due to some publishing artifacts (i.e. Razor) existing in the
// functions bin folder without all of their dependencies present, or native package artifacts being copied to the bin folder
// These will almost never have Functions extensions, so we don't want to write out errors every time there is a build.
// This message can be seen with detailed logging enabled.
logger.LogMessage($"Could not evaluate '{Path.GetFileName(path)}' for extension metadata. If this assembly contains a Functions extension, ensure that all dependent assemblies exist in '{sourcePath}'. If this assembly does not contain any Functions extensions, this message can be ignored. Exception message: {ex.Message}");
}
After
catch (Exception ex)
{
logger.LogError($"Could not evaluate '{Path.GetFileName(path)}' for extension metadata. Exception message: {ex.Message}");
}
Probably the original reason of log message still stands?
If this is the root cause it'd be nice to know what we can do to remove the warnings... No枚ne uses Razor (statistically speaking) and so it seems bad to include some kludge code that accepts Razor when one man and his dog uses it.
Seeing as we're now almost half a year away from when this issue was raised I feel some solution should be imminent but then I know Microsoft and the only solution would be to downgrade packages and ignore the newer ones.
I feel like this is an easy fix to get rid of warnings. When can we expect to have this resolved? Our solution now has hundreds of warnings with no way of hiding them.
Most helpful comment
@fabiocav Any news on that?