Skip to content

Commit 6eb8998

Browse files
jviausurgupta-msftliliankasemfabiocavsatvu
authored
Prep Extensions.Rpc release: merge main into release/main (#2805)
* Generators package version update (#2755) * Generator tests: Add transitive dependency for System.Text.Json v8.0.5 & bump extension versions (#2760) * Fixing Function Executor test * Refactor WebJobs extension info (#2762) * skipBuildTagsForGitHubPullRequests when the PR is a fork (#2770) * Bump System.Text.Json from 8.0.4 to 8.0.5 in /host/src/FunctionsNetHost (#2768) Bumps [System.Text.Json](https://github.com/dotnet/runtime) from 8.0.4 to 8.0.5. - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](dotnet/runtime@v8.0.4...v8.0.5) --- updated-dependencies: - dependency-name: System.Text.Json dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * re-use FunctionsWorkerApplicationBuilder if called multiple times (#2774) * Add worker extension validation to CI (#2764) * ignore rider temp files * Support SignalR trigger return value (#2771) * add skipBuildTagsForGitHubPullRequests for extensions (#2779) * Fix typos in CI referencing test projects (#2773) * Adding a null check before initiating the internal Activity (#2765) * Adding a null check for the internal Activity. * Bump System.Text.Json to 8.0.5 (#2783) * Use full namespace for Task.FromResult in function metadata provider generator to avoid namespace conflict (#2681) * Analyzer for Multiple-Output Binding Scenarios with ASP.NET Core Integration (#2706) * Remove documentation tag (#2751) The parameter does not exist. * Update global.json .net8 value (#2795) * initial fix of duplicate registrations if AddFunctionsWorkerCore called twice (#2790) * Ignoring fatal exceptions in InvocationHandler (#2789) * Update nethost global json, update sample (#2797) * Set extension RPC max message length (#2772) * Set max message length for RPC client * Update Rpc version and release notes * Update packages (#2800) --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Surbhi Gupta <[email protected]> Co-authored-by: Lilian Kasem <[email protected]> Co-authored-by: Fabio Cavalcante <[email protected]> Co-authored-by: sarah <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Brett Samblanet <[email protected]> Co-authored-by: Simon Cropp <[email protected]> Co-authored-by: yzt <[email protected]> Co-authored-by: Rohit Ranjan <[email protected]> Co-authored-by: David Lee <[email protected]> Co-authored-by: Jonathan <[email protected]>
1 parent 6a324b7 commit 6eb8998

File tree

99 files changed

+1468
-153
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+1468
-153
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,3 +364,4 @@ Migrations/
364364
local.settings.json
365365
/tools/localpack.ps1
366366
/.vscode
367+
/.idea

Directory.Build.props

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,14 @@
55
<SuppressTfmSupportBuildWarnings Condition="'$(TargetFramework)' == 'net5.0'">true</SuppressTfmSupportBuildWarnings>
66
</PropertyGroup>
77

8+
<PropertyGroup>
9+
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
10+
<EngRoot>$(RepoRoot)eng/</EngRoot>
11+
<TargetsRoot>$(EngRoot)build/</TargetsRoot>
12+
</PropertyGroup>
13+
14+
<PropertyGroup Condition="'$(TF_BUILD)' == 'true'">
15+
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
16+
</PropertyGroup>
17+
818
</Project>

docs/analyzer-rules/AZFW0014.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# AZFW0011: Missing Registration for ASP.NET Core Integration
1+
# AZFW0014: Missing Registration for ASP.NET Core Integration
22

33
| | Value |
44
|-|-|

docs/analyzer-rules/AZFW0015.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# AZFW0015: Missing HttpResult attribute for multi-output function
2+
3+
| | Value |
4+
|-|-|
5+
| **Rule ID** |AZFW00015|
6+
| **Category** |[Usage]|
7+
| **Severity** |Error|
8+
9+
## Cause
10+
11+
This rule is triggered when a multi-output function is missing a `HttpResultAttribute` on the HTTP response type.
12+
13+
## Rule description
14+
15+
For [functions with multiple output bindings](https://learn.microsoft.com/en-us/azure/azure-functions/dotnet-isolated-process-guide?tabs=windows#multiple-output-bindings) using ASP.NET Core integration, the property correlating with the HTTP response needs to be decorated with the `HttpResultAttribute` in order to write the HTTP response correctly. Properties of the type `HttpResponseData` will still have their responses written correctly.
16+
17+
## How to fix violations
18+
19+
Add the attribute `[HttpResult]` (or `[HttpResultAttribute]`) to the relevant property. Example:
20+
21+
```csharp
22+
public static class MultiOutput
23+
{
24+
[Function(nameof(MultiOutput))]
25+
public static MyOutputType Run([HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequest req,
26+
FunctionContext context)
27+
{
28+
...
29+
}
30+
}
31+
32+
public class MyOutputType
33+
{
34+
[QueueOutput("myQueue")]
35+
public string Name { get; set; }
36+
37+
[HttpResult]
38+
public IActionResult HttpResponse { get; set; }
39+
}
40+
```
41+
42+
## When to suppress warnings
43+
44+
This rule should not be suppressed because this error will prevent the HTTP response from being written correctly.

docs/analyzer-rules/AZFW0016.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# AZFW0016: Missing HttpResult attribute for multi-output function
2+
3+
| | Value |
4+
|-|-|
5+
| **Rule ID** |AZFW00016|
6+
| **Category** |[Usage]|
7+
| **Severity** |Warning|
8+
9+
## Cause
10+
11+
This rule is triggered when a multi-output function using `HttpResponseData` is missing a `HttpResultAttribute` on the HTTP response type.
12+
13+
## Rule description
14+
15+
Following the introduction of ASP.NET Core integration, for [functions with multiple output bindings](https://learn.microsoft.com/en-us/azure/azure-functions/dotnet-isolated-process-guide?tabs=windows#multiple-output-bindings), the property in a custom output type correlating with the HTTP response is expected to be decorated with the `HttpResultAttribute`.
16+
17+
`HttpResponseData` does not require this attribute for multi-output functions to work because support for it was available before the introduction of ASP.NET Core Integration. However, this is the expected convention moving forward as all other HTTP response types in this scenario will not work without this attribute.
18+
19+
## How to fix violations
20+
21+
Add the attribute `[HttpResult]` (or `[HttpResultAttribute]`) to the relevant property. Example:
22+
23+
```csharp
24+
public static class MultiOutput
25+
{
26+
[Function(nameof(MultiOutput))]
27+
public static MyOutputType Run([HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequestData req,
28+
FunctionContext context)
29+
{
30+
...
31+
}
32+
}
33+
34+
public class MyOutputType
35+
{
36+
[QueueOutput("myQueue")]
37+
public string Name { get; set; }
38+
39+
[HttpResult]
40+
public HttpResponseData HttpResponse { get; set; }
41+
}
42+
```
43+
44+
## When to suppress warnings
45+
46+
This rule can be suppressed if there is no intention to migrate from `HttpResponseData` to other types (like `IActionResult`).

eng/build/WorkerExtensions.targets

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<Project>
2+
<PropertyGroup>
3+
<_ExtensionProjectTemplate>$(MSBuildThisFileDirectory)/extensionValidationProjectTemplate.txt</_ExtensionProjectTemplate>
4+
<_ExtensionValidationLocation>$(IntermediateOutputPath)ExtensionValidation/</_ExtensionValidationLocation>
5+
</PropertyGroup>
6+
7+
<Target Name="AddWebJobsExtensionInformation" BeforeTargets="GetAssemblyAttributes" Condition="'@(WebJobsExtension)' != ''">
8+
<ItemGroup>
9+
<_ExtensionInformationAttribute Include="@(WebJobsExtension->'Microsoft.Azure.Functions.Worker.Extensions.Abstractions.ExtensionInformationAttribute')">
10+
<_Parameter1>%(WebJobsExtension.Identity)</_Parameter1>
11+
<_Parameter2>%(WebJobsExtension.Version)</_Parameter2>
12+
</_ExtensionInformationAttribute>
13+
<AssemblyAttribute Include="@(_ExtensionInformationAttribute)" RemoveMetadata="Version" />
14+
</ItemGroup>
15+
</Target>
16+
17+
<Target Name="GenerateExtensionProject" AfterTargets="Compile" Condition="'@(WebJobsExtension)' != '' and '$(ContinuousIntegrationBuild)' == 'true'">
18+
<MakeDir Directories="$(_ExtensionValidationLocation)" />
19+
<WriteLinesToFile
20+
File="$(_ExtensionValidationLocation)ExtensionValidation.csproj"
21+
Lines="$([System.IO.File]::ReadAllText($(_ExtensionProjectTemplate))
22+
.Replace('$PackageName$', '%(WebJobsExtension.Identity)')
23+
.Replace('$PackageVersion$', '%(WebJobsExtension.Version)'))"
24+
Overwrite="true" />
25+
</Target>
26+
27+
<Target Name="RestoreGeneratedExtensionProject" AfterTargets="GenerateExtensionProject" Condition="'@(WebJobsExtension)' != '' and '$(ContinuousIntegrationBuild)' == 'true'">
28+
<MSBuild Projects="$(_ExtensionValidationLocation)ExtensionValidation.csproj" Targets="Restore" />
29+
</Target>
30+
</Project>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>net8.0</TargetFramework>
4+
<OutputType>Library</OutputType>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<PackageReference Include="$PackageName$" Version="$PackageVersion$" />
9+
</ItemGroup>
10+
</Project>

eng/ci/public-build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ extends:
5555
image: 1es-windows-2022
5656
os: windows
5757

58+
settings:
59+
# PR's from forks do not have sufficient permissions to set tags.
60+
skipBuildTagsForGitHubPullRequests: ${{ variables['System.PullRequest.IsFork'] }}
61+
5862
stages:
5963
- stage: Test
6064

eng/ci/templates/jobs/run-unit-tests.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,6 @@ jobs:
4040
projects: |
4141
**\DotNetWorker.Opentelemetry.Tests.csproj
4242
43-
- task: DotNetCoreCLI@2
44-
displayName: Application Insights Tests
45-
inputs:
46-
command: test
47-
arguments: -v n
48-
projects: |
49-
**\DotNetWorker.ApplicationInsights.Tests.csproj
50-
5143
- task: DotNetCoreCLI@2
5244
displayName: Sdk Tests
5345
inputs:
@@ -56,7 +48,7 @@ jobs:
5648
projects: |
5749
**\SdkTests.csproj
5850
**\Sdk.Analyzers.Tests.csproj
59-
**\Sdk.Generatior.Tests.csproj
51+
**\Sdk.Generator.Tests.csproj
6052
6153
- task: DotNetCoreCLI@2
6254
displayName: Extension Tests

extensions/Directory.Build.targets

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project>
2+
3+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)../, $(_DirectoryBuildTargetsFile)))/$(_DirectoryBuildTargetsFile)"
4+
Condition=" '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)../, $(_DirectoryBuildTargetsFile)))' != '' " />
5+
6+
<Import Project="$(TargetsRoot)WorkerExtensions.targets" />
7+
8+
</Project>

0 commit comments

Comments
 (0)