Skip to content

Commit 341cea8

Browse files
committed
Resolve conflicts
2 parents 8d460db + 9f58d66 commit 341cea8

File tree

11 files changed

+182
-41
lines changed

11 files changed

+182
-41
lines changed

eng/Version.Details.xml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -388,39 +388,39 @@
388388
<Uri>https://github.com/dotnet/winforms</Uri>
389389
<Sha>9b822fd70005bf5632d12fe76811b97b3dd044e4</Sha>
390390
</Dependency>
391-
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="9.0.0-beta.25255.5">
391+
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="9.0.0-beta.25271.1">
392392
<Uri>https://github.com/dotnet/arcade</Uri>
393-
<Sha>1cfa39f82d00b3659a3d367bc344241946e10681</Sha>
393+
<Sha>086a1771875b63404b4a710d27250fe384dc2810</Sha>
394394
</Dependency>
395395
<!-- Intermediate is necessary for source build. -->
396-
<Dependency Name="Microsoft.SourceBuild.Intermediate.arcade" Version="9.0.0-beta.25255.5">
396+
<Dependency Name="Microsoft.SourceBuild.Intermediate.arcade" Version="9.0.0-beta.25271.1">
397397
<Uri>https://github.com/dotnet/arcade</Uri>
398-
<Sha>1cfa39f82d00b3659a3d367bc344241946e10681</Sha>
398+
<Sha>086a1771875b63404b4a710d27250fe384dc2810</Sha>
399399
<SourceBuild RepoName="arcade" ManagedOnly="true" />
400400
</Dependency>
401-
<Dependency Name="Microsoft.DotNet.Build.Tasks.Installers" Version="9.0.0-beta.25255.5">
401+
<Dependency Name="Microsoft.DotNet.Build.Tasks.Installers" Version="9.0.0-beta.25271.1">
402402
<Uri>https://github.com/dotnet/arcade</Uri>
403-
<Sha>1cfa39f82d00b3659a3d367bc344241946e10681</Sha>
403+
<Sha>086a1771875b63404b4a710d27250fe384dc2810</Sha>
404404
</Dependency>
405-
<Dependency Name="Microsoft.DotNet.Build.Tasks.Templating" Version="9.0.0-beta.25255.5">
405+
<Dependency Name="Microsoft.DotNet.Build.Tasks.Templating" Version="9.0.0-beta.25271.1">
406406
<Uri>https://github.com/dotnet/arcade</Uri>
407-
<Sha>1cfa39f82d00b3659a3d367bc344241946e10681</Sha>
407+
<Sha>086a1771875b63404b4a710d27250fe384dc2810</Sha>
408408
</Dependency>
409-
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="9.0.0-beta.25255.5">
409+
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="9.0.0-beta.25271.1">
410410
<Uri>https://github.com/dotnet/arcade</Uri>
411-
<Sha>1cfa39f82d00b3659a3d367bc344241946e10681</Sha>
411+
<Sha>086a1771875b63404b4a710d27250fe384dc2810</Sha>
412412
</Dependency>
413-
<Dependency Name="Microsoft.DotNet.RemoteExecutor" Version="9.0.0-beta.25255.5">
413+
<Dependency Name="Microsoft.DotNet.RemoteExecutor" Version="9.0.0-beta.25271.1">
414414
<Uri>https://github.com/dotnet/arcade</Uri>
415-
<Sha>1cfa39f82d00b3659a3d367bc344241946e10681</Sha>
415+
<Sha>086a1771875b63404b4a710d27250fe384dc2810</Sha>
416416
</Dependency>
417-
<Dependency Name="Microsoft.Extensions.Diagnostics.Testing" Version="9.6.0-preview.1.25260.2">
417+
<Dependency Name="Microsoft.Extensions.Diagnostics.Testing" Version="9.6.0-preview.1.25279.1">
418418
<Uri>https://github.com/dotnet/extensions</Uri>
419-
<Sha>90dd3fdbb6056d8ae177ab102b779e3922a88981</Sha>
419+
<Sha>2ab21ec6d6fa7371f19d8485215d4c0c99f9c338</Sha>
420420
</Dependency>
421-
<Dependency Name="Microsoft.Extensions.TimeProvider.Testing" Version="9.6.0-preview.1.25260.2">
421+
<Dependency Name="Microsoft.Extensions.TimeProvider.Testing" Version="9.6.0-preview.1.25279.1">
422422
<Uri>https://github.com/dotnet/extensions</Uri>
423-
<Sha>90dd3fdbb6056d8ae177ab102b779e3922a88981</Sha>
423+
<Sha>2ab21ec6d6fa7371f19d8485215d4c0c99f9c338</Sha>
424424
</Dependency>
425425
<Dependency Name="NuGet.Frameworks" Version="6.2.4">
426426
<Uri>https://github.com/nuget/nuget.client</Uri>

