Azure / Azure/azure-functions-openapi-extension

Code Analysis does not generate build time errors when package added

Open
#676 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
388
Forks
202
PR merge metrics
No merged PRs in 30d

Description

**Describe the issue**
Code analysis does not run when this package is in use

**To Reproduce**
Steps to reproduce the behavior:
1. `func init --worker-runtime "dotnet-isolated" --target-framework "net8.0"`
2. `func new --name "HelloWorldFunction" --template "HTTP trigger"`
3. Add to csproj:
```
latest
All
false
true
true
true
```
5. Build and should correctly see error `error CA1848: For improved performance, use the LoggerMessage delegates instead of calling 'LoggerExtensions.LogInformation`
6. Now add ``
7. Build, and CA error is not displayed

Full CS proj
```


net8.0
v4
Exe
enable
enable

latest
All
false
true
true
true
















```

Comment out `` and the CA correctly errors.

Expected build time error:

```
Build FAILED.

HelloWorldFunction.cs(21,13): error CA1848: For improved performance, use the LoggerMessage delegates instead of calling 'LoggerExtensions.LogInformation(ILogger, string?, params object?[])' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1848) [isolated.csproj]
0 Warning(s)
1 Error(s)
```

**Environment (please complete the following information, if applicable):**
- OS: Ubuntu 24
- Browser n/a
- SDK 8.0.110

**Additional context**
Add any other context about the problem here.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue in the net8.0 dotnet-isolated project described in the report, using the listed csproj settings and Microsoft.Azure.Functions.Worker.Extensions.OpenApi 1.5.1 package reference. Compare the build with and without that reference, focusing on why CA1848 is suppressed; done means the expected CA1848 build error appears while the package remains installed.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.