Azure / Azure/Azure-Functions

ImplicitUsings enable gives ambiguous reference between 'System.Threading.ExecutionContext' and 'Microsoft.Azure.WebJobs.ExecutionContext'

Open
#2,097 3 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
PowerShell
Stars
1.1k
Forks
215
Avg merge
4h 2m
Merged PRs (30d)
1

Description

When binding to ExecutionContext and if ImplicitUsings is enabled, is there guideance on how this could be done without using a fully qualified reference to Microsoft.Azure.WebJobs.ExecutionContext? Whilst not strictly speaking a bug, and ImplicitUsings is not activated in the project templates, if would be nice if this name ambigiuty didn't lead people to disable implicit usings for Functions eg. by having new derived type FunctionExecutionContext. Or for this to be mentioned in documentation.

```
Error CS0104 'ExecutionContext' is an ambiguous reference between 'System.Threading.ExecutionContext' and 'Microsoft.Azure.WebJobs.ExecutionContext'
```

```


net6.0
v4
enable






PreserveNewest


PreserveNewest
Never

```

```
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;

namespace FunctionApp1
{
public static class Function1
{
[FunctionName("Function1")]
public static async Task Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
ExecutionContext context)
{
return new OkObjectResult(context.InvocationId);
}
}
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.