eng/Versions.props

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@
143143
<SystemIOHashingVersion>9.0.6</SystemIOHashingVersion>
144144
<SystemRuntimeCachingVersion>9.0.6</SystemRuntimeCachingVersion>
145145
<!-- Packages from dotnet/extensions -->
146-
<MicrosoftExtensionsDiagnosticsTestingVersion>9.6.0-preview.1.25260.2</MicrosoftExtensionsDiagnosticsTestingVersion>
147-
<MicrosoftExtensionsTimeProviderTestingVersion>9.6.0-preview.1.25260.2</MicrosoftExtensionsTimeProviderTestingVersion>
146+
<MicrosoftExtensionsDiagnosticsTestingVersion>9.6.0-preview.1.25279.1</MicrosoftExtensionsDiagnosticsTestingVersion>
147+
<MicrosoftExtensionsTimeProviderTestingVersion>9.6.0-preview.1.25279.1</MicrosoftExtensionsTimeProviderTestingVersion>
148148
<!-- Packages from dotnet/efcore -->
149149
<dotnetefVersion>9.0.6</dotnetefVersion>
150150
<MicrosoftEntityFrameworkCoreInMemoryVersion>9.0.6</MicrosoftEntityFrameworkCoreInMemoryVersion>
@@ -166,10 +166,10 @@
166166
<NuGetVersioningVersion>6.2.4</NuGetVersioningVersion>
167167
<NuGetFrameworksVersion>6.2.4</NuGetFrameworksVersion>
168168
<!-- Packages from dotnet/arcade -->
169-
<MicrosoftDotNetBuildTasksInstallersVersion>9.0.0-beta.25255.5</MicrosoftDotNetBuildTasksInstallersVersion>
170-
<MicrosoftDotNetBuildTasksTemplatingVersion>9.0.0-beta.25255.5</MicrosoftDotNetBuildTasksTemplatingVersion>
171-
<MicrosoftDotNetRemoteExecutorVersion>9.0.0-beta.25255.5</MicrosoftDotNetRemoteExecutorVersion>
172-
<MicrosoftSourceBuildIntermediatearcadeVersion>9.0.0-beta.25255.5</MicrosoftSourceBuildIntermediatearcadeVersion>
169+
<MicrosoftDotNetBuildTasksInstallersVersion>9.0.0-beta.25271.1</MicrosoftDotNetBuildTasksInstallersVersion>
170+
<MicrosoftDotNetBuildTasksTemplatingVersion>9.0.0-beta.25271.1</MicrosoftDotNetBuildTasksTemplatingVersion>
171+
<MicrosoftDotNetRemoteExecutorVersion>9.0.0-beta.25271.1</MicrosoftDotNetRemoteExecutorVersion>
172+
<MicrosoftSourceBuildIntermediatearcadeVersion>9.0.0-beta.25271.1</MicrosoftSourceBuildIntermediatearcadeVersion>
173173
<!-- Packages from dotnet/source-build-externals -->
174174
<MicrosoftSourceBuildIntermediatesourcebuildexternalsVersion>9.0.0-alpha.1.24575.1</MicrosoftSourceBuildIntermediatesourcebuildexternalsVersion>
175175
<!-- Packages from dotnet/source-build-reference-packages -->

