Skip to content

Commit 7de4107

Browse files
committed
Merge branch 'main' into fix-62672
2 parents 10a5fc3 + 0f963e9 commit 7de4107

File tree

24 files changed

+2253
-42
lines changed

24 files changed

+2253
-42
lines changed

src/Components/Web.JS/src/Boot.Server.Common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ async function startServerCore(components: RootComponentManager<ServerComponentD
121121

122122
Blazor.disconnect = cleanup;
123123

124-
window.addEventListener('unload', cleanup, { capture: false, once: true });
124+
window.addEventListener('pagehide', cleanup, { capture: false, once: true });
125125

126126
logger.log(LogLevel.Information, 'Blazor server-side application started.');
127127

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
call %1 -host_arch=x64 -arch=arm64 -no_logo
22
call build.cmd %2 %3 %4
3+
exit /b 0

src/Installers/Windows/AspNetCoreModule-Setup/Forwarders/build.cmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ cl /nologo /c /arm64EC /Fo%objDir%\aspnetcorev2_x64.obj empty.cpp
88
link /lib /nologo /machine:arm64 /def:aspnetcorev2_arm64.def /out:%objDir%\aspnetcorev2_arm64.lib
99
link /lib /nologo /machine:x64 /def:aspnetcorev2_x64.def /out:%objDir%\aspnetcorev2_x64.lib
1010

11-
link /dll /nologo /noentry /machine:arm64x /defArm64Native:aspnetcorev2_arm64.def /def:aspnetcorev2_x64.def %objDir%\aspnetcorev2_arm64.obj %objDir%\aspnetcorev2_x64.obj %objDir%\..\AspNetCoreModuleShim\x64\%configuration%\aspnetcoremodule.res /out:%binDir%\aspnetcorev2.dll %objDir%\aspnetcorev2_arm64.lib %objDir%\aspnetcorev2_x64.lib
11+
link /dll /nologo /noentry /machine:arm64x /defArm64Native:aspnetcorev2_arm64.def /def:aspnetcorev2_x64.def %objDir%\aspnetcorev2_arm64.obj %objDir%\aspnetcorev2_x64.obj %objDir%\..\AspNetCoreModuleShim\x64\%configuration%\aspnetcoremodule.res /out:%binDir%\aspnetcorev2.dll %objDir%\aspnetcorev2_arm64.lib %objDir%\aspnetcorev2_x64.lib /FORCE:UNRESOLVED
1212

1313
cl /nologo /nologo /c /Fo%objDir%\aspnetcorev2_outofprocess_arm64.obj empty.cpp
1414
cl /nologo /nologo /c /arm64EC /Fo%objDir%\aspnetcorev2_outofprocess_x64.obj empty.cpp
1515

1616
link /lib /nologo /machine:arm64 /def:aspnetcorev2_outofprocess_arm64.def /out:%objDir%\aspnetcorev2_outofprocess_arm64.lib
1717
link /lib /nologo /machine:x64 /def:aspnetcorev2_outofprocess_x64.def /out:%objDir%\aspnetcorev2_outofprocess_x64.lib
1818

19-
link /dll /nologo /noentry /machine:arm64x /defArm64Native:aspnetcorev2_outofprocess_arm64.def /def:aspnetcorev2_outofprocess_x64.def %objDir%\aspnetcorev2_outofprocess_arm64.obj %objDir%\aspnetcorev2_outofprocess_x64.obj %objDir%\..\OutOfProcessRequestHandler\x64\%configuration%\outofprocessrequesthandler.res /out:%binDir%\aspnetcorev2_outofprocess.dll %objDir%\aspnetcorev2_outofprocess_arm64.lib %objDir%\aspnetcorev2_outofprocess_x64.lib
19+
link /dll /nologo /noentry /machine:arm64x /defArm64Native:aspnetcorev2_outofprocess_arm64.def /def:aspnetcorev2_outofprocess_x64.def %objDir%\aspnetcorev2_outofprocess_arm64.obj %objDir%\aspnetcorev2_outofprocess_x64.obj %objDir%\..\OutOfProcessRequestHandler\x64\%configuration%\outofprocessrequesthandler.res /out:%binDir%\aspnetcorev2_outofprocess.dll %objDir%\aspnetcorev2_outofprocess_arm64.lib %objDir%\aspnetcorev2_outofprocess_x64.lib /FORCE:UNRESOLVED

src/Installers/Windows/AspNetCoreModule-Setup/Forwarders/build.proj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
1717
<Target Name="Build" DependsOnTargets="SetBuildDefaultEnvironmentVariables">
1818
<MakeDir Directories="$(ObjDir);$(BinDir)" />
19-
<Exec Command="all.cmd $(Prompt) $(ObjDir) $(BinDir) $(Configuration)" />
19+
<!-- Ignore link.exe ARM64X pure forwarder bug -->
20+
<!-- Revert once https://developercommunity.visualstudio.com/t/LINK-:-error-LNK2001:-unresolved-extern/10932429 is fixed -->
21+
<Exec Command="all.cmd $(Prompt) $(ObjDir) $(BinDir) $(Configuration)" ContinueOnError="true" IgnoreStandardErrorWarningFormat="true" />
2022
</Target>
2123
</Project>

src/Mvc/Mvc.Abstractions/src/Filters/IAsyncResultFilter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Mvc.Filters;
1414
/// <para>
1515
/// <see cref="IResultFilter"/> and <see cref="IAsyncResultFilter"/> instances are not executed in cases where
1616
/// an authorization filter or resource filter short-circuits the request to prevent execution of the action.
17-
/// <see cref="IResultFilter"/>. <see cref="IResultFilter"/> and <see cref="IAsyncResultFilter"/> implementations
17+
/// <see cref="IResultFilter"/> and <see cref="IAsyncResultFilter"/> implementations
1818
/// are also not executed in cases where an exception filter handles an exception by producing an action result.
1919
/// </para>
2020
/// <para>

src/Mvc/Mvc.Abstractions/src/Filters/IResultFilter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Mvc.Filters;
1414
/// <para>
1515
/// <see cref="IResultFilter"/> and <see cref="IAsyncResultFilter"/> instances are not executed in cases where
1616
/// an authorization filter or resource filter short-circuits the request to prevent execution of the action.
17-
/// <see cref="IResultFilter"/>. <see cref="IResultFilter"/> and <see cref="IAsyncResultFilter"/> implementations
17+
/// <see cref="IResultFilter"/> and <see cref="IAsyncResultFilter"/> implementations
1818
/// are also not executed in cases where an exception filter handles an exception by producing an action result.
1919
/// </para>
2020
/// <para>

src/OpenApi/sample/Controllers/TestController.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ public IActionResult PostForm([FromForm] MvcTodo todo)
3232
return Ok(todo);
3333
}
3434

