[main] Update dependencies from dotnet/arcade (#3177)

[main] Update dependencies from dotnet/arcade


 - Analyzer fix

 - Update to net8

 - Update import order

 - Add net8 handling

 - Analyzer fixes

 - Merge branch 'main' into darc-main-328ee272-9fb8-4717-bae0-5575b14d7744

 - More analyzer fixes

 - Port fix from runtime

 - Update failing test

 - verbose test

 - Fix formatting

 - Fix the task to look for net8.0 location.
Revert test changes.

 - Workaround a possible issue in the new SDK
This commit is contained in:
dotnet-maestro[bot] 2023-01-23 17:26:42 +00:00 коммит произвёл GitHub
Родитель 6381e0b100
Коммит 2bd23e1982
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
53 изменённых файлов: 165 добавлений и 119 удалений

Просмотреть файл

@ -1,14 +1,17 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" />
<Import Project="eng/Analyzers.props" />
<PropertyGroup>
<!-- Don't produce ref assemblies by default. -->
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<IsReferenceAssembly Condition="'$(IsReferenceAssembly)' == '' and '$([System.IO.Path]::GetFileName($(MSBuildProjectDirectory)))' == 'ref'">true</IsReferenceAssembly>
<DisableImplicitNamespaceImports_DotNet>true</DisableImplicitNamespaceImports_DotNet>
<!-- The TFM for the product (linker, task,.. not analyzer, which is netstandard) -->
<NetCoreAppToolCurrent>net7.0</NetCoreAppToolCurrent>
<NetCoreAppToolCurrent>$(NetCurrent)</NetCoreAppToolCurrent>
<!-- The TFM for all the tests - intentionally different since tests may depend on new framework APIs in order to validate
linker interaction with them, linker itself doesn't need the new framework typically. -->
<NetCoreAppTestsCurrent>net7.0</NetCoreAppTestsCurrent>
<NetCoreAppTestsCurrent>$(NetCurrent)</NetCoreAppTestsCurrent>
</PropertyGroup>
<PropertyGroup Condition=" '$(IsReferenceAssembly)' == 'true' ">
<ProduceOnlyReferenceAssembly>true</ProduceOnlyReferenceAssembly>
@ -18,9 +21,6 @@
<PublishWindowsPdb>false</PublishWindowsPdb>
<RunApiCompat>false</RunApiCompat>
</PropertyGroup>
<Import Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" />
<Import Project="eng/Analyzers.props" />
<PropertyGroup>
<IsPackable>false</IsPackable>
<PackageLicenseExpression>MIT</PackageLicenseExpression>

Просмотреть файл

@ -6,6 +6,7 @@
<add key="dotnet-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
<add key="dotnet6" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
<add key="dotnet7" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json" />
<add key="dotnet8" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json" />
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" />
</packageSources>
<disabledPackageSources />

Просмотреть файл

@ -3,14 +3,14 @@
<ProductDependencies>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.22630.1">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.23067.5">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>e82404fca08383513e0b0b3c5308d4a9b18b7c7a</Sha>
<Sha>3600aa80a01e90f38a7b86b9d7c1264e091aa5a8</Sha>
<SourceBuild RepoName="arcade" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.DotNet.ApiCompat" Version="8.0.0-beta.22630.1">
<Dependency Name="Microsoft.DotNet.ApiCompat" Version="8.0.0-beta.23067.5">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>e82404fca08383513e0b0b3c5308d4a9b18b7c7a</Sha>
<Sha>3600aa80a01e90f38a7b86b9d7c1264e091aa5a8</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.Sdk.IL" Version="7.0.0-rtm.22507.1">
<Uri>https://github.com/dotnet/runtime</Uri>

Просмотреть файл

@ -18,14 +18,14 @@
<SystemReflectionMetadataVersion>5.0.0</SystemReflectionMetadataVersion>
<MicrosoftBuildFrameworkVersion>17.0.0-preview-21267-01</MicrosoftBuildFrameworkVersion>
<MicrosoftBuildUtilitiesCoreVersion>17.0.0-preview-21267-01</MicrosoftBuildUtilitiesCoreVersion>
<MicrosoftDotNetApiCompatVersion>8.0.0-beta.22630.1</MicrosoftDotNetApiCompatVersion>
<MicrosoftDotNetApiCompatVersion>8.0.0-beta.23067.5</MicrosoftDotNetApiCompatVersion>
<MicrosoftDotNetCodeAnalysisVersion>6.0.0-beta.21271.1</MicrosoftDotNetCodeAnalysisVersion>
<MicrosoftCodeAnalysisCSharpCodeStyleVersion>3.10.0-2.final</MicrosoftCodeAnalysisCSharpCodeStyleVersion>
<MicrosoftCodeAnalysisVersion>4.5.0-1.22517.9</MicrosoftCodeAnalysisVersion>
<MicrosoftNetCompilersToolsetVersion>$(MicrosoftCodeAnalysisVersion)</MicrosoftNetCompilersToolsetVersion>
<MicrosoftCodeAnalysisCSharpAnalyzerTestingXunitVersion>1.0.1-beta1.*</MicrosoftCodeAnalysisCSharpAnalyzerTestingXunitVersion>
<MicrosoftCodeAnalysisBannedApiAnalyzersVersion>3.3.2</MicrosoftCodeAnalysisBannedApiAnalyzersVersion>
<MicrosoftILVerificationVersion>7.0.0-preview.7.22375.6</MicrosoftILVerificationVersion>
<MicrosoftILVerificationVersion>8.0.0-alpha.1.23067.11</MicrosoftILVerificationVersion>
<!-- This controls the version of the cecil package, or the version of cecil in the project graph
when we build the cecil submodule. The reference assembly package will depend on this version of cecil.
Keep this in sync with ProjectInfo.cs in the submodule. -->

Просмотреть файл

@ -48,12 +48,14 @@ __UbuntuPackages+=" symlinks"
__UbuntuPackages+=" libicu-dev"
__UbuntuPackages+=" liblttng-ust-dev"
__UbuntuPackages+=" libunwind8-dev"
__UbuntuPackages+=" libnuma-dev"
__AlpinePackages+=" gettext-dev"
__AlpinePackages+=" icu-dev"
__AlpinePackages+=" libunwind-dev"
__AlpinePackages+=" lttng-ust-dev"
__AlpinePackages+=" compiler-rt-static"
__AlpinePackages+=" numactl-dev"
# runtime libraries' dependencies
__UbuntuPackages+=" libcurl4-openssl-dev"
@ -147,9 +149,9 @@ while :; do
__BuildArch=ppc64le
__UbuntuArch=ppc64el
__UbuntuRepo="http://ports.ubuntu.com/ubuntu-ports/"
__UbuntuPackages=$(echo ${__UbuntuPackages} | sed 's/ libunwind8-dev//')
__UbuntuPackages=$(echo ${__UbuntuPackages} | sed 's/ libomp-dev//')
__UbuntuPackages=$(echo ${__UbuntuPackages} | sed 's/ libomp5//')
__UbuntuPackages="${__UbuntuPackages// libunwind8-dev/}"
__UbuntuPackages="${__UbuntuPackages// libomp-dev/}"
__UbuntuPackages="${__UbuntuPackages// libomp5/}"
unset __LLDB_Package
;;
riscv64)
@ -157,7 +159,7 @@ while :; do
__UbuntuArch=riscv64
__UbuntuRepo="http://deb.debian.org/debian-ports"
__CodeName=sid
__UbuntuPackages=$(echo ${__UbuntuPackages} | sed 's/ libunwind8-dev//')
__UbuntuPackages="${__UbuntuPackages// libunwind8-dev/}"
unset __LLDB_Package
if [[ -e "/usr/share/keyrings/debian-ports-archive-keyring.gpg" ]]; then
@ -168,9 +170,9 @@ while :; do
__BuildArch=s390x
__UbuntuArch=s390x
__UbuntuRepo="http://ports.ubuntu.com/ubuntu-ports/"
__UbuntuPackages=$(echo ${__UbuntuPackages} | sed 's/ libunwind8-dev//')
__UbuntuPackages=$(echo ${__UbuntuPackages} | sed 's/ libomp-dev//')
__UbuntuPackages=$(echo ${__UbuntuPackages} | sed 's/ libomp5//')
__UbuntuPackages="${__UbuntuPackages// libunwind8-dev/}"
__UbuntuPackages="${__UbuntuPackages// libomp-dev/}"
__UbuntuPackages="${__UbuntuPackages// libomp5/}"
unset __LLDB_Package
;;
x64)
@ -310,6 +312,8 @@ done
if [[ "$__BuildArch" == "armel" ]]; then
__LLDB_Package="lldb-3.5-dev"
elif [[ "$__BuildArch" == "arm" && "$__AlpineVersion" == "3.13" ]]; then
__AlpinePackages="${__AlpinePackages//numactl-dev/}"
fi
__UbuntuPackages+=" ${__LLDB_Package:-}"

