Azure / azure-functions-host

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

Debug output: Metadata generation failed. Exit code: '-1073741818' #5847

Closed euo closed 3 years ago

euo commented 4 years ago

I'm trying a simple Azure Function in VS 2019 but getting the following error when debugging.

Environment:

Microsoft Visual Studio Community 2019 Version 16.5.0 VisualStudio.16.Release/16.5.0+29911.84 Microsoft .NET Framework Version 4.8.03752

Microsoft.Azure.WebJobs.Extensions.CosmosDB 3.0.5 Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator 1.1.6\ Microsoft.NET.Sdk.Functions 3.0.1

Microsoft Azure Cosmos Emulator 2.9.2.0

Repro steps

  1. Create new Azure Function project in Visual Studio.
  2. Update local.settings.json with Cosmos connection string
  3. Verify that Cosmos database, collection, connectionString are correct in Function1.cs
  4. Ensure MyCosmosDB database and Games collection exists in CosmosDB
  5. Hit F5 to debug

Expected behavior

Should build and debug without error.

Actual behavior

1>------ Build started: Project: CosmosFunctions, Configuration: Debug Any CPU ------ 1>CosmosFunctions -> D:\source\CosmosFunctions\bin\Debug\netcoreapp3.0\bin\CosmosFunctions.dll 1>Debug output from extension.json generator: 1> 1>C:\Users\mario.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.1.6\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets(44,5): error : Metadata generation failed. Exit code: '-1073741818' Error: '' 1>Done building project "CosmosFunctions.csproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Known workarounds

Tried steps and work around made by other developers here: #4055 #4578 #5229

Related information

Provide any related information


public static class GamesFunction
    {
        [FunctionName("Games_OnStatusFinalized")]
        public static void Run([CosmosDBTrigger(
            databaseName: "MyCosmosDB",
            collectionName: "Games",
            ConnectionStringSetting = "CosmosDBConn",
            LeaseCollectionName = "leases",
            CreateLeaseCollectionIfNotExists =true,
            LeaseCollectionPrefix ="")]IReadOnlyList<Document> input, ILogger log)
        {
            if (input != null && input.Count > 0)
            {
                log.LogInformation("Documents modified " + input.Count);
                log.LogInformation("First document Id " + input[0].Id);
            }
        }
    }
</details>

<details>
<summary>Source</summary>

```json
{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet",
    "CosmosDBConn": "AccountEndpoint=https://localhost:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="
  },
  "Host": {
    "LocalHttpPost": 7071,
    "CORS": "http://localhost:3872",
    "CORSCredentials": true
  }
}</details>
kashimiz commented 4 years ago

Hi @euo, thank you for reporting this issue. My apologies for the delayed reply. Can you share your *.csproj file?

ghost commented 4 years ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

euo commented 4 years ago

Thanks for the response, @kashimiz.

here's my project file:

`

netcoreapp3.0 v3 PreserveNewest PreserveNewest Never

`

ThejaChoudary commented 4 years ago

@kashimiz can you please look into this further.

v-anvari commented 4 years ago

Hi @euo, I have tried to reproduce the scenario with the latest packages, but was able to build successfully. Let us know if you are still facing the same issue with build.

========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ========== microsoft.net.sdk.functions\3.0.7

ghost commented 3 years ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

v-anvari commented 3 years ago

Please feel free to re-open the issue if the issues re-occur