Skip to content

Commit cf68bbe

Browse files
authored
Merge branch 'dotnet:main' into fix-openapi-description-bug-minimal-api
2 parents 38606e9 + b8f5b5e commit cf68bbe

File tree

12 files changed

+365
-277
lines changed

12 files changed

+365
-277
lines changed

eng/Signing.props

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
<ItemsToSign Include="$(VisualStudioSetupOutputPath)**\*.vsix" />
2525
<ItemsToSign Include="$(ArtifactsDir)installers\$(Configuration)\**\*.exe" />
2626
<ItemsToSign Include="$(ArtifactsDir)installers\$(Configuration)\**\*.msi" />
27-
<ItemsToSign Remove="$(ArtifactsDir)installers\$(Configuration)\**\*.wixpack.zip" />
28-
<ItemsToSign Remove="$(ArtifactsPackagesDir)**\*.wixpack.zip" />
2927
<ItemsToSign Remove="$(ArtifactsPackagesDir)**\*symbols.nupkg" />
3028
</ItemGroup>
3129

eng/Version.Details.xml

Lines changed: 169 additions & 169 deletions
Large diffs are not rendered by default.

eng/Versions.props

Lines changed: 85 additions & 85 deletions
Large diffs are not rendered by default.

src/Framework/App.Ref/src/Microsoft.AspNetCore.App.Ref.sfxproj

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

3737
<PropertyGroup Condition="'$(BuildInstallers)' == 'true' or '$(TargetOsName)' == 'win'">
3838
<GenerateInstallers Condition="'$(DotNetBuildSourceOnly)' != 'true'">true</GenerateInstallers>
39-
<BuildDebPackage Condition="'$(RuntimeIdentifier)' == 'linux-x64'">true</BuildDebPackage>
39+
<BuildDebPackage Condition="'$(RuntimeIdentifier)' == 'linux-x64' or '$(RuntimeIdentifier)' == 'linux-arm64'">true</BuildDebPackage>
4040
<BuildRpmPackage Condition="'$(RuntimeIdentifier)' == 'linux-x64' or '$(RuntimeIdentifier)' == 'linux-arm64'">true</BuildRpmPackage>
4141
<UseArcadeRpmTooling>true</UseArcadeRpmTooling>
4242
<GenerateVSInsertionPackages>true</GenerateVSInsertionPackages>

src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.sfxproj

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

4545
<PropertyGroup Condition="'$(BuildInstallers)' == 'true' or '$(TargetOsName)' == 'win'">
4646
<GenerateInstallers Condition="'$(DotNetBuildSourceOnly)' != 'true'">true</GenerateInstallers>
47-
<BuildDebPackage Condition="'$(RuntimeIdentifier)' == 'linux-x64'">true</BuildDebPackage>
47+
<BuildDebPackage Condition="'$(RuntimeIdentifier)' == 'linux-x64' or '$(RuntimeIdentifier)' == 'linux-arm64'">true</BuildDebPackage>
4848
<BuildRpmPackage Condition="'$(RuntimeIdentifier)' == 'linux-x64' or '$(RuntimeIdentifier)' == 'linux-arm64'">true</BuildRpmPackage>
4949
<UseArcadeRpmTooling>true</UseArcadeRpmTooling>
5050
<GenerateVSInsertionPackages>true</GenerateVSInsertionPackages>

src/Framework/AspNetCoreAnalyzers/src/SourceGenerators/PublicTopLevelProgramGenerator.cs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,27 @@ public partial class Program { }
1717