Просмотреть файл

@ -34,6 +34,25 @@ $jsonTemplateFiles | ForEach-Object {
$jsonWinformsTemplateFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "en\\strings\.json" } # current winforms pattern
$wxlFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "\\.+\.wxl" -And -Not( $_.Directory.Name -Match "\d{4}" ) } # localized files live in four digit lang ID directories; this excludes them
if (-not $wxlFiles) {
$wxlEnFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "\\1033\\.+\.wxl" } # pick up en files (1033 = en) specifically so we can copy them to use as the neutral xlf files
if ($wxlEnFiles) {
$wxlFiles = @()
$wxlEnFiles | ForEach-Object {
$destinationFile = "$($_.Directory.Parent.FullName)\$($_.Name)"
$wxlFiles += Copy-Item "$($_.FullName)" -Destination $destinationFile -PassThru
}
}
}
$macosHtmlEnFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "en\.lproj\\.+\.html" } # add installer HTML files
$macosHtmlFiles = @()
if ($macosHtmlEnFiles) {
$macosHtmlEnFiles | ForEach-Object {
$destinationFile = "$($_.Directory.Parent.FullName)\$($_.Name)"
$macosHtmlFiles += Copy-Item "$($_.FullName)" -Destination $destinationFile -PassThru
}
}
$xlfFiles = @()
@ -99,8 +118,7 @@ $locJson = @{
$outputPath = "$($_.Directory.FullName | Resolve-Path -Relative)\"
$continue = $true
foreach ($exclusion in $exclusions.Exclusions) {
if ($_.FullName.Contains($exclusion))
{
if ($_.FullName.Contains($exclusion)) {
$continue = $false
}
}
@ -115,6 +133,29 @@ $locJson = @{
}
}
)
},
@{
LanguageSet = $LanguageSet
CloneLanguageSet = "VS_macOS_CloneLanguages"
LocItems = @(
$macosHtmlFiles | ForEach-Object {
$outputPath = "$($_.Directory.FullName | Resolve-Path -Relative)\"
$continue = $true
foreach ($exclusion in $exclusions.Exclusions) {
if ($_.FullName.Contains($exclusion)) {
$continue = $false
}
}
$sourceFile = ($_.FullName | Resolve-Path -Relative)
if ($continue) {
return @{
SourceFile = $sourceFile
CopyOption = "LangIDOnPath"
OutputPath = $outputPath
}
}
}
)
}
)
}

