question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Could not evaluate 'Cosmos.CRTCompat.dll' for extension metadata. Exception message: Bad IL format.

See original GitHub issue

As discussed in https://github.com/Azure/azure-functions-vs-build-sdk/issues/287 I get the following error messages when deploying an Azure Function:

2>Moving file from "C:\Users\z002m76a\Desktop\ErrorExample\ErrorExample\obj\Release\netcoreapp3.1\PubTmp\Out\ErrorExample.pdb" to "C:\Users\z002m76a\Desktop\ErrorExample\ErrorExample\obj\Release\netcoreapp3.1\PubTmp\Out\bin\ErrorExample.pdb".
2>Microsoft.NET.Sdk.Functions.Generator.dll "C:\Users\z002m76a\Desktop\ErrorExample\ErrorExample\obj\Release\netcoreapp3.1\PubTmp\Out\bin\ErrorExample.dll " "C:\Users\z002m76a\Desktop\ErrorExample\ErrorExample\obj\Release\netcoreapp3.1\PubTmp\Out\ " "False "
2>Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.Console.dll "C:\Users\z002m76a\Desktop\ErrorExample\ErrorExample\obj\Release\netcoreapp3.1\PubTmp\Out\bin" "C:\Users\z002m76a\Desktop\ErrorExample\ErrorExample\obj\Release\netcoreapp3.1\PubTmp\Out\bin\extensions.json"
2>    Could not evaluate 'Cosmos.CRTCompat.dll' for extension metadata. Exception message: Bad IL format.
2>    Could not evaluate 'Microsoft.Azure.Cosmos.ServiceInterop.dll' for extension metadata. Exception message: Bad IL format.

Please find in the following my .csproj file:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <AzureFunctionsVersion>v3</AzureFunctionsVersion>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.Azure.Cosmos" Version="3.6.0" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.3" />
  </ItemGroup>
  <ItemGroup>
    <None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup>
</Project>

The function itself comes directly from the template generator:

using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Logging;

namespace ErrorExample
{
    public static class Function
    {
        [FunctionName("Function")]
        public static void Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer, ILogger log)
        {
            log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
        }
    }
}

host.json looks the following:

{
    "version": "2.0"
}

I’m running


Microsoft Visual Studio Professional 2019
Version 16.4.4
VisualStudio.16.Release/16.4.4+29728.190
Microsoft .NET Framework
Version 4.8.03761

Installed Version: Professional

Visual C++ 2019   00435-60000-00000-AA544
Microsoft Visual C++ 2019

ADL Tools Service Provider   1.0
This package contains services used by Data Lake tools

ASA Service Provider   1.0

ASP.NET and Web Tools 2019   16.4.460.23317
ASP.NET and Web Tools 2019

ASP.NET Web Frameworks and Tools 2019   16.4.460.23317
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   16.4.460.23317
Azure App Service Tools v3.0.0

Azure Data Lake Node   1.0
This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio   2.4.5000.0
Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools   16.4.460.23317
Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio   2.4.5000.0
Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools   3.4.1-beta4-19614-01+165046097562cfe65b09c2e9a9d8f7cd88526f2c
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

ConfigurationTransform   1.3
Automatically transform app.config during build process. Once the transformation is set, it will run on other build machines without the extension.

Fabric.DiagnosticEvents   1.0
Fabric Diagnostic Events

GitHub.VisualStudio   2.10.8.8132
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

IncrediBuild Build Acceleration   1.5.0.10
IncrediBuild effectively reduces compilation and development times by up to 90%.

IntelliCode Extension   1.0
IntelliCode Visual Studio Extension Detailed Info

Microsoft Azure HDInsight Azure Node   2.4.5000.0
HDInsight Node under Azure Node

Microsoft Azure Hive Query Language Service   2.4.5000.0
Language service for Hive query

Microsoft Azure Service Fabric Tools for Visual Studio   16.0
Microsoft Azure Service Fabric Tools for Visual Studio

Microsoft Azure Stream Analytics Language Service   2.4.5000.0
Language service for Azure Stream Analytics

Microsoft Azure Stream Analytics Node   1.0
Azure Stream Analytics Node under Azure Node

Microsoft Azure Tools   2.9
Microsoft Azure Tools for Microsoft Visual Studio 2019 - v2.9.21016.1

Microsoft Continuous Delivery Tools for Visual Studio   0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager   2.0.87+gbb515bf382
Install client-side libraries easily to any web project

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards   1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio Tools for Containers   1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Microsoft Visual Studio VC Package   1.0
Microsoft Visual Studio VC Package

NuGet Package Manager   5.4.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Office Developer Tools for Visual Studio   16.0.29417.02
Microsoft Office Developer Tools for Visual Studio

ProjectServicesPackage Extension   1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

SQL Server Data Tools   16.0.61912.09160
Microsoft SQL Server Data Tools

Syntax Visualizer   1.0
An extension for visualizing Roslyn SyntaxTrees.

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TypeScript Tools   16.0.11031.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   3.4.1-beta4-19614-01+165046097562cfe65b09c2e9a9d8f7cd88526f2c
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 10.4 for F# 4.6   16.4.0-beta.19556.5+e7597deb7042710a7142bdccabd6f92b0840d354
Microsoft Visual F# Tools 10.4 for F# 4.6

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Container Tools Extensions (Preview)   1.0
View, manage, and diagnose containers within Visual Studio.

Visual Studio Tools for Containers   1.0
Visual Studio Tools for Containers

Visual Studio Tools for Kubernetes   1.0
Visual Studio Tools for Kubernetes

Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:25 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
jbeekocommented, Mar 4, 2020

We see something very similar but because they are only warnings the publishing seems to go ahead without issue:

C:\Users\developer\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.1.4\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets(63,5): warning :     Could not 
evaluate 'Cosmos.CRTCompat.dll' for extension metadata. Exception message: Bad IL format. [C:\Users\developer\Documents\GitHub\Seymour\src\Seymour.Api.Internal\Seymour.Api.Internal.fsproj]
C:\Users\developer\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.1.4\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets(63,5): warning :     Could not 
evaluate 'Microsoft.Azure.Cosmos.ServiceInterop.dll' for extension metadata. Exception message: Bad IL format. [C:\Users\developer\Documents\GitHub\Seymour\src\Seymour.Api.Internal\Seymour.Api.Internal.fsproj]
3reactions
bstokedcommented, Mar 3, 2020

Any word on this? I’m getting these errors only when publishing to Azure. The code runs fine locally. Seriously need a workaround or a fix, or my entire claim to my company that serverless services is the way to go for what we are doing is out the window.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not evaluate 'Cosmos.CRTCompat.dll' for extension ...
Could not evaluate 'Cosmos.CRTCompat.dll' for extension metadata. Exception message: Bad IL format. Could not evaluate 'Microsoft.Azure.
Read more >
Could not evaluate &#39;Cosmos.CRTCompat.dll&#39
Coding example for the question Could not evaluate 'Cosmos.CRTCompat.dll' for extension metadata. Exception message: Bad IL format.
Read more >
System.BadImageFormatException: An attempt was made ...
I wrote an azure function and use a 3rd party dll file using dllimport. When I debugged the code, I am getting the...
Read more >
Untitled
... azure function in Visual Studio 2019. Could not evaluate 'Cosmos.CRTCompat.dll' for extension metadata. Exception message: Bad IL format. Could not ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found