35+
[HttpGet]
36+
[Route("/getcultureinvariant")]
37+
public Ok<CurrentWeather> GetCurrentWeather()
38+
{
39+
return TypedResults.Ok(new CurrentWeather(1.0f));
40+
}
41+
3542
public class RouteParamsContainer
3643
{
3744
[FromRoute]
@@ -44,4 +51,6 @@ public class RouteParamsContainer
4451
}
4552

4653
public record MvcTodo(string Title, string Description, bool IsCompleted);
54+
55+
public record CurrentWeather([property: Range(-100.5f, 100.5f)] float Temperature = 0.1f);
4756
}

src/OpenApi/sample/Program.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
using System.Globalization;
45
using System.Text.Json.Serialization;
56
using Sample.Transformers;
67

@@ -23,11 +24,13 @@
2324
options.AddHeader("X-Version", "1.0");
2425
options.AddDocumentTransformer<BearerSecuritySchemeTransformer>();
2526
});
26-
builder.Services.AddOpenApi("v2", options => {
27+
builder.Services.AddOpenApi("v2", options =>
28+
{
2729
options.AddSchemaTransformer<AddExternalDocsTransformer>();
2830
options.AddOperationTransformer<AddExternalDocsTransformer>();
2931
options.AddDocumentTransformer(new AddContactTransformer());
30-
options.AddDocumentTransformer((document, context, token) => {
32+
options.AddDocumentTransformer((document, context, token) =>
33+
{
3134
document.Info.License = new OpenApiLicense { Name = "MIT" };
3235
return Task.CompletedTask;
3336
});
@@ -37,6 +40,15 @@
3740
builder.Services.AddOpenApi("forms");
3841
builder.Services.AddOpenApi("schemas-by-ref");
3942
builder.Services.AddOpenApi("xml");
43+
builder.Services.AddOpenApi("localized", options =>
44+
{
45+
options.ShouldInclude = _ => true;
46+
options.AddDocumentTransformer((document, context, token) =>
47+
{
48+
document.Info.Description = $"This is a localized OpenAPI document for {CultureInfo.CurrentUICulture.NativeName}.";
49+
return Task.CompletedTask;
50+
});
51+
});
4052

4153
var app = builder.Build();
4254

src/OpenApi/src/Extensions/JsonNodeSchemaExtensions.cs

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,22 +90,42 @@ internal static void ApplyValidationAttributes(this JsonNode schema, IEnumerable
9090
}
9191
else if (attribute is RangeAttribute rangeAttribute)
9292
{
93-
// Use InvariantCulture if explicitly requested or if the range has been set via the
94-
// RangeAttribute(double, double) or RangeAttribute(int, int) constructors.
95-
var targetCulture = rangeAttribute.ParseLimitsInInvariantCulture || rangeAttribute.Minimum is double || rangeAttribute.Maximum is int
96-
? CultureInfo.InvariantCulture
97-
: CultureInfo.CurrentCulture;
93+
decimal? minDecimal = null;
94+
decimal? maxDecimal = null;
9895

99-
var minString = rangeAttribute.Minimum.ToString();
100-
var maxString = rangeAttribute.Maximum.ToString();
96+
if (rangeAttribute.Minimum is int minimumInteger)
97+
{
98+
// The range was set with the RangeAttribute(int, int) constructor.
99+
minDecimal = minimumInteger;
100+
maxDecimal = (int)rangeAttribute.Maximum;
101+
}
102+
else
103+
{
104+
// Use InvariantCulture if explicitly requested or if the range has been set via the RangeAttribute(double, double) constructor.
105+
var targetCulture = rangeAttribute.ParseLimitsInInvariantCulture || rangeAttribute.Minimum is double
106+
? CultureInfo.InvariantCulture
107+
: CultureInfo.CurrentCulture;
108+
109+
var minString = Convert.ToString(rangeAttribute.Minimum, targetCulture);
110+
var maxString = Convert.ToString(rangeAttribute.Maximum, targetCulture);
111+
112+
if (decimal.TryParse(minString, NumberStyles.Any, targetCulture, out var value))
113+
{
114+
minDecimal = value;
115+
}
116+
if (decimal.TryParse(maxString, NumberStyles.Any, targetCulture, out value))
117+
{
118+
maxDecimal = value;
119+
}
120+
}
101121

102-
if (decimal.TryParse(minString, NumberStyles.Any, targetCulture, out var minDecimal))
122+
if (minDecimal is { } minValue)
103123
{
104-
schema[OpenApiSchemaKeywords.MinimumKeyword] = minDecimal;
124+
schema[rangeAttribute.MinimumIsExclusive ? OpenApiSchemaKeywords.ExclusiveMinimum : OpenApiSchemaKeywords.MinimumKeyword] = minValue;
105125
}
106-
if (decimal.TryParse(maxString, NumberStyles.Any, targetCulture, out var maxDecimal))
126+
if (maxDecimal is { } maxValue)
107127
{
108-
schema[OpenApiSchemaKeywords.MaximumKeyword] = maxDecimal;
128+
schema[rangeAttribute.MaximumIsExclusive ? OpenApiSchemaKeywords.ExclusiveMaximum : OpenApiSchemaKeywords.MaximumKeyword] = maxValue;
109129
}
110130
}
111131
else if (attribute is RegularExpressionAttribute regularExpressionAttribute)

src/OpenApi/src/Extensions/OpenApiEndpointRouteBuilderExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public static IEndpointConventionBuilder MapOpenApi(this IEndpointRouteBuilder e
5252
var document = await documentService.GetOpenApiDocumentAsync(context.RequestServices, context.Request, context.RequestAborted);
5353
var documentOptions = options.Get(lowercasedDocumentName);
5454

55-
using var textWriter = new Utf8BufferTextWriter();
55+
using var textWriter = new Utf8BufferTextWriter(System.Globalization.CultureInfo.InvariantCulture);
5656
textWriter.SetWriter(context.Response.BodyWriter);
5757

5858
string contentType;

0 commit comments

Comments
 (0)