eng/targets/Helix.Common.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!-- This file is shared between Helix.proj and .csproj files. -->
33
<PropertyGroup>
44
<HelixQueueAlmaLinux8>(AlmaLinux.8.Amd64.Open)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:almalinux-8-helix-amd64</HelixQueueAlmaLinux8>
5-
<HelixQueueAlpine318>(Alpine.318.Amd64.Open)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.18-helix-amd64</HelixQueueAlpine318>
5+
<HelixQueueAlpine>(Alpine.321.Amd64.Open)azurelinux.3.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.21-helix-amd64</HelixQueueAlpine>
66
<HelixQueueDebian12>(Debian.12.Amd64.Open)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-12-helix-amd64</HelixQueueDebian12>
77
<HelixQueueFedora41>(Fedora.41.Amd64.Open)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-41-helix</HelixQueueFedora41>
88
<HelixQueueMariner>(Mariner)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-helix-amd64</HelixQueueMariner>
@@ -42,7 +42,7 @@
4242
<HelixAvailableTargetQueue Include="$(HelixQueueAlmaLinux8)" Platform="Linux" />
4343

4444
<!-- Containers -->
45-
<HelixAvailableTargetQueue Include="$(HelixQueueAlpine318)" Platform="Linux" />
45+
<HelixAvailableTargetQueue Include="$(HelixQueueAlpine)" Platform="Linux" />
4646
<HelixAvailableTargetQueue Include="$(HelixQueueDebian12)" Platform="Linux" />
4747
<HelixAvailableTargetQueue Include="$(HelixQueueFedora41)" Platform="Linux" />
4848
<HelixAvailableTargetQueue Include="$(HelixQueueMariner)" Platform="Linux" />

eng/targets/Helix.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<PropertyGroup Condition="'$(TestDependsOnPlaywright)' == 'true'">
1818
<SkipHelixQueues>
1919
$(HelixQueueAlmaLinux8);
20-
$(HelixQueueAlpine318);
20+
$(HelixQueueAlpine);
2121
$(HelixQueueDebian12);
2222
$(HelixQueueFedora40);
2323
$(HelixQueueMariner);

global.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"jdk": "latest"
2828
},
2929
"msbuild-sdks": {
30-
"Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.25255.5",
31-
"Microsoft.DotNet.Helix.Sdk": "9.0.0-beta.25255.5"
30+
"Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.25271.1",
31+
"Microsoft.DotNet.Helix.Sdk": "9.0.0-beta.25271.1"
3232
}
3333
}