1818
public void Initialize(IncrementalGeneratorInitializationContext context)
1919
{
20-
var internalGeneratedProgramClass = context.CompilationProvider
20+
var internalGeneratedProgramClass = context.CompilationProvider.Select(static (compilation, cancellationToken) =>
2121
// Get the entry point associated with the compilation, this maps to the Main method definition
22-
.Select(static (compilation, cancellationToken) => compilation.GetEntryPoint(cancellationToken))
2322
// Get the containing symbol of the entry point, this maps to the Program class
24-
.Select(static (symbol, _) => symbol?.ContainingSymbol)
25-
// If the program class is already public, we don't need to generate anything.
26-
.Select(static (symbol, _) => symbol?.DeclaredAccessibility == Accessibility.Public ? null : symbol)
27-
// If the discovered `Program` type is not a class then its not
28-
// generated and has been defined in source, so we can skip it
29-
.Select(static (symbol, _) => symbol is INamedTypeSymbol { TypeKind: TypeKind.Class } ? symbol : null)
30-
// If there are multiple partial declarations, then do nothing since we don't want
31-
// to trample on visibility explicitly set by the user
32-
.Select(static (symbol, _) => symbol is { DeclaringSyntaxReferences: { Length: 1 } declaringSyntaxReferences } ? declaringSyntaxReferences.Single() : null)
23+
compilation.GetEntryPoint(cancellationToken)?.ContainingSymbol is INamedTypeSymbol
24+
{
25+
// If the discovered `Program` type is not a class then its not
26+
// generated and has been defined in source, so we can skip it
27+
// If the program class is already public, we don't need to generate anything.
28+
DeclaredAccessibility: not Accessibility.Public,
29+
TypeKind: TypeKind.Class,
30+
// If there are multiple partial declarations, then do nothing since we don't want
31+
// to trample on visibility explicitly set by the user
32+
DeclaringSyntaxReferences: { Length: 1 } declaringSyntaxReferences
33+
} &&
3334
// If the `Program` class is already declared in user code, we don't need to generate anything.
34-
.Select(static (declaringSyntaxReference, cancellationToken) => declaringSyntaxReference?.GetSyntax(cancellationToken) is ClassDeclarationSyntax ? null : declaringSyntaxReference);
35+
declaringSyntaxReferences.Single().GetSyntax(cancellationToken) is not ClassDeclarationSyntax
36+
);
3537

3638
context.RegisterSourceOutput(internalGeneratedProgramClass, (context, result) =>
3739
{
38-
if (result is not null)
40+
if (result)
3941
{
4042
context.AddSource("PublicTopLevelProgram.Generated.g.cs", PublicPartialProgramClassSource);
4143
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using System.Runtime.CompilerServices;
5+
6+
public static class ModuleInitializer
7+
{
8+
[ModuleInitializer]
9+
public static void Init() =>
10+
VerifySourceGenerators.Initialize();
11+
}

src/Http/Http.Extensions/test/ValidationsGenerator/snapshots/ValidationsGeneratorTests.CanValidateParameters.verified.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/Http/WebUtilities/src/BufferedReadStream.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ public override long Position
108108
if (innerOffset <= _bufferCount)
109109
{
110110
// Yes, just skip some of the buffered data
111-
_bufferOffset += innerOffset;
112-
_bufferCount -= innerOffset;
111+
_bufferOffset += _bufferCount - innerOffset;
112+
_bufferCount = innerOffset;
113113
}
114114
else
115115
{

src/Http/WebUtilities/test/MultipartReaderTests.cs

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ public class MultipartReaderTests
8080
"<!DOCTYPE html><title>Content of a.html.</title>\r\n" +
8181
"\r\n" +
8282
"--9051914041544843365972754266--\r\n";
83-
8483
private const string TwoPartBodyIncompleteBuffer =
8584
"--9051914041544843365972754266\r\n" +
8685
"Content-Disposition: form-data; name=\"text\"\r\n" +
@@ -315,6 +314,43 @@ public void MultipartReader_BufferSizeMustBeLargerThanBoundary_Throws()
315314
});
316315
}
317316

317+
[Fact]
318+
public async Task MultipartReader_ReadMultipartBodyWithFilesForDeferredCopy_Success()
319+
{
320+
var stream = MakeStream(ThreePartBody);
321+
var reader = new MultipartReader(Boundary, stream);
322+
323+
await reader.ReadNextSectionAsync(); // skip text field section
324+
325+
var section = await reader.ReadNextSectionAsync();
326+
Assert.NotNull(section);
327+
Assert.Equal(2, section.Headers.Count);
328+
Assert.Equal("form-data; name=\"file1\"; filename=\"a.txt\"", section.Headers["Content-Disposition"][0]);
329+
Assert.Equal("text/plain", section.Headers["Content-Type"][0]);
330+
var stream1 = section.Body;
331+
332+
section = await reader.ReadNextSectionAsync();
333+
Assert.NotNull(section);
334+
Assert.Equal(2, section.Headers.Count);
335+
Assert.Equal("form-data; name=\"file2\"; filename=\"a.html\"", section.Headers["Content-Disposition"][0]);
336+
Assert.Equal("text/html", section.Headers["Content-Type"][0]);
337+
var stream2 = section.Body;
338+
339+
Assert.Null(await reader.ReadNextSectionAsync());
340+
341+
Assert.True(stream1.CanSeek);
342+
Assert.Equal(0, stream1.Seek(0, SeekOrigin.Begin));
343+
var buffer = new MemoryStream();
344+
await stream1.CopyToAsync(buffer);
345+
Assert.Equal("Content of a.txt.\r\n", Encoding.ASCII.GetString(buffer.ToArray()));
346+
347+
Assert.True(stream2.CanSeek);
348+
Assert.Equal(0, stream2.Seek(0, SeekOrigin.Begin));
349+
buffer = new MemoryStream();
350+
await stream2.CopyToAsync(buffer);
351+
Assert.Equal("<!DOCTYPE html><title>Content of a.html.</title>\r\n", Encoding.ASCII.GetString(buffer.ToArray()));
352+
}
353+
318354
[Fact]
319355
public async Task MultipartReader_TwoPartBodyIncompleteBuffer_TwoSectionsReadSuccessfullyThirdSectionThrows()
320356
{

0 commit comments

Comments
 (0)