Skip to content

[main] Update dependencies from dotnet/runtime dotnet/efcore #47650

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
280 changes: 140 additions & 140 deletions eng/Version.Details.xml

Large diffs are not rendered by default.

140 changes: 70 additions & 70 deletions eng/Versions.props

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Diagnostics.CodeAnalysis;
using System.Security.Cryptography.X509Certificates;
using System.Security.Cryptography.Xml;
using System.Xml;
Expand Down Expand Up @@ -75,6 +76,8 @@ public EncryptedXmlInfo Encrypt(XElement plaintextElement)
return new EncryptedXmlInfo(encryptedElement, typeof(EncryptedXmlDecryptor));
}

[UnconditionalSuppressMessage("AOT", "IL3050:RequiresDynamicCode",
Justification = "Only XSLTs require dynamic code. The usage of EncryptedXml doesn't use XSLTs.")]
private XElement EncryptElement(XElement plaintextElement)
{
// EncryptedXml works with XmlDocument, not XLinq. When we perform the conversion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Diagnostics.CodeAnalysis;
using System.Security.Cryptography.X509Certificates;
using System.Security.Cryptography.Xml;
using System.Xml;
Expand Down Expand Up @@ -43,6 +44,8 @@ public EncryptedXmlDecryptor(IServiceProvider? services)
/// </summary>
/// <param name="encryptedElement">An encrypted XML element.</param>
/// <returns>The decrypted form of <paramref name="encryptedElement"/>.</returns>
[UnconditionalSuppressMessage("AOT", "IL3050:RequiresDynamicCode",
Justification = "Only XSLTs require dynamic code. The usage of EncryptedXml doesn't use XSLTs.")]
public XElement Decrypt(XElement encryptedElement)
{
ArgumentNullThrowHelper.ThrowIfNull(encryptedElement);
Expand Down Expand Up @@ -79,6 +82,7 @@ private sealed class EncryptedXmlWithCertificateKeys : EncryptedXml
{
private readonly XmlKeyDecryptionOptions? _options;

[RequiresDynamicCode("XmlDsigXsltTransform uses XslCompiledTransform which requires dynamic code.")]
public EncryptedXmlWithCertificateKeys(XmlKeyDecryptionOptions? options, XmlDocument document)
: base(document)
{
Expand Down
18 changes: 12 additions & 6 deletions src/Hosting/Hosting/test/WebHostBuilderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1353,9 +1353,12 @@ public async Task ThrowingFromHostedServiceFailsStartAsync(IWebHostBuilder build
{
var startEx = await Assert.ThrowsAsync<InvalidOperationException>(() => host.StartAsync());
Assert.Equal("Hosted Service throws in StartAsync", startEx.Message);
var stopEx = await Assert.ThrowsAsync<AggregateException>(() => host.StopAsync());
Assert.Single(stopEx.InnerExceptions);
Assert.Equal("Hosted Service throws in StopAsync", stopEx.InnerExceptions[0].Message);
var stopEx = await Assert.ThrowsAnyAsync<Exception>(() => host.StopAsync());
if (stopEx is AggregateException aggregateException)
{
stopEx = Assert.Single(aggregateException.InnerExceptions);
}
Assert.Equal("Hosted Service throws in StopAsync", stopEx.Message);
}
}

Expand All @@ -1376,9 +1379,12 @@ public async Task ThrowingFromHostedServiceStopsOtherHostedServicesFromRunningSt
var startEx = await Assert.ThrowsAsync<InvalidOperationException>(() => host.StartAsync());
Assert.Equal("Hosted Service throws in StartAsync", startEx.Message);

var stopEx = await Assert.ThrowsAsync<AggregateException>(() => host.StopAsync());
Assert.Single(stopEx.InnerExceptions);
Assert.Equal("Hosted Service throws in StopAsync", stopEx.InnerExceptions[0].Message);
var stopEx = await Assert.ThrowsAnyAsync<Exception>(() => host.StopAsync());
if (stopEx is AggregateException aggregateException)
{
stopEx = Assert.Single(aggregateException.InnerExceptions);
}
Assert.Equal("Hosted Service throws in StopAsync", stopEx.Message);

// This service is never constructed
Assert.False(service.StartCalled);
Expand Down
1 change: 1 addition & 0 deletions src/Http/Routing/src/Matching/AmbiguousMatchException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public AmbiguousMatchException(string message)
{
}

[Obsolete]
internal AmbiguousMatchException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Http/Routing/src/Patterns/RoutePatternException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace Microsoft.AspNetCore.Routing.Patterns;
[Serializable]
public sealed class RoutePatternException : Exception
{
[Obsolete]
private RoutePatternException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
Expand Down Expand Up @@ -42,6 +43,7 @@ public RoutePatternException([StringSyntax("Route")] string pattern, string mess
/// </summary>
/// <param name="info">The <see cref="SerializationInfo"/> to populate with data.</param>
/// <param name="context">The destination (<see cref="StreamingContext" />) for this serialization.</param>
[Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId = "SYSLIB0051", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue(nameof(Pattern), Pattern);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public AmbiguousActionException(string? message)
/// </summary>
/// <param name="info"></param>
/// <param name="context"></param>
[Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId = "SYSLIB0051", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
protected AmbiguousActionException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<ItemGroup>
<Compile Include="$(SharedSourceRoot)runtime\Http2\**\*.cs" LinkBase="Shared\Http2\" />
<Compile Include="$(SharedSourceRoot)runtime\IHttpStreamHeadersHandler.cs" LinkBase="Shared\IHttpStreamHeadersHandler.cs" />
<Compile Include="$(SharedSourceRoot)runtime\Obsoletions.cs" LinkBase="Shared\Obsoletions.cs" />
<Compile Include="$(SharedSourceRoot)runtime\SR.cs" LinkBase="Shared\SR.cs" />
<Compile Include="$(SharedSourceRoot)Http2cat\**\*.cs" LinkBase="Shared\Http2cat" />
<Compile Include="$(SharedSourceRoot)ServerInfrastructure\**\*.cs" LinkBase="Shared\" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<Compile Include="$(SharedSourceRoot)Http2cat\**\*.cs" LinkBase="Shared\Http2cat" />
<Compile Include="$(SharedSourceRoot)runtime\Http2\**\*.cs" LinkBase="Shared\Http2\" />
<Compile Include="$(SharedSourceRoot)runtime\IHttpStreamHeadersHandler.cs" LinkBase="Shared\IHttpStreamHeadersHandler.cs" />
<Compile Include="$(SharedSourceRoot)runtime\Obsoletions.cs" LinkBase="Shared\Obsoletions.cs" />
<Compile Include="$(SharedSourceRoot)runtime\SR.cs" LinkBase="Shared\SR.cs" />
<Compile Include="$(SharedSourceRoot)ServerInfrastructure\**\*.cs" LinkBase="Shared\" Exclude="$(SharedSourceRoot)ServerInfrastructure\DuplexPipe.cs" />
<Compile Include="$(SharedSourceRoot)ValueTaskExtensions\**\*.cs" LinkBase="Shared\" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<Compile Include="$(SharedSourceRoot)Http2cat\**\*.cs" LinkBase="Shared\Http2cat" />
<Compile Include="$(SharedSourceRoot)runtime\Http2\**\*.cs" LinkBase="Shared\Http2\" />
<Compile Include="$(SharedSourceRoot)runtime\IHttpStreamHeadersHandler.cs" LinkBase="Shared\IHttpStreamHeadersHandler.cs" />
<Compile Include="$(SharedSourceRoot)runtime\Obsoletions.cs" LinkBase="Shared\Obsoletions.cs" />
<Compile Include="$(SharedSourceRoot)runtime\SR.cs" LinkBase="Shared\SR.cs" />
<Compile Include="$(SharedSourceRoot)ServerInfrastructure\**\*.cs" LinkBase="Shared\" Exclude="$(SharedSourceRoot)ServerInfrastructure\DuplexPipe.cs" />
<Compile Include="$(SharedSourceRoot)ValueTaskExtensions\**\*.cs" LinkBase="Shared\" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<Compile Include="$(SharedSourceRoot)Http2cat\**\*.cs" LinkBase="Shared\Http2cat" />
<Compile Include="$(SharedSourceRoot)runtime\Http2\**\*.cs" LinkBase="Shared\Http2\" />
<Compile Include="$(SharedSourceRoot)runtime\IHttpStreamHeadersHandler.cs" LinkBase="Shared\IHttpStreamHeadersHandler.cs" />
<Compile Include="$(SharedSourceRoot)runtime\Obsoletions.cs" LinkBase="Shared\Obsoletions.cs" />
<Compile Include="$(SharedSourceRoot)runtime\SR.cs" LinkBase="Shared\SR.cs" />
<Compile Include="$(SharedSourceRoot)ServerInfrastructure\**\*.cs" LinkBase="Shared\" Exclude="$(SharedSourceRoot)ServerInfrastructure\DuplexPipe.cs" />
<Compile Include="$(SharedSourceRoot)ValueTaskExtensions\**\*.cs" LinkBase="Shared\" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<Compile Include="$(SharedSourceRoot)Http2cat\**\*.cs" LinkBase="Shared\Http2cat" />
<Compile Include="$(SharedSourceRoot)runtime\Http2\**\*.cs" LinkBase="Shared\Http2\" />
<Compile Include="$(SharedSourceRoot)runtime\IHttpStreamHeadersHandler.cs" LinkBase="Shared\IHttpStreamHeadersHandler.cs" />
<Compile Include="$(SharedSourceRoot)runtime\Obsoletions.cs" LinkBase="Shared\Obsoletions.cs" />
<Compile Include="$(SharedSourceRoot)runtime\SR.cs" LinkBase="Shared\SR.cs" />
<Compile Include="$(SharedSourceRoot)ServerInfrastructure\**\*.cs" LinkBase="Shared\" Exclude="$(SharedSourceRoot)ServerInfrastructure\DuplexPipe.cs" />
<Compile Include="$(SharedSourceRoot)ValueTaskExtensions\**\*.cs" LinkBase="Shared\" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<Compile Include="$(SharedSourceRoot)Http2cat\**\*.cs" LinkBase="Shared\Http2cat" />
<Compile Include="$(SharedSourceRoot)runtime\Http2\**\*.cs" LinkBase="Shared\Http2\" />
<Compile Include="$(SharedSourceRoot)runtime\IHttpStreamHeadersHandler.cs" LinkBase="Shared\IHttpStreamHeadersHandler.cs" />
<Compile Include="$(SharedSourceRoot)runtime\Obsoletions.cs" LinkBase="Shared\Obsoletions.cs" />
<Compile Include="$(SharedSourceRoot)runtime\SR.cs" LinkBase="Shared\SR.cs" />
<Compile Include="$(SharedSourceRoot)ServerInfrastructure\**\*.cs" LinkBase="Shared\" Exclude="$(SharedSourceRoot)ServerInfrastructure\DuplexPipe.cs" />
<Compile Include="$(SharedSourceRoot)ValueTaskExtensions\**\*.cs" LinkBase="Shared\" />
Expand Down
3 changes: 2 additions & 1 deletion src/Servers/Kestrel/samples/http2cat/http2cat.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -9,6 +9,7 @@
<ItemGroup>
<Compile Include="$(SharedSourceRoot)runtime\Http2\**\*.cs" LinkBase="Shared\Http2" />
<Compile Include="$(SharedSourceRoot)runtime\IHttpStreamHeadersHandler.cs" LinkBase="Shared\IHttpStreamHeadersHandler.cs" />
<Compile Include="$(SharedSourceRoot)runtime\Obsoletions.cs" LinkBase="Shared\Obsoletions.cs" />
<Compile Include="$(SharedSourceRoot)runtime\SR.cs" LinkBase="Shared\SR.cs" />
<Compile Include="$(SharedSourceRoot)Http2cat\**\*.cs" LinkBase="Shared\Http2cat" />
<Compile Include="$(SharedSourceRoot)ServerInfrastructure\**\*.cs" LinkBase="Shared\" />
Expand Down
34 changes: 34 additions & 0 deletions src/Shared/TrimmingAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,40 @@ public RequiresUnreferencedCodeAttribute(string message)
public string? Url { get; set; }
}

/// <summary>
/// Indicates that the specified method requires the ability to generate new code at runtime,
/// for example through <see cref="System.Reflection"/>.
/// </summary>
/// <remarks>
/// This allows tools to understand which methods are unsafe to call when compiling ahead of time.
/// </remarks>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class, Inherited = false)]
internal sealed class RequiresDynamicCodeAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="RequiresDynamicCodeAttribute"/> class
/// with the specified message.
/// </summary>
/// <param name="message">
/// A message that contains information about the usage of dynamic code.
/// </param>
public RequiresDynamicCodeAttribute(string message)
{
Message = message;
}

/// <summary>
/// Gets a message that contains information about the usage of dynamic code.
/// </summary>
public string Message { get; }

/// <summary>
/// Gets or sets an optional URL that contains more information about the method,
/// why it requires dynamic code, and what options a consumer has to deal with it.
/// </summary>
public string? Url { get; set; }
}

/// <summary>
/// Suppresses reporting of a specific rule violation, allowing multiple suppressions on a
/// single code artifact.
Expand Down
3 changes: 3 additions & 0 deletions src/Shared/runtime/Http2/Hpack/HPackDecodingException.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.ComponentModel;
using System.Runtime.Serialization;

namespace System.Net.Http.HPack
Expand All @@ -21,6 +22,8 @@ public HPackDecodingException(string message, Exception innerException) : base(m
{
}

[Obsolete(Obsoletions.LegacyFormatterImplMessage, DiagnosticId = Obsoletions.LegacyFormatterImplDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
[EditorBrowsable(EditorBrowsableState.Never)]
public HPackDecodingException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
Expand Down
11 changes: 11 additions & 0 deletions src/Shared/runtime/Http2/Hpack/HuffmanDecodingException.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.ComponentModel;
using System.Runtime.Serialization;

namespace System.Net.Http.HPack
Expand All @@ -18,16 +19,26 @@ public HuffmanDecodingException(string message)
{
}

#if NET8_0_OR_GREATER
[Obsolete(Obsoletions.LegacyFormatterImplMessage, DiagnosticId = Obsoletions.LegacyFormatterImplDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
#endif
private HuffmanDecodingException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}

#if NET8_0_OR_GREATER
[Obsolete(Obsoletions.LegacyFormatterImplMessage, DiagnosticId = Obsoletions.LegacyFormatterImplDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
#endif
void ISerializable.GetObjectData(SerializationInfo serializationInfo, StreamingContext streamingContext)
{
base.GetObjectData(serializationInfo, streamingContext);
}

#if NET8_0_OR_GREATER
[Obsolete(Obsoletions.LegacyFormatterImplMessage, DiagnosticId = Obsoletions.LegacyFormatterImplDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
[EditorBrowsable(EditorBrowsableState.Never)]
#endif
public override void GetObjectData(SerializationInfo serializationInfo, StreamingContext streamingContext)
{
base.GetObjectData(serializationInfo, streamingContext);
Expand Down
4 changes: 4 additions & 0 deletions src/Shared/runtime/Http3/QPack/QPackDecodingException.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.ComponentModel;
using System.Runtime.Serialization;

namespace System.Net.Http.QPack
Expand All @@ -20,6 +21,9 @@ public QPackDecodingException(string message, Exception innerException) : base(m
{
}

#if NET8_0_OR_GREATER
[Obsolete(Obsoletions.LegacyFormatterImplMessage, DiagnosticId = Obsoletions.LegacyFormatterImplDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
#endif
private QPackDecodingException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
Expand Down
4 changes: 4 additions & 0 deletions src/Shared/runtime/Http3/QPack/QPackEncodingException.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.ComponentModel;
using System.Runtime.Serialization;

namespace System.Net.Http.QPack
Expand All @@ -17,6 +18,9 @@ public QPackEncodingException(string message, Exception innerException)
{
}

#if NET8_0_OR_GREATER
[Obsolete(Obsoletions.LegacyFormatterImplMessage, DiagnosticId = Obsoletions.LegacyFormatterImplDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
#endif
private QPackEncodingException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
Expand Down
13 changes: 13 additions & 0 deletions src/Shared/runtime/Obsoletions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace System
{
internal static class Obsoletions
{
internal const string SharedUrlFormat = "https://aka.ms/dotnet-warnings/{0}";

internal const string LegacyFormatterImplMessage = "This API supports obsolete formatter-based serialization. It should not be called or extended by application code.";
internal const string LegacyFormatterImplDiagId = "SYSLIB0051";
}
}
5 changes: 5 additions & 0 deletions src/SignalR/common/SignalR.Common/src/HubException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ public HubException(string? message, Exception? innerException) : base(message,
/// <param name="context">The <see cref="StreamingContext"/> that contains contextual information about the source or destination.</param>
/// <exception cref="ArgumentNullException">The <paramref name="info"/> parameter is <c>null</c>.</exception>
/// <exception cref="SerializationException">The class name is <c>null</c> or <see cref="Exception.HResult"/> is zero (0).</exception>
#if NET8_0_OR_GREATER
[Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.", DiagnosticId = "SYSLIB0051", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")]
#else
[Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")]
#endif
public HubException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
Expand Down