src/OpenApi/src/Schemas/OpenApiJsonSchema.Helpers.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ internal sealed partial class OpenApiJsonSchema
136136
{
137137
type = "array";
138138
var array = new OpenApiArray();
139+
// Read to process JsonTokenType.StartArray before advancing
140+
reader.Read();
139141
while (reader.TokenType != JsonTokenType.EndArray)
140142
{
141143
array.Add(ReadOpenApiAny(ref reader));

src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Services/OpenApiSchemaService/OpenApiSchemaService.ParameterSchemas.cs

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,4 +722,93 @@ public static bool TryParse(string value, out Student result)
722722
return true;
723723
}
724724
}
725+
726+
// Regression test for https://github.com/dotnet/aspnetcore/issues/62023
727+
// Testing that the array parsing in our OpenApiJsonSchema works
728+
[Fact]
729+
public async Task CustomConverterThatOutputsArrayWithDefaultValue()
730+
{
731+
// Arrange
732+
var serviceCollection = new ServiceCollection();
733+
serviceCollection.ConfigureHttpJsonOptions(options =>
734+
{
735+
options.SerializerOptions.Converters.Add(new EnumArrayTypeConverter());
736+
});
737+
var builder = CreateBuilder(serviceCollection);
738+
739+
// Act
740+
builder.MapPost("/api", (EnumArrayType e = EnumArrayType.None) => { });
741+
742+
// Assert
743+
await VerifyOpenApiDocument(builder, document =>
744+
{
745+
var operation = document.Paths["/api"].Operations[OperationType.Post];
746+
var param = Assert.Single(operation.Parameters);
747+
Assert.NotNull(param.Schema);
748+
Assert.IsType<OpenApiArray>(param.Schema.Default);
749+
// Type is null, it's up to the user to configure this via a custom schema
750+
// transformer for types with a converter.
751+
Assert.Null(param.Schema.Type);
752+
});
753+
}
754+
755+
[Fact]
756+
public async Task CustomConverterThatOutputsObjectWithDefaultValue()
757+
{
758+
// Arrange
759+
var serviceCollection = new ServiceCollection();
760+
serviceCollection.ConfigureHttpJsonOptions(options =>
761+
{
762+
options.SerializerOptions.Converters.Add(new EnumObjectTypeConverter());
763+
});
764+
var builder = CreateBuilder(serviceCollection);
765+
766+
// Act
767+
builder.MapPost("/api", (EnumArrayType e = EnumArrayType.None) => { });
768+
769+
// Assert
770+
await VerifyOpenApiDocument(builder, document =>
771+
{
772+
var operation = document.Paths["/api"].Operations[OperationType.Post];
773+
var param = Assert.Single(operation.Parameters);
774+
Assert.NotNull(param.Schema);
775+
Assert.IsType<OpenApiObject>(param.Schema.Default);
776+
// Type is null, it's up to the user to configure this via a custom schema
777+
// transformer for types with a converter.
778+
Assert.Null(param.Schema.Type);
779+
});
780+
}
781+
782+
public enum EnumArrayType
783+
{
784+
None = 1
785+
}
786+
787+
public class EnumArrayTypeConverter : JsonConverter<EnumArrayType>
788+
{
789+
public override EnumArrayType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
790+
{
791+
return new EnumArrayType();
792+
}
793+
794+
public override void Write(Utf8JsonWriter writer, EnumArrayType value, JsonSerializerOptions options)
795+
{
796+
writer.WriteStartArray();
797+
writer.WriteEndArray();
798+
}
799+
}
800+
801+
public class EnumObjectTypeConverter : JsonConverter<EnumArrayType>
802+
{
803+
public override EnumArrayType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
804+
{
805+
return new EnumArrayType();
806+
}
807+
808+
public override void Write(Utf8JsonWriter writer, EnumArrayType value, JsonSerializerOptions options)
809+
{
810+
writer.WriteStartObject();
811+
writer.WriteEndObject();
812+
}
813+
}
725814
}

src/Servers/IIS/AspNetCoreModuleV2/CommonLib/HostFxrResolver.cpp