Просмотреть файл

@ -88,6 +88,16 @@ jobs:
- ${{ if ne(variable.group, '') }}:
- group: ${{ variable.group }}
# handle template variable syntax
# example:
# - template: path/to/template.yml
# parameters:
# [key]: [value]
- ${{ if ne(variable.template, '') }}:
- template: ${{ variable.template }}
${{ if ne(variable.parameters, '') }}:
parameters: ${{ variable.parameters }}
# handle key-value variable syntax.
# example:
# - [key]: [value]

Просмотреть файл

@ -1,6 +1,6 @@
parameters:
runAsPublic: false
sourceIndexPackageVersion: 1.0.1-20220804.1
sourceIndexPackageVersion: 1.0.1-20221220.2
sourceIndexPackageSource: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json
sourceIndexBuildCommand: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "eng/common/build.ps1 -restore -build -binarylog -ci"
preSteps: []
@ -40,10 +40,10 @@ jobs:
- ${{ preStep }}
- task: UseDotNet@2
displayName: Use .NET Core sdk 3.1
displayName: Use .NET Core SDK 6
inputs:
packageType: sdk
version: 3.1.x
version: 6.0.x
installationPath: $(Agent.TempDirectory)/dotnet
workingDirectory: $(Agent.TempDirectory)

Просмотреть файл

@ -16,7 +16,7 @@
# First, import the template in an arcade-ified repo to pick up the variables, e.g.:
#
# variables:
# - template: eng/common/templates/variables/pool-providers.yml
# - template: /eng/common/templates/variables/pool-providers.yml
#
# ... then anywhere specifying the pool provider use the runtime variables,
# $(DncEngInternalBuildPool) and $ (DncEngPublicBuildPool), e.g.:
@ -45,4 +45,4 @@ variables:
- name: DncEngPublicBuildPool
value: NetCore-Svc-Public
- name: DncEngInternalBuildPool
value: NetCore1ESPool-Svc-Internal
value: NetCore1ESPool-Svc-Internal

Просмотреть файл

