diff --git a/Directory.Build.props b/Directory.Build.props
index 166dbd64874c..1230281ba953 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -119,6 +119,9 @@
$(WarningsNotAsErrors);xUnit1004
+
+
+ $(NoWarn);IL2121
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index 375335c262a1..c85c6387c073 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -302,22 +302,22 @@
https://github.com/dotnet/runtime
00908575fcc36922f4fccc21a905fc008d082596
-
+
https://github.com/dotnet/arcade
- e2fcd61c25c61c6ad0c2a649c8f257077fb1fd88
+ 622c2dc5ced5df5af002a3b06a52f9584b726b28
-
+
https://github.com/dotnet/arcade
- e2fcd61c25c61c6ad0c2a649c8f257077fb1fd88
+ 622c2dc5ced5df5af002a3b06a52f9584b726b28
-
+
https://github.com/dotnet/arcade
- e2fcd61c25c61c6ad0c2a649c8f257077fb1fd88
+ 622c2dc5ced5df5af002a3b06a52f9584b726b28
-
+
https://github.com/dotnet/arcade
- e2fcd61c25c61c6ad0c2a649c8f257077fb1fd88
+ 622c2dc5ced5df5af002a3b06a52f9584b726b28
diff --git a/eng/Versions.props b/eng/Versions.props
index 3f4f102207f9..e7d9327322c4 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -135,8 +135,8 @@
7.0.0-rc.2.22459.3
7.0.0-rc.2.22459.3
- 7.0.0-beta.22423.1
- 7.0.0-beta.22423.1
+ 7.0.0-beta.22458.5
+ 7.0.0-beta.22458.5
7.0.0-alpha.1.22425.2
diff --git a/eng/common/cross/arm/sources.list.focal b/eng/common/cross/arm/sources.list.focal
new file mode 100644
index 000000000000..4de2600c1747
--- /dev/null
+++ b/eng/common/cross/arm/sources.list.focal
@@ -0,0 +1,11 @@
+deb http://ports.ubuntu.com/ubuntu-ports/ focal main restricted universe
+deb-src http://ports.ubuntu.com/ubuntu-ports/ focal main restricted universe
+
+deb http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted universe
+deb-src http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted universe
+
+deb http://ports.ubuntu.com/ubuntu-ports/ focal-backports main restricted
+deb-src http://ports.ubuntu.com/ubuntu-ports/ focal-backports main restricted
+
+deb http://ports.ubuntu.com/ubuntu-ports/ focal-security main restricted universe multiverse
+deb-src http://ports.ubuntu.com/ubuntu-ports/ focal-security main restricted universe multiverse
diff --git a/eng/common/cross/arm/sources.list.jammy b/eng/common/cross/arm/sources.list.jammy
new file mode 100644
index 000000000000..6bb0453029cc
--- /dev/null
+++ b/eng/common/cross/arm/sources.list.jammy
@@ -0,0 +1,11 @@
+deb http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe
+deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe
+
+deb http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe
+deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe
+
+deb http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted
+deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted
+
+deb http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse
+deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse
diff --git a/eng/common/cross/arm64/sources.list.focal b/eng/common/cross/arm64/sources.list.focal
new file mode 100644
index 000000000000..4de2600c1747
--- /dev/null
+++ b/eng/common/cross/arm64/sources.list.focal
@@ -0,0 +1,11 @@
+deb http://ports.ubuntu.com/ubuntu-ports/ focal main restricted universe
+deb-src http://ports.ubuntu.com/ubuntu-ports/ focal main restricted universe
+
+deb http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted universe
+deb-src http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted universe
+
+deb http://ports.ubuntu.com/ubuntu-ports/ focal-backports main restricted
+deb-src http://ports.ubuntu.com/ubuntu-ports/ focal-backports main restricted
+
+deb http://ports.ubuntu.com/ubuntu-ports/ focal-security main restricted universe multiverse
+deb-src http://ports.ubuntu.com/ubuntu-ports/ focal-security main restricted universe multiverse
diff --git a/eng/common/cross/arm64/sources.list.jammy b/eng/common/cross/arm64/sources.list.jammy
new file mode 100644
index 000000000000..6bb0453029cc
--- /dev/null
+++ b/eng/common/cross/arm64/sources.list.jammy
@@ -0,0 +1,11 @@
+deb http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe
+deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe
+
+deb http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe
+deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe
+
+deb http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted
+deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted
+
+deb http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse
+deb-src http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse
diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh
index 032f5f193732..5680980fa296 100755
--- a/eng/common/cross/build-rootfs.sh
+++ b/eng/common/cross/build-rootfs.sh
@@ -186,32 +186,27 @@ while :; do
__UbuntuArch=i386
__UbuntuRepo="http://archive.ubuntu.com/ubuntu/"
;;
- lldb3.6)
- __LLDB_Package="lldb-3.6-dev"
- ;;
- lldb3.8)
- __LLDB_Package="lldb-3.8-dev"
- ;;
- lldb3.9)
- __LLDB_Package="liblldb-3.9-dev"
- ;;
- lldb4.0)
- __LLDB_Package="liblldb-4.0-dev"
- ;;
- lldb5.0)
- __LLDB_Package="liblldb-5.0-dev"
- ;;
- lldb6.0)
- __LLDB_Package="liblldb-6.0-dev"
+ lldb*)
+ version="${lowerI/lldb/}"
+ parts=(${version//./ })
+
+ # for versions > 6.0, lldb has dropped the minor version
+ if [[ "${parts[0]}" -gt 6 ]]; then
+ version="${parts[0]}"
+ fi
+
+ __LLDB_Package="liblldb-${version}-dev"
;;
no-lldb)
unset __LLDB_Package
;;
llvm*)
- version="$(echo "$lowerI" | tr -d '[:alpha:]-=')"
+ version="${lowerI/llvm/}"
parts=(${version//./ })
__LLVM_MajorVersion="${parts[0]}"
__LLVM_MinorVersion="${parts[1]}"
+
+ # for versions > 6.0, llvm has dropped the minor version
if [[ -z "$__LLVM_MinorVersion" && "$__LLVM_MajorVersion" -le 6 ]]; then
__LLVM_MinorVersion=0;
fi
@@ -231,6 +226,16 @@ while :; do
__CodeName=bionic
fi
;;
+ focal) # Ubuntu 20.04
+ if [[ "$__CodeName" != "jessie" ]]; then
+ __CodeName=focal
+ fi
+ ;;
+ jammy) # Ubuntu 22.04
+ if [[ "$__CodeName" != "jessie" ]]; then
+ __CodeName=jammy
+ fi
+ ;;
jessie) # Debian 8
__CodeName=jessie
__UbuntuRepo="http://ftp.debian.org/debian/"
diff --git a/eng/common/cross/x86/sources.list.focal b/eng/common/cross/x86/sources.list.focal
new file mode 100644
index 000000000000..99d5731330e7
--- /dev/null
+++ b/eng/common/cross/x86/sources.list.focal
@@ -0,0 +1,11 @@
+deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe
+deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted universe
+
+deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe
+deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe
+
+deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted
+deb-src http://archive.ubuntu.com/ubuntu/ focal-backports main restricted
+
+deb http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
+deb-src http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
diff --git a/eng/common/cross/x86/sources.list.jammy b/eng/common/cross/x86/sources.list.jammy
new file mode 100644
index 000000000000..af1c1feaeac1
--- /dev/null
+++ b/eng/common/cross/x86/sources.list.jammy
@@ -0,0 +1,11 @@
+deb http://archive.ubuntu.com/ubuntu/ jammy main restricted universe
+deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted universe
+
+deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe
+deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe
+
+deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted
+deb-src http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted
+
+deb http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
+deb-src http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
diff --git a/eng/common/templates/job/execute-sdl.yml b/eng/common/templates/job/execute-sdl.yml
index 9ff6a10a682c..aaeb83b4dcbd 100644
--- a/eng/common/templates/job/execute-sdl.yml
+++ b/eng/common/templates/job/execute-sdl.yml
@@ -53,7 +53,7 @@ jobs:
demands: Cmd
# If it's not devdiv, it's dnceng
${{ if ne(variables['System.TeamProject'], 'DevDiv') }}:
- name: NetCore1ESPool-Internal
+ name: NetCore1ESPool-Svc-Internal
demands: ImageOverride -equals windows.vs2019.amd64
steps:
- checkout: self
diff --git a/eng/common/templates/job/onelocbuild.yml b/eng/common/templates/job/onelocbuild.yml
index 6c523b714f40..6b8fc9970808 100644
--- a/eng/common/templates/job/onelocbuild.yml
+++ b/eng/common/templates/job/onelocbuild.yml
@@ -40,7 +40,7 @@ jobs:
demands: Cmd
# If it's not devdiv, it's dnceng
${{ if ne(variables['System.TeamProject'], 'DevDiv') }}:
- name: NetCore1ESPool-Internal
+ name: NetCore1ESPool-Svc-Internal
demands: ImageOverride -equals windows.vs2019.amd64
variables:
diff --git a/eng/common/templates/job/source-build.yml b/eng/common/templates/job/source-build.yml
index 88f6f75a622d..b6137f44ada1 100644
--- a/eng/common/templates/job/source-build.yml
+++ b/eng/common/templates/job/source-build.yml
@@ -46,10 +46,10 @@ jobs:
# source-build builds run in Docker, including the default managed platform.
pool:
${{ if eq(variables['System.TeamProject'], 'public') }}:
- name: NetCore-Public
+ name: NetCore-Svc-Public
demands: ImageOverride -equals Build.Ubuntu.1804.Amd64.Open
${{ if eq(variables['System.TeamProject'], 'internal') }}:
- name: NetCore1ESPool-Internal
+ name: NetCore1ESPool-Svc-Internal
demands: ImageOverride -equals Build.Ubuntu.1804.Amd64
${{ if ne(parameters.platform.pool, '') }}:
pool: ${{ parameters.platform.pool }}
diff --git a/eng/common/templates/job/source-index-stage1.yml b/eng/common/templates/job/source-index-stage1.yml
index 21fd12276b65..59a42c338ab1 100644
--- a/eng/common/templates/job/source-index-stage1.yml
+++ b/eng/common/templates/job/source-index-stage1.yml
@@ -28,10 +28,10 @@ jobs:
${{ if eq(parameters.pool, '') }}:
pool:
${{ if eq(variables['System.TeamProject'], 'public') }}:
- name: NetCore-Public
+ name: NetCore-Svc-Public
demands: ImageOverride -equals windows.vs2019.amd64.open
${{ if eq(variables['System.TeamProject'], 'internal') }}:
- name: NetCore1ESPool-Internal
+ name: NetCore1ESPool-Svc-Internal
demands: ImageOverride -equals windows.vs2019.amd64
steps:
diff --git a/eng/common/templates/jobs/jobs.yml b/eng/common/templates/jobs/jobs.yml
index 64e5929f2216..297e7946b0be 100644
--- a/eng/common/templates/jobs/jobs.yml
+++ b/eng/common/templates/jobs/jobs.yml
@@ -95,7 +95,7 @@ jobs:
demands: Cmd
# If it's not devdiv, it's dnceng
${{ if ne(variables['System.TeamProject'], 'DevDiv') }}:
- name: NetCore1ESPool-Internal
+ name: NetCore1ESPool-Svc-Internal
demands: ImageOverride -equals windows.vs2019.amd64
runAsPublic: ${{ parameters.runAsPublic }}
diff --git a/eng/common/templates/jobs/source-build.yml b/eng/common/templates/jobs/source-build.yml
index 00aa98eb3bfd..8dd2d355f22d 100644
--- a/eng/common/templates/jobs/source-build.yml
+++ b/eng/common/templates/jobs/source-build.yml
@@ -14,7 +14,7 @@ parameters:
# This is the default platform provided by Arcade, intended for use by a managed-only repo.
defaultManagedPlatform:
name: 'Managed'
- container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-3e800f1-20190501005343'
+ container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8-20220809204800-17a4aab'
# Defines the platforms on which to run build jobs. One job is created for each platform, and the
# object in this array is sent to the job template as 'platform'. If no platforms are specified,
diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml
index 87fcae940cff..957375c1c1a6 100644
--- a/eng/common/templates/post-build/post-build.yml
+++ b/eng/common/templates/post-build/post-build.yml
@@ -106,7 +106,7 @@ stages:
demands: Cmd
# If it's not devdiv, it's dnceng
${{ else }}:
- name: NetCore1ESPool-Internal
+ name: NetCore1ESPool-Svc-Internal
demands: ImageOverride -equals windows.vs2019.amd64
steps:
@@ -143,7 +143,7 @@ stages:
demands: Cmd
# If it's not devdiv, it's dnceng
${{ else }}:
- name: NetCore1ESPool-Internal
+ name: NetCore1ESPool-Svc-Internal
demands: ImageOverride -equals windows.vs2019.amd64
steps:
- template: setup-maestro-vars.yml
@@ -203,7 +203,7 @@ stages:
demands: Cmd
# If it's not devdiv, it's dnceng
${{ else }}:
- name: NetCore1ESPool-Internal
+ name: NetCore1ESPool-Svc-Internal
demands: ImageOverride -equals windows.vs2019.amd64
steps:
- template: setup-maestro-vars.yml
@@ -262,7 +262,7 @@ stages:
demands: Cmd
# If it's not devdiv, it's dnceng
${{ else }}:
- name: NetCore1ESPool-Internal
+ name: NetCore1ESPool-Svc-Internal
demands: ImageOverride -equals windows.vs2019.amd64
steps:
- template: setup-maestro-vars.yml
diff --git a/global.json b/global.json
index bb86c8ffedb2..8794ad650219 100644
--- a/global.json
+++ b/global.json
@@ -1,9 +1,9 @@
{
"sdk": {
- "version": "7.0.100-rc.1.22375.2"
+ "version": "7.0.100-rc.1.22425.9"
},
"tools": {
- "dotnet": "7.0.100-rc.1.22375.2",
+ "dotnet": "7.0.100-rc.1.22425.9",
"runtimes": {
"dotnet/x86": [
"$(MicrosoftNETCoreBrowserDebugHostTransportVersion)"
@@ -27,7 +27,7 @@
},
"msbuild-sdks": {
"Yarn.MSBuild": "1.22.10",
- "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22423.1",
- "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.22423.1"
+ "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22458.5",
+ "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.22458.5"
}
}
diff --git a/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Wasm.Authentication.Server.csproj b/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Wasm.Authentication.Server.csproj
index 995a6d16303c..ff7d9284068c 100644
--- a/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Wasm.Authentication.Server.csproj
+++ b/src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Wasm.Authentication.Server.csproj
@@ -4,7 +4,7 @@
$(DefaultNetCoreTargetFramework)
- CS8002
+ $(NoWarn);CS8002
false
Bootstrap5
diff --git a/src/Components/WebAssembly/testassets/WasmLinkerTest/WasmLinkerTest.csproj b/src/Components/WebAssembly/testassets/WasmLinkerTest/WasmLinkerTest.csproj
index 15235aca9a70..252481a43034 100644
--- a/src/Components/WebAssembly/testassets/WasmLinkerTest/WasmLinkerTest.csproj
+++ b/src/Components/WebAssembly/testassets/WasmLinkerTest/WasmLinkerTest.csproj
@@ -52,6 +52,7 @@
OutputDirectory="$(LibrariesTrimmedArtifactsPath)"
ReferenceAssemblyPaths="@(RuntimePackAsset);@(ReferencePath->WithMetadataValue('ExternallyResolved', 'true'))"
ExtraArgs="$(ILLinkArgs)"
+ NoWarn="$(NoWarn)"
TrimMode="link"
ToolExe="$(_DotNetHostFileName)"
ToolPath="$(_DotNetHostDirectory)" />
diff --git a/src/DataProtection/DataProtection/src/AuthenticatedEncryption/AuthenticatedEncryptorFactory.cs b/src/DataProtection/DataProtection/src/AuthenticatedEncryption/AuthenticatedEncryptorFactory.cs
index e9b45de7f1f2..5efc15dcfc85 100644
--- a/src/DataProtection/DataProtection/src/AuthenticatedEncryption/AuthenticatedEncryptorFactory.cs
+++ b/src/DataProtection/DataProtection/src/AuthenticatedEncryption/AuthenticatedEncryptorFactory.cs
@@ -163,6 +163,7 @@ private static string GetBCryptAlgorithmNameFromValidationAlgorithm(ValidationAl
}
}
+ [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
private static Type GetManagedTypeFromEncryptionAlgorithm(EncryptionAlgorithm algorithm)
{
switch (algorithm)
@@ -180,6 +181,7 @@ private static Type GetManagedTypeFromEncryptionAlgorithm(EncryptionAlgorithm al
}
}
+ [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
private static Type GetManagedTypeFromValidationAlgorithm(ValidationAlgorithm algorithm)
{
switch (algorithm)
diff --git a/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ConfigurationModel/ManagedAlgorithmHelpers.cs b/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ConfigurationModel/ManagedAlgorithmHelpers.cs
new file mode 100644
index 000000000000..c9a7c3244445
--- /dev/null
+++ b/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ConfigurationModel/ManagedAlgorithmHelpers.cs
@@ -0,0 +1,66 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Security.Cryptography;
+using System.Xml.Linq;
+
+namespace Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel;
+
+internal static class ManagedAlgorithmHelpers
+{
+ private static readonly List KnownAlgorithmTypes = new List
+ {
+ typeof(Aes),
+ typeof(HMACSHA1),
+ typeof(HMACSHA256),
+ typeof(HMACSHA384),
+ typeof(HMACSHA512)
+ };
+
+ // Any changes to this method should also be be reflected in FriendlyNameToType.
+ public static string TypeToFriendlyName(Type type)
+ {
+ if (KnownAlgorithmTypes.Contains(type))
+ {
+ return type.Name;
+ }
+ else
+ {
+ return type.AssemblyQualifiedName!;
+ }
+ }
+
+ // Any changes to this method should also be be reflected in TypeToFriendlyName.
+ [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
+ [UnconditionalSuppressMessage("Trimmer", "IL2075", Justification = "Unknown type is checked for whether it has a public parameterless constructor. Handle trimmed types by providing a useful error message.")]
+ [UnconditionalSuppressMessage("Trimmer", "IL2073", Justification = "Unknown type is checked for whether it has a public parameterless constructor. Handle trimmed types by providing a useful error message.")]
+ public static Type FriendlyNameToType(string typeName)
+ {
+ foreach (var knownType in KnownAlgorithmTypes)
+ {
+ if (knownType.Name == typeName)
+ {
+ return knownType;
+ }
+ }
+
+ var type = TypeExtensions.GetTypeWithTrimFriendlyErrorMessage(typeName);
+
+ // Type name could be full or assembly qualified name of known type.
+ if (KnownAlgorithmTypes.Contains(type))
+ {
+ return type;
+ }
+
+ // All other types are created using Activator.CreateInstance. Validate it has a valid constructor.
+ if (type.GetConstructor(Type.EmptyTypes) == null)
+ {
+ throw new InvalidOperationException($"Algorithm type {type} doesn't have a public parameterless constructor. If the app is published with trimming then the constructor may have been trimmed. Ensure the type's assembly is excluded from trimming.");
+ }
+
+ return type;
+ }
+}
diff --git a/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ConfigurationModel/ManagedAuthenticatedEncryptorConfiguration.cs b/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ConfigurationModel/ManagedAuthenticatedEncryptorConfiguration.cs
index 390c0ec4fe52..8a9262c666ff 100644
--- a/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ConfigurationModel/ManagedAuthenticatedEncryptorConfiguration.cs
+++ b/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ConfigurationModel/ManagedAuthenticatedEncryptorConfiguration.cs
@@ -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;
using Microsoft.Extensions.Logging.Abstractions;
@@ -24,6 +25,7 @@ public sealed class ManagedAuthenticatedEncryptorConfiguration : AlgorithmConfig
/// The default algorithm is AES.
///
[ApplyPolicy]
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
public Type EncryptionAlgorithmType { get; set; } = typeof(Aes);
///
@@ -47,6 +49,7 @@ public sealed class ManagedAuthenticatedEncryptorConfiguration : AlgorithmConfig
/// The default algorithm is HMACSHA256.
///
[ApplyPolicy]
+ [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
public Type ValidationAlgorithmType { get; set; } = typeof(HMACSHA256);
///
diff --git a/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ConfigurationModel/ManagedAuthenticatedEncryptorDescriptor.cs b/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ConfigurationModel/ManagedAuthenticatedEncryptorDescriptor.cs
index 30bafe6564a8..33816cf24867 100644
--- a/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ConfigurationModel/ManagedAuthenticatedEncryptorDescriptor.cs
+++ b/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ConfigurationModel/ManagedAuthenticatedEncryptorDescriptor.cs
@@ -49,11 +49,11 @@ public XmlSerializedDescriptorInfo ExportToXml()
//
var encryptionElement = new XElement("encryption",
- new XAttribute("algorithm", TypeToFriendlyName(Configuration.EncryptionAlgorithmType)),
+ new XAttribute("algorithm", ManagedAlgorithmHelpers.TypeToFriendlyName(Configuration.EncryptionAlgorithmType)),
new XAttribute("keyLength", Configuration.EncryptionAlgorithmKeySize));
var validationElement = new XElement("validation",
- new XAttribute("algorithm", TypeToFriendlyName(Configuration.ValidationAlgorithmType)));
+ new XAttribute("algorithm", ManagedAlgorithmHelpers.TypeToFriendlyName(Configuration.ValidationAlgorithmType)));
var rootElement = new XElement("descriptor",
new XComment(" Algorithms provided by specified SymmetricAlgorithm and KeyedHashAlgorithm "),
@@ -63,34 +63,4 @@ public XmlSerializedDescriptorInfo ExportToXml()
return new XmlSerializedDescriptorInfo(rootElement, typeof(ManagedAuthenticatedEncryptorDescriptorDeserializer));
}
-
- // Any changes to this method should also be be reflected
- // in ManagedAuthenticatedEncryptorDescriptorDeserializer.FriendlyNameToType.
- private static string TypeToFriendlyName(Type type)
- {
- if (type == typeof(Aes))
- {
- return nameof(Aes);
- }
- else if (type == typeof(HMACSHA1))
- {
- return nameof(HMACSHA1);
- }
- else if (type == typeof(HMACSHA256))
- {
- return nameof(HMACSHA256);
- }
- else if (type == typeof(HMACSHA384))
- {
- return nameof(HMACSHA384);
- }
- else if (type == typeof(HMACSHA512))
- {
- return nameof(HMACSHA512);
- }
- else
- {
- return type.AssemblyQualifiedName!;
- }
- }
}
diff --git a/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ConfigurationModel/ManagedAuthenticatedEncryptorDescriptorDeserializer.cs b/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ConfigurationModel/ManagedAuthenticatedEncryptorDescriptorDeserializer.cs
index 09fdc3aafcf4..504b7bb3ad9b 100644
--- a/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ConfigurationModel/ManagedAuthenticatedEncryptorDescriptorDeserializer.cs
+++ b/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ConfigurationModel/ManagedAuthenticatedEncryptorDescriptorDeserializer.cs
@@ -34,44 +34,14 @@ public IAuthenticatedEncryptorDescriptor ImportFromXml(XElement element)
var configuration = new ManagedAuthenticatedEncryptorConfiguration();
var encryptionElement = element.Element("encryption")!;
- configuration.EncryptionAlgorithmType = FriendlyNameToType((string)encryptionElement.Attribute("algorithm")!);
+ configuration.EncryptionAlgorithmType = ManagedAlgorithmHelpers.FriendlyNameToType((string)encryptionElement.Attribute("algorithm")!);
configuration.EncryptionAlgorithmKeySize = (int)encryptionElement.Attribute("keyLength")!;
var validationElement = element.Element("validation")!;
- configuration.ValidationAlgorithmType = FriendlyNameToType((string)validationElement.Attribute("algorithm")!);
+ configuration.ValidationAlgorithmType = ManagedAlgorithmHelpers.FriendlyNameToType((string)validationElement.Attribute("algorithm")!);
Secret masterKey = ((string)element.Element("masterKey")!).ToSecret();
return new ManagedAuthenticatedEncryptorDescriptor(configuration, masterKey);
}
-
- // Any changes to this method should also be be reflected
- // in ManagedAuthenticatedEncryptorDescriptor.TypeToFriendlyName.
- private static Type FriendlyNameToType(string typeName)
- {
- if (typeName == nameof(Aes))
- {
- return typeof(Aes);
- }
- else if (typeName == nameof(HMACSHA1))
- {
- return typeof(HMACSHA1);
- }
- else if (typeName == nameof(HMACSHA256))
- {
- return typeof(HMACSHA256);
- }
- else if (typeName == nameof(HMACSHA384))
- {
- return typeof(HMACSHA384);
- }
- else if (typeName == nameof(HMACSHA512))
- {
- return typeof(HMACSHA512);
- }
- else
- {
- return TypeExtensions.GetTypeWithTrimFriendlyErrorMessage(typeName);
- }
- }
}
diff --git a/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ManagedAuthenticatedEncryptorFactory.cs b/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ManagedAuthenticatedEncryptorFactory.cs
index 42b08734cc31..41ba968c9c9b 100644
--- a/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ManagedAuthenticatedEncryptorFactory.cs
+++ b/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ManagedAuthenticatedEncryptorFactory.cs
@@ -111,7 +111,7 @@ private static class AlgorithmActivator
///
/// Creates a factory that wraps a call to .
///
- public static Func CreateFactory(Type implementation)
+ public static Func CreateFactory([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type implementation)
{
return ((IActivator)Activator.CreateInstance(typeof(AlgorithmActivatorCore<>).MakeGenericType(implementation))!).Creator;
}
diff --git a/src/DataProtection/DataProtection/src/RegistryPolicyResolver.cs b/src/DataProtection/DataProtection/src/RegistryPolicyResolver.cs
index 62e81417c5ed..dd9a213acff8 100644
--- a/src/DataProtection/DataProtection/src/RegistryPolicyResolver.cs
+++ b/src/DataProtection/DataProtection/src/RegistryPolicyResolver.cs
@@ -177,7 +177,7 @@ private static ManagedAuthenticatedEncryptorConfiguration GetManagedAuthenticate
var valueFromRegistry = key.GetValue(nameof(ManagedAuthenticatedEncryptorConfiguration.EncryptionAlgorithmType));
if (valueFromRegistry != null)
{
- options.EncryptionAlgorithmType = TypeExtensions.GetTypeWithTrimFriendlyErrorMessage(Convert.ToString(valueFromRegistry, CultureInfo.InvariantCulture)!);
+ options.EncryptionAlgorithmType = ManagedAlgorithmHelpers.FriendlyNameToType(Convert.ToString(valueFromRegistry, CultureInfo.InvariantCulture)!);
}
valueFromRegistry = key.GetValue(nameof(ManagedAuthenticatedEncryptorConfiguration.EncryptionAlgorithmKeySize));
@@ -189,7 +189,7 @@ private static ManagedAuthenticatedEncryptorConfiguration GetManagedAuthenticate
valueFromRegistry = key.GetValue(nameof(ManagedAuthenticatedEncryptorConfiguration.ValidationAlgorithmType));
if (valueFromRegistry != null)
{
- options.ValidationAlgorithmType = TypeExtensions.GetTypeWithTrimFriendlyErrorMessage(Convert.ToString(valueFromRegistry, CultureInfo.InvariantCulture)!);
+ options.ValidationAlgorithmType = ManagedAlgorithmHelpers.FriendlyNameToType(Convert.ToString(valueFromRegistry, CultureInfo.InvariantCulture)!);
}
return options;
diff --git a/src/DataProtection/DataProtection/test/AuthenticatedEncryption/ConfigurationModel/ManagedAuthenticatedEncryptorDescriptorDeserializerTests.cs b/src/DataProtection/DataProtection/test/AuthenticatedEncryption/ConfigurationModel/ManagedAuthenticatedEncryptorDescriptorDeserializerTests.cs
index 3e8009677ea0..8793e806c48f 100644
--- a/src/DataProtection/DataProtection/test/AuthenticatedEncryption/ConfigurationModel/ManagedAuthenticatedEncryptorDescriptorDeserializerTests.cs
+++ b/src/DataProtection/DataProtection/test/AuthenticatedEncryption/ConfigurationModel/ManagedAuthenticatedEncryptorDescriptorDeserializerTests.cs
@@ -50,7 +50,7 @@ public void ImportFromXml_BuiltInTypes_CreatesAppropriateDescriptor(Type encrypt
}
[Fact]
- public void ImportFromXml_CustomType_CreatesAppropriateDescriptor()
+ public void ImportFromXml_FullyQualifiedBuiltInTypes_CreatesAppropriateDescriptor()
{
// Arrange
var masterKey = Convert.ToBase64String(Encoding.UTF8.GetBytes("[PLACEHOLDER]"));
@@ -83,6 +83,69 @@ public void ImportFromXml_CustomType_CreatesAppropriateDescriptor()
Assert.Equal(plaintext, roundTripPlaintext);
}
+ [Fact]
+ public void ImportFromXml_CustomType_CreatesAppropriateDescriptor()
+ {
+ // Arrange
+ var masterKey = Convert.ToBase64String(Encoding.UTF8.GetBytes("[PLACEHOLDER]"));
+
+ var xml = $@"
+
+
+
+
+ {masterKey}
+
+ ";
+
+ // Act
+ var deserializedDescriptor = new ManagedAuthenticatedEncryptorDescriptorDeserializer().ImportFromXml(XElement.Parse(xml));
+ var managedDescriptor = (ManagedAuthenticatedEncryptorDescriptor)deserializedDescriptor;
+
+ // Assert
+ Assert.Equal(typeof(CustomAlgorithm), managedDescriptor.Configuration.EncryptionAlgorithmType);
+ }
+
+ [Fact]
+ public void ImportFromXml_CustomTypeWithoutConstructor_CreatesAppropriateDescriptor()
+ {
+ // Arrange
+ var masterKey = Convert.ToBase64String(Encoding.UTF8.GetBytes("[PLACEHOLDER]"));
+
+ var xml = $@"
+
+
+
+
+ {masterKey}
+
+ ";
+
+ // Act
+ var ex = Assert.Throws(() => new ManagedAuthenticatedEncryptorDescriptorDeserializer().ImportFromXml(XElement.Parse(xml)));
+
+ // Assert
+ Assert.Equal($"Algorithm type {typeof(CustomAlgorithmNoConstructor).FullName} doesn't have a public parameterless constructor. If the app is published with trimming then the constructor may have been trimmed. Ensure the type's assembly is excluded from trimming.", ex.Message);
+ }
+
+ public class CustomAlgorithm : SymmetricAlgorithm
+ {
+ public override ICryptoTransform CreateDecryptor(byte[] rgbKey, byte[] rgbIV) => throw new NotImplementedException();
+ public override ICryptoTransform CreateEncryptor(byte[] rgbKey, byte[] rgbIV) => throw new NotImplementedException();
+ public override void GenerateIV() => throw new NotImplementedException();
+ public override void GenerateKey() => throw new NotImplementedException();
+ }
+
+ public class CustomAlgorithmNoConstructor : SymmetricAlgorithm
+ {
+ private CustomAlgorithmNoConstructor() { }
+
+ public override ICryptoTransform CreateDecryptor(byte[] rgbKey, byte[] rgbIV) => throw new NotImplementedException();
+ public override ICryptoTransform CreateEncryptor(byte[] rgbKey, byte[] rgbIV) => throw new NotImplementedException();
+ public override void GenerateIV() => throw new NotImplementedException();
+ public override void GenerateKey() => throw new NotImplementedException();
+ }
+
private static IAuthenticatedEncryptor CreateEncryptorInstanceFromDescriptor(ManagedAuthenticatedEncryptorDescriptor descriptor)
{
var encryptorFactory = new ManagedAuthenticatedEncryptorFactory(NullLoggerFactory.Instance);
diff --git a/src/DataProtection/DataProtection/test/RegistryPolicyResolverTests.cs b/src/DataProtection/DataProtection/test/RegistryPolicyResolverTests.cs
index 170e3b5a5414..581e3adc6239 100644
--- a/src/DataProtection/DataProtection/test/RegistryPolicyResolverTests.cs
+++ b/src/DataProtection/DataProtection/test/RegistryPolicyResolverTests.cs
@@ -226,13 +226,13 @@ public void ResolvePolicy_ManagedEncryption_WithExplicitSettings()
var registryEntries = new Dictionary()
{
["EncryptionType"] = "managed",
- ["EncryptionAlgorithmType"] = typeof(TripleDES).AssemblyQualifiedName,
+ ["EncryptionAlgorithmType"] = typeof(Aes).AssemblyQualifiedName,
["EncryptionAlgorithmKeySize"] = 2048,
["ValidationAlgorithmType"] = typeof(HMACSHA1).AssemblyQualifiedName
};
var expectedConfiguration = new ManagedAuthenticatedEncryptorConfiguration()
{
- EncryptionAlgorithmType = typeof(TripleDES),
+ EncryptionAlgorithmType = typeof(Aes),
EncryptionAlgorithmKeySize = 2048,
ValidationAlgorithmType = typeof(HMACSHA1)
};
diff --git a/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/ApiAuthSample.csproj b/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/ApiAuthSample.csproj
index ec21f0bbc980..abac013b1ee0 100644
--- a/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/ApiAuthSample.csproj
+++ b/src/Identity/ApiAuthorization.IdentityServer/samples/ApiAuthSample/ApiAuthSample.csproj
@@ -4,7 +4,7 @@
$(DefaultNetCoreTargetFramework)
aspnet-ApiAuthSample-12ED8ECC-9EF1-4D31-87B4-1405B3198E5E
- CS8002
+ $(NoWarn);CS8002
false
diff --git a/src/Identity/ApiAuthorization.IdentityServer/test/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.Tests.csproj b/src/Identity/ApiAuthorization.IdentityServer/test/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.Tests.csproj
index eddcf81ab91b..30e51abfa7f7 100644
--- a/src/Identity/ApiAuthorization.IdentityServer/test/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.Tests.csproj
+++ b/src/Identity/ApiAuthorization.IdentityServer/test/Microsoft.AspNetCore.ApiAuthorization.IdentityServer.Tests.csproj
@@ -6,7 +6,7 @@
avoid errors during restore -->
false
- CS8002
+ $(NoWarn);CS8002
diff --git a/src/Tools/LinkabilityChecker/LinkabilityChecker.csproj b/src/Tools/LinkabilityChecker/LinkabilityChecker.csproj
index 394ebbfcfb6e..f17c1eb60bb2 100644
--- a/src/Tools/LinkabilityChecker/LinkabilityChecker.csproj
+++ b/src/Tools/LinkabilityChecker/LinkabilityChecker.csproj
@@ -50,6 +50,7 @@
OutputDirectory="$(LibrariesTrimmedArtifactsPath)"
ReferenceAssemblyPaths="@(RuntimePackAsset);@(ReferencePath->WithMetadataValue('ExternallyResolved', 'true'))"
ExtraArgs="$(ILLinkArgs)"
+ NoWarn="$(NoWarn)"
TrimMode="link"
ToolExe="$(_DotNetHostFileName)"
ToolPath="$(_DotNetHostDirectory)" />