Lines changed: 60 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ HostFxrResolver::TryGetHostFxrPath(
197197
size_t size = MAX_PATH * 2;
198198
hostfxrPath.resize(size);
199199

200-
get_hostfxr_parameters params;
200+
get_hostfxr_parameters params{};
201201
params.size = sizeof(get_hostfxr_parameters);
202202
params.assembly_path = applicationPath.c_str();
203203
params.dotnet_root = dotnetRoot.c_str();
@@ -393,7 +393,7 @@ HostFxrResolver::GetAbsolutePathToDotnetFromHostfxr(const fs::path& hostfxrPath)
393393
// Tries to call where.exe to find the location of dotnet.exe.
394394
// Will check that the bitness of dotnet matches the current
395395
// worker process bitness.
396-
// Returns true if a valid dotnet was found, else false.R
396+
// Returns true if a valid dotnet was found, else false.
397397
//
398398
std::optional<fs::path>
399399
HostFxrResolver::InvokeWhereToFindDotnet()
@@ -415,8 +415,7 @@ HostFxrResolver::InvokeWhereToFindDotnet()
415415
DWORD dwExitCode;
416416
STRU struDotnetSubstring;
417417
STRU struDotnetLocationsString;
418-
DWORD dwNumBytesRead;
419-
DWORD dwBinaryType;
418+
DWORD dwNumBytesRead = 0;
420419
INT index = 0;
421420
INT prevIndex = 0;
422421
std::optional<fs::path> result;
@@ -521,14 +520,7 @@ HostFxrResolver::InvokeWhereToFindDotnet()
521520

522521
LOG_INFOF(L"Processing entry '%ls'", struDotnetSubstring.QueryStr());
523522

524-
if (LOG_LAST_ERROR_IF(!GetBinaryTypeW(struDotnetSubstring.QueryStr(), &dwBinaryType)))
525-
{
526-
continue;
527-
}
528-
529-
LOG_INFOF(L"Binary type %d", dwBinaryType);
530-
531-
if (fIsCurrentProcess64Bit == (dwBinaryType == SCS_64BIT_BINARY))
523+
if (fIsCurrentProcess64Bit == IsX64(struDotnetSubstring.QueryStr()))
532524
{
533525
// The bitness of dotnet matched with the current worker process bitness.
534526
return std::make_optional(struDotnetSubstring.QueryStr());
@@ -539,6 +531,62 @@ HostFxrResolver::InvokeWhereToFindDotnet()
539531
return result;
540532
}
541533

534+
BOOL HostFxrResolver::IsX64(const WCHAR* dotnetPath)
535+
{
536+
// Errors while reading from the file shouldn't throw unless
537+
// file.exception(bits) is set
538+
std::ifstream file(dotnetPath, std::ios::binary);
539+
if (!file.is_open())
540+
{
541+
LOG_TRACEF(L"Failed to open file %ls", dotnetPath);
542+
return false;
543+
}
544+
545+
// Read the DOS header
546+
IMAGE_DOS_HEADER dosHeader{};
547+
file.read(reinterpret_cast<char*>(&dosHeader), sizeof(dosHeader));
548+
if (dosHeader.e_magic != IMAGE_DOS_SIGNATURE) // 'MZ'
549+
{
550+
LOG_TRACEF(L"%ls is not a valid executable file (missing MZ header).", dotnetPath);
551+
return false;
552+
}
553+
554+
// Seek to the PE header
555+
file.seekg(dosHeader.e_lfanew, std::ios::beg);
556+
557+
// Read the PE header
558+
DWORD peSignature{};
559+
file.read(reinterpret_cast<char*>(&peSignature), sizeof(peSignature));
560+
if (peSignature != IMAGE_NT_SIGNATURE) // 'PE\0\0'
561+
{
562+
LOG_TRACEF(L"%ls is not a valid PE file (missing PE header).", dotnetPath);
563+
return false;
564+
}
565+
566+
// Read the file header
567+
IMAGE_FILE_HEADER fileHeader{};
568+
file.read(reinterpret_cast<char*>(&fileHeader), sizeof(fileHeader));
569+
570+
// Read the optional header magic field
571+
WORD magic{};
572+
file.read(reinterpret_cast<char*>(&magic), sizeof(magic));
573+
574+
// Determine the architecture based on the magic value
575+
if (magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
576+
{
577+
LOG_INFOF(L"%ls is 32-bit", dotnetPath);
578+
return false;
579+
}
580+
else if (magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC)
581+
{
582+
LOG_INFOF(L"%ls is 64-bit", dotnetPath);
583+
return true;
584+
}
585+
586+
LOG_INFOF(L"%ls is unknown architecture %i", dotnetPath, fileHeader.Machine);
587+
return false;
588+
}
589+
542590
std::optional<fs::path>
543591
HostFxrResolver::GetAbsolutePathToDotnetFromProgramFiles()
544592
{

src/Servers/IIS/AspNetCoreModuleV2/CommonLib/HostFxrResolver.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ class HostFxrResolver
7474
const std::filesystem::path & requestedPath
7575
);
7676

77+
static BOOL IsX64(const WCHAR* dotnetPath);
78+
7779
struct LocalFreeDeleter
7880
{
7981
void operator ()(_In_ LPWSTR* ptr) const

src/Servers/IIS/build/Build.Lib.Settings

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<ItemDefinitionGroup>
1111
<ClCompile>
12-
<SDLCheck>false</SDLCheck>
12+
<SDLCheck>true</SDLCheck>
1313
<PreprocessorDefinitions>_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
1414
<ConformanceMode>true</ConformanceMode>
1515
</ClCompile>

0 commit comments

Comments
 (0)