@ -581,7 +581,7 @@ function InitializeBuildTool() {
ExitWithExitCode 1
}
$dotnetPath = Join-Path $dotnetRoot (GetExecutableFileName 'dotnet')
$buildTool = @{ Path = $dotnetPath; Command = 'msbuild'; Tool = 'dotnet'; Framework = 'net7.0' }
$buildTool = @{ Path = $dotnetPath; Command = 'msbuild'; Tool = 'dotnet'; Framework = 'net8.0' }
} elseif ($msbuildEngine -eq "vs") {
try {
$msbuildPath = InitializeVisualStudioMSBuild -install:$restore
@ -743,6 +743,8 @@ function MSBuild() {
(Join-Path $basePath (Join-Path netcoreapp2.1 'Microsoft.DotNet.Arcade.Sdk.dll'))
(Join-Path $basePath (Join-Path netcoreapp3.1 'Microsoft.DotNet.ArcadeLogging.dll')),
(Join-Path $basePath (Join-Path netcoreapp3.1 'Microsoft.DotNet.Arcade.Sdk.dll'))
(Join-Path $basePath (Join-Path net7.0 'Microsoft.DotNet.ArcadeLogging.dll')),
(Join-Path $basePath (Join-Path net7.0 'Microsoft.DotNet.Arcade.Sdk.dll'))
)
$selectedPath = $null
foreach ($path in $possiblePaths) {

Просмотреть файл

@ -312,7 +312,7 @@ function InitializeBuildTool {
# return values
_InitializeBuildTool="$_InitializeDotNetCli/dotnet"
_InitializeBuildToolCommand="msbuild"
_InitializeBuildToolFramework="net7.0"
_InitializeBuildToolFramework="net8.0"
}
# Set RestoreNoCache as a workaround for https://github.com/NuGet/Home/issues/3116
@ -428,6 +428,8 @@ function MSBuild {
possiblePaths+=( "$toolset_dir/netcoreapp2.1/Microsoft.DotNet.Arcade.Sdk.dll" )
possiblePaths+=( "$toolset_dir/netcoreapp3.1/Microsoft.DotNet.ArcadeLogging.dll" )
possiblePaths+=( "$toolset_dir/netcoreapp3.1/Microsoft.DotNet.Arcade.Sdk.dll" )
possiblePaths+=( "$toolset_dir/net7.0/Microsoft.DotNet.ArcadeLogging.dll" )
possiblePaths+=( "$toolset_dir/net7.0/Microsoft.DotNet.Arcade.Sdk.dll" )
for path in "${possiblePaths[@]}"; do
if [[ -f $path ]]; then
selectedPath=$path

Просмотреть файл

@ -1,14 +1,14 @@
{
"sdk": {
"version": "7.0.100",
"version": "8.0.100-alpha.1.23061.8",
"allowPrerelease": true,
"rollForward": "major"
},
"tools": {
"dotnet": "7.0.100"
"dotnet": "8.0.100-alpha.1.23061.8"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.22630.1",
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.23067.5",
"Microsoft.FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0",
"Microsoft.NET.Sdk.IL": "7.0.0-rtm.22507.1"
}

Просмотреть файл

@ -164,7 +164,7 @@ namespace ILLink.RoslynAnalyzer
}
}
static IEnumerable<Diagnostic> GetDynamicallyAccessedMembersDiagnostics (SingleValue sourceValue, SingleValue targetValue, Location location)
static List<Diagnostic> GetDynamicallyAccessedMembersDiagnostics (SingleValue sourceValue, SingleValue targetValue, Location location)
{
// The target should always be an annotated value, but the visitor design currently prevents
// declaring this in the type system.

Просмотреть файл

@ -11,7 +11,7 @@ namespace ILLink.Shared.TypeSystemProxy
{
public ParameterProxy (IParameterSymbol parameter)
{
Method = (new ((IMethodSymbol) parameter.ContainingSymbol));
Method = new ((IMethodSymbol) parameter.ContainingSymbol);
Index = (ParameterIndex) parameter.Ordinal + (Method.HasImplicitThis () ? 1 : 0);
}

Просмотреть файл

@ -108,5 +108,8 @@ namespace ILLink.Shared.DataFlow
// Prevent warning CS0659 https://docs.microsoft.com/en-us/dotnet/csharp/misc/cs0659.
// This type should never be used as a dictionary key.
public override int GetHashCode () => throw new NotImplementedException ();
public static bool operator == (DefaultValueDictionary<TKey, TValue> left, DefaultValueDictionary<TKey, TValue> right) => left.Equals (right);
public static bool operator != (DefaultValueDictionary<TKey, TValue> left, DefaultValueDictionary<TKey, TValue> right) => !(left == right);
}
}

Просмотреть файл

@ -26,6 +26,9 @@ namespace ILLink.Shared.DataFlow
return new (copyValue.DeepCopy ());
return new (value);
}
public static bool operator == (Maybe<T> left, Maybe<T> right) => left.Equals (right);
public static bool operator != (Maybe<T> left, Maybe<T> right) => !(left == right);
}
public struct MaybeLattice<T, TValueLattice> : ILattice<Maybe<T>>

Просмотреть файл

@ -120,6 +120,9 @@ namespace ILLink.Shared.DataFlow
}
}
public static bool operator == (ValueSet<TValue> left, ValueSet<TValue> right) => left.Equals (right);
public static bool operator != (ValueSet<TValue> left, ValueSet<TValue> right) => !(left == right);
public override int GetHashCode ()
{
if (_values == null)

Просмотреть файл

@ -38,6 +38,7 @@ namespace ILLink.Shared.TypeSystemProxy
WellKnownType.System_NotSupportedException => ("System", "NotSupportedException"),
WellKnownType.System_Runtime_CompilerServices_DisablePrivateReflectionAttribute => ("System.Runtime.CompilerServices", "DisablePrivateReflectionAttribute"),
WellKnownType.System_Void => ("System", "Void"),
_ => throw new System.ArgumentException (type.ToString ())
};
}
public static string GetNamespace (this WellKnownType type) => GetNamespaceAndName (type).Namespace;

Просмотреть файл

@ -22,6 +22,8 @@
<Nullable>disable</Nullable>
<!-- Targets don't match the package id. This is intentional. -->
<NoWarn>$(NoWarn);NU5129</NoWarn>
<!-- Workaround for possible SDK issue - see https://github.com/dotnet/linker/issues/3190 -->
<IncludeProjectsNotInAssetsFileInDepsFile>true</IncludeProjectsNotInAssetsFileInDepsFile>
</PropertyGroup>
<ItemGroup>

Просмотреть файл

@ -260,7 +260,7 @@ namespace ILLink.Tasks
var taskDirectory = Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location);
// The linker always runs on .NET Core, even when using desktop MSBuild to host ILLink.Tasks.
_illinkPath = Path.Combine (Path.GetDirectoryName (taskDirectory), "net7.0", "illink.dll");
_illinkPath = Path.Combine (Path.GetDirectoryName (taskDirectory), "net8.0", "illink.dll");
return _illinkPath;
}
set => _illinkPath = value;

Просмотреть файл

@ -26,5 +26,8 @@ namespace Mono.Linker.Dataflow
public override bool Equals (object? obj) => obj is HoistedLocalKey other && Equals (other);
public override int GetHashCode () => Field.GetHashCode ();
public static bool operator == (HoistedLocalKey left, HoistedLocalKey right) => left.Equals (right);
public static bool operator != (HoistedLocalKey left, HoistedLocalKey right) => !(left == right);
}
}

Просмотреть файл

@ -64,5 +64,8 @@ namespace Mono.Linker.Dataflow
public override bool Equals (object? obj) => obj is ValueBasicBlockPair other && Equals (other);
public override int GetHashCode () => HashUtils.Combine (Value.GetHashCode (), BasicBlockIndex);
public static bool operator == (ValueBasicBlockPair left, ValueBasicBlockPair right) => left.Equals (right);
public static bool operator != (ValueBasicBlockPair left, ValueBasicBlockPair right) => !(left == right);
}
}

Просмотреть файл

@ -17,6 +17,8 @@
<!-- There are currently no translations, so the satellite assemblies are a waste of space. -->
<EnableXlfLocalization>false</EnableXlfLocalization>
<NoWarn Condition="'$(DotNetBuildFromSource)' == 'true'">$(NoWarn);CS8524</NoWarn>
<!-- Workaround for possible SDK issue - see https://github.com/dotnet/linker/issues/3190 -->
<IncludeProjectsNotInAssetsFileInDepsFile>true</IncludeProjectsNotInAssetsFileInDepsFile>
</PropertyGroup>
<ItemGroup>

Просмотреть файл

@ -287,6 +287,10 @@ build_property.{MSBuildPropertyOptionNames.EnableSingleFileAnalyzer} = true")));
}
""";
return VerifyRequiresAssemblyFilesAnalyzer (src,
// (7,7): warning SYSLIB0044: 'AssemblyName.CodeBase' is obsolete: 'AssemblyName.CodeBase and AssemblyName.EscapedCodeBase are obsolete. Using them for loading an assembly is not supported.'
DiagnosticResult.CompilerWarning ("SYSLIB0044").WithSpan (7, 7, 7, 17).WithArguments ("System.Reflection.AssemblyName.CodeBase", "AssemblyName.CodeBase and AssemblyName.EscapedCodeBase are obsolete. Using them for loading an assembly is not supported."),
// (8,7): warning SYSLIB0044: 'AssemblyName.EscapedCodeBase' is obsolete: 'AssemblyName.CodeBase and AssemblyName.EscapedCodeBase are obsolete. Using them for loading an assembly is not supported.'
DiagnosticResult.CompilerWarning ("SYSLIB0044").WithSpan (8, 7, 8, 24).WithArguments ("System.Reflection.AssemblyName.EscapedCodeBase", "AssemblyName.CodeBase and AssemblyName.EscapedCodeBase are obsolete. Using them for loading an assembly is not supported."),
// (7,7): warning IL3002: Using member 'System.Reflection.AssemblyName.CodeBase.get' which has 'RequiresAssemblyFilesAttribute' can break functionality when embedded in a single-file app. The code will return an empty string for assemblies embedded in a single-file app.
VerifyCS.Diagnostic (DiagnosticId.RequiresAssemblyFiles).WithSpan (7, 7, 7, 17).WithArguments ("System.Reflection.AssemblyName.CodeBase.get", " The code will return an empty string for assemblies embedded in a single-file app.", ""),
// (7,7): warning IL3000: 'System.Reflection.AssemblyName.CodeBase' always returns an empty string for assemblies embedded in a single-file app. If the path to the app directory is needed, consider calling 'System.AppContext.BaseDirectory'.

Просмотреть файл

@ -26,9 +26,9 @@ namespace ILLink.RoslynAnalyzer.Tests
public static readonly ReferenceAssemblies Net6PreviewAssemblies =
new ReferenceAssemblies (
"net7.0",
new PackageIdentity ("Microsoft.NETCore.App.Ref", "7.0.0-preview.5.22301.12"),
Path.Combine ("ref", "net7.0"))
"net8.0",
new PackageIdentity ("Microsoft.NETCore.App.Ref", "8.0.0-alpha.1.23060.19"),
Path.Combine ("ref", "net8.0"))
.WithNuGetConfigFilePath (Path.Combine (TestCaseUtils.GetRepoRoot (), "NuGet.config"));
private static ImmutableArray<MetadataReference> s_net6Refs;

Просмотреть файл

@ -585,9 +585,7 @@ namespace ILLink.RoslynAnalyzer.Tests
public MatchQuality (int value)
{
if (value < 0) {
throw new ArgumentOutOfRangeException (nameof (value));
}
ArgumentOutOfRangeException.ThrowIfNegative (value);
_value = value;
}

Просмотреть файл

@ -10,8 +10,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions
{
public ExpectedInstructionSequenceAttribute (string[] opCodes)
{
if (opCodes == null)
throw new ArgumentNullException (nameof (opCodes));
ArgumentNullException.ThrowIfNull (opCodes);
}
}
}

Просмотреть файл

@ -12,12 +12,10 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions
{
if (string.IsNullOrEmpty (assemblyFileName))
throw new ArgumentNullException (nameof (assemblyFileName));
if (type == null)
throw new ArgumentNullException (nameof (type));
ArgumentNullException.ThrowIfNull (type);
if (string.IsNullOrEmpty (memberName))
throw new ArgumentNullException (nameof (memberName));
if (opCodes == null)
throw new ArgumentNullException (nameof (opCodes));
ArgumentNullException.ThrowIfNull (opCodes);
}
public ExpectedInstructionSequenceOnMemberInAssemblyAttribute (string assemblyFileName, string typeName, string memberName, string[] opCodes)
@ -28,8 +26,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions
throw new ArgumentNullException (nameof (typeName));
if (string.IsNullOrEmpty (memberName))
throw new ArgumentNullException (nameof (memberName));
if (opCodes == null)
throw new ArgumentNullException (nameof (opCodes));
ArgumentNullException.ThrowIfNull (opCodes);
}
}
}

Просмотреть файл

@ -10,14 +10,12 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions
{
public ExpectedLocalsSequenceAttribute (string[] types)
{
if (types == null)
throw new ArgumentNullException (nameof (types));
ArgumentNullException.ThrowIfNull (types);
}
public ExpectedLocalsSequenceAttribute (Type[] types)
{
if (types == null)
throw new ArgumentNullException (nameof (types));
ArgumentNullException.ThrowIfNull (types);
}
}
}

Просмотреть файл

@ -11,8 +11,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions
public IgnoreTestCaseAttribute (string reason)
{
if (reason == null)
throw new ArgumentNullException (nameof (reason));
ArgumentNullException.ThrowIfNull (reason);
}
}
}

Просмотреть файл

@ -17,8 +17,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions
public KeptAttributeAttribute (Type type)
{
if (type == null)
throw new ArgumentNullException (nameof (type));
ArgumentNullException.ThrowIfNull (type);
}
}
}

Просмотреть файл

@ -16,8 +16,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions
public KeptAttributeOnFixedBufferTypeAttribute (Type type)
{
if (type == null)
throw new ArgumentNullException (nameof (type));
ArgumentNullException.ThrowIfNull (type);
}
}
}

Просмотреть файл

@ -10,8 +10,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions
{
public KeptBaseOnTypeInAssemblyAttribute (string assemblyFileName, Type type, string baseAssemblyFileName, Type baseType)
{
if (type == null)
throw new ArgumentNullException (nameof (type));
ArgumentNullException.ThrowIfNull (type);
if (string.IsNullOrEmpty (assemblyFileName))
throw new ArgumentException ("Value cannot be null or empty.", nameof (assemblyFileName));

Просмотреть файл

@ -10,16 +10,13 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions
{
public KeptBaseTypeAttribute (Type baseType)
{
if (baseType == null)
throw new ArgumentNullException (nameof (baseType));
ArgumentNullException.ThrowIfNull (baseType);
}
public KeptBaseTypeAttribute (Type baseType, params object[] typeArguments)
{
if (baseType == null)
throw new ArgumentNullException (nameof (baseType));
if (typeArguments == null)
throw new ArgumentNullException (nameof (typeArguments));
ArgumentNullException.ThrowIfNull (baseType);
ArgumentNullException.ThrowIfNull (typeArguments);
}
}
}

Просмотреть файл

@ -13,8 +13,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions
{
public KeptExportedTypeAttribute (Type type)
{
if (type is null)
throw new ArgumentNullException (nameof (type));
ArgumentNullException.ThrowIfNull (type);
}
}
}

Просмотреть файл

@ -15,8 +15,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions
public KeptInitializerData (int occurrenceIndexInBody)
{
if (occurrenceIndexInBody < 0)
throw new ArgumentOutOfRangeException (nameof (occurrenceIndexInBody));
ArgumentOutOfRangeException.ThrowIfNegative (occurrenceIndexInBody);
}
}
}

Просмотреть файл

@ -11,16 +11,13 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions
public KeptInterfaceAttribute (Type interfaceType)
{
if (interfaceType == null)
throw new ArgumentNullException (nameof (interfaceType));
ArgumentNullException.ThrowIfNull (interfaceType);
}
public KeptInterfaceAttribute (Type interfaceType, params object[] typeArguments)
{
if (interfaceType == null)
throw new ArgumentNullException (nameof (interfaceType));
if (typeArguments == null)
throw new ArgumentNullException (nameof (typeArguments));
ArgumentNullException.ThrowIfNull (interfaceType);
ArgumentNullException.ThrowIfNull (typeArguments);
}
}
}

Просмотреть файл

@ -10,8 +10,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions
{
public KeptInterfaceOnTypeInAssemblyAttribute (string assemblyFileName, Type type, string interfaceAssemblyFileName, Type interfaceType)
{
if (type == null)
throw new ArgumentNullException (nameof (type));
ArgumentNullException.ThrowIfNull (type);
if (string.IsNullOrEmpty (assemblyFileName))
throw new ArgumentException ("Value cannot be null or empty.", nameof (assemblyFileName));

Просмотреть файл

@ -13,20 +13,16 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions
{
if (string.IsNullOrEmpty (assemblyFileName))
throw new ArgumentNullException (nameof (assemblyFileName));
if (type == null)
throw new ArgumentNullException (nameof (type));
if (memberNames == null)
throw new ArgumentNullException (nameof (memberNames));
ArgumentNullException.ThrowIfNull (type);
ArgumentNullException.ThrowIfNull (memberNames);
}
public KeptMemberInAssemblyAttribute (string assemblyFileName, string typeName, params string[] memberNames)
{
if (string.IsNullOrEmpty (assemblyFileName))
throw new ArgumentNullException (nameof (assemblyFileName));
if (typeName == null)
throw new ArgumentNullException (nameof (typeName));
if (memberNames == null)
throw new ArgumentNullException (nameof (memberNames));
ArgumentNullException.ThrowIfNull (typeName);
ArgumentNullException.ThrowIfNull (memberNames);
}
public string ExpectationAssemblyName { get; set; }

Просмотреть файл

@ -19,8 +19,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions
public KeptOverrideAttribute (Type typeWithOverriddenMethod)
{
if (typeWithOverriddenMethod == null)
throw new ArgumentNullException (nameof (typeWithOverriddenMethod));
ArgumentNullException.ThrowIfNull (typeWithOverriddenMethod);
TypeWithOverriddenMethodDeclaration = typeWithOverriddenMethod;
}
}

Просмотреть файл

@ -13,8 +13,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions
if (string.IsNullOrEmpty (assemblyFileName))
throw new ArgumentNullException (nameof (assemblyFileName));
if (expectedReferenceAssemblyNames == null)
throw new ArgumentNullException (nameof (expectedReferenceAssemblyNames));
ArgumentNullException.ThrowIfNull (expectedReferenceAssemblyNames);
}
}
}

Просмотреть файл

@ -16,8 +16,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions
public KeptSecurityAttribute (Type type)
{
if (type == null)
throw new ArgumentNullException (nameof (type));
ArgumentNullException.ThrowIfNull (type);
}
}
}

Просмотреть файл

@ -10,8 +10,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions
{
public KeptTypeInAssemblyAttribute (string assemblyFileName, Type type)
{
if (type == null)
throw new ArgumentNullException (nameof (type));
ArgumentNullException.ThrowIfNull (type);
if (string.IsNullOrEmpty (assemblyFileName))
throw new ArgumentException ("Value cannot be null or empty.", nameof (assemblyFileName));
}

Просмотреть файл

@ -10,8 +10,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions
{
public RemovedInterfaceOnTypeInAssemblyAttribute (string assemblyFileName, Type type, string interfaceAssemblyFileName, Type interfaceType)
{
if (type == null)
throw new ArgumentNullException (nameof (type));
ArgumentNullException.ThrowIfNull (type);
if (string.IsNullOrEmpty (assemblyFileName))
throw new ArgumentException ("Value cannot be null or empty.", nameof (assemblyFileName));

Просмотреть файл

@ -13,20 +13,16 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions
{
if (string.IsNullOrEmpty (assemblyFileName))
throw new ArgumentNullException (nameof (assemblyFileName));
if (type == null)
throw new ArgumentNullException (nameof (type));
if (memberNames == null)
throw new ArgumentNullException (nameof (memberNames));
ArgumentNullException.ThrowIfNull (type);
ArgumentNullException.ThrowIfNull (memberNames);
}
public RemovedMemberInAssemblyAttribute (string assemblyFileName, string typeName, params string[] memberNames)
{
if (string.IsNullOrEmpty (assemblyFileName))
throw new ArgumentNullException (nameof (assemblyFileName));
if (typeName == null)
throw new ArgumentNullException (nameof (typeName));
if (memberNames == null)
throw new ArgumentNullException (nameof (memberNames));
ArgumentNullException.ThrowIfNull (typeName);
ArgumentNullException.ThrowIfNull (memberNames);
}
}
}

Просмотреть файл

@ -10,8 +10,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions
{
public RemovedTypeInAssemblyAttribute (string assemblyFileName, Type type)
{
if (type == null)
throw new ArgumentNullException (nameof (type));
ArgumentNullException.ThrowIfNull (type);
if (string.IsNullOrEmpty (assemblyFileName))
throw new ArgumentException ("Value cannot be null or empty.", nameof (assemblyFileName));
}

Просмотреть файл

@ -10,8 +10,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Assertions
{
public TestCaseRequirementsAttribute (TestRunCharacteristics targetFrameworkCharacteristics, string reason)
{
if (reason == null)
throw new ArgumentNullException (nameof (reason));
ArgumentNullException.ThrowIfNull (reason);
}
}
}

Просмотреть файл

@ -13,8 +13,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Metadata
{
public SetupCompileAfterAttribute (string outputName, string[] sourceFiles, string[] references = null, string[] defines = null, object[] resources = null, string additionalArguments = null, string compilerToUse = null, bool addAsReference = true, bool removeFromLinkerInput = false)
{
if (sourceFiles == null)
throw new ArgumentNullException (nameof (sourceFiles));
ArgumentNullException.ThrowIfNull (sourceFiles);
if (string.IsNullOrEmpty (outputName))
throw new ArgumentException ("Value cannot be null or empty.", nameof (outputName));

Просмотреть файл

@ -13,8 +13,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Metadata
{
public SetupCompileBeforeAttribute (string outputName, string[] sourceFiles, string[] references = null, string[] defines = null, object[] resources = null, string additionalArguments = null, string compilerToUse = null, bool addAsReference = true, bool removeFromLinkerInput = false, string outputSubFolder = null)
{
if (sourceFiles == null)
throw new ArgumentNullException (nameof (sourceFiles));
ArgumentNullException.ThrowIfNull (sourceFiles);
if (string.IsNullOrEmpty (outputName))
throw new ArgumentException ("Value cannot be null or empty.", nameof (outputName));
@ -35,8 +34,7 @@ namespace Mono.Linker.Tests.Cases.Expectations.Metadata
public SetupCompileBeforeAttribute (string outputName, Type[] typesToIncludeSourceFor, string[] references = null, string[] defines = null, object[] resources = null, string additionalArguments = null, string compilerToUse = null, bool addAsReference = true, bool removeFromLinkerInput = false)
{
if (typesToIncludeSourceFor == null)
throw new ArgumentNullException (nameof (typesToIncludeSourceFor));
ArgumentNullException.ThrowIfNull (typesToIncludeSourceFor);
if (string.IsNullOrEmpty (outputName))
throw new ArgumentException ("Value cannot be null or empty.", nameof (outputName));

Просмотреть файл

@ -47,8 +47,7 @@ namespace Mono.Linker.Tests.Extensions
public NPath (string path)
{
if (path == null)
throw new ArgumentNullException (nameof (path));
ArgumentNullException.ThrowIfNull (path);
path = ParseDriveLetter (path, out _driveLetter);

Просмотреть файл

@ -325,7 +325,7 @@ namespace Mono.Linker.Tests.TestCasesRunner
Assert.True (linked.DeclaringType.Interfaces.Select (i => i.InterfaceType).Contains (overriddenMethod.DeclaringType),
$"Method {linked} overrides method {overriddenMethod}, but {linked.DeclaringType} does not implement interface {overriddenMethod.DeclaringType}");
} else {
TypeReference baseType = linked.DeclaringType;
TypeDefinition baseType = linked.DeclaringType;
TypeReference overriddenType = overriddenMethod.DeclaringType;
while (baseType is not null) {
if (baseType.Equals (overriddenType))

Просмотреть файл

@ -14,7 +14,9 @@ namespace Mono.Linker.Tests.TestCasesRunner
public const string ConfigDirectoryName = "Release";
#endif
#if NET7_0
#if NET8_0
public const string TFMDirectoryName = "net8.0";
#elif NET7_0
public const string TFMDirectoryName = "net7.0";
#elif NET6_0
public const string TFMDirectoryName = "net6.0";

Просмотреть файл

@ -106,7 +106,7 @@ namespace Mono.Linker.Tests.TestCasesRunner
};
}
private IEnumerable<NPath> CompileBeforeTestCaseAssemblies (NPath outputDirectory, NPath[] references, string[] defines, IList<NPath> removeFromLinkerInputAssemblies)
private IEnumerable<NPath> CompileBeforeTestCaseAssemblies (NPath outputDirectory, NPath[] references, string[] defines, List<NPath> removeFromLinkerInputAssemblies)
{
foreach (var setupCompileInfo in _metadataProvider.GetSetupCompileAssembliesBefore ()) {
NPath outputFolder;
@ -134,7 +134,7 @@ namespace Mono.Linker.Tests.TestCasesRunner
}
}
private void CompileAfterTestCaseAssemblies (NPath outputDirectory, NPath[] references, string[] defines, IList<NPath> removeFromLinkerInputAssemblies)
private void CompileAfterTestCaseAssemblies (NPath outputDirectory, NPath[] references, string[] defines, List<NPath> removeFromLinkerInputAssemblies)
{
foreach (var setupCompileInfo in _metadataProvider.GetSetupCompileAssembliesAfter ()) {
var options = CreateOptionsForSupportingAssembly (