Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Directory.Build.props2
-rw-r--r--eng/Version.Details.xml2
-rw-r--r--eng/Versions.props3
-rw-r--r--eng/ilasm.ilproj2
-rw-r--r--global.json6
-rw-r--r--src/ILLink.Tasks/ILLink.Tasks.csproj4
-rw-r--r--src/ILLink.Tasks/LinkTask.cs2
-rw-r--r--src/ILLink.Tasks/Sdk/Sdk.props2
-rw-r--r--src/analyzer/analyzer.csproj2
-rw-r--r--src/analyzer/common/Mono.Options/Options.cs2
-rw-r--r--src/linker/Directory.Build.props1
-rw-r--r--src/linker/Mono.Linker.csproj2
-rw-r--r--src/linker/ref/Mono.Linker.csproj1
-rw-r--r--test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.csproj2
-rw-r--r--test/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj6
-rw-r--r--test/Mono.Linker.Tests.Cases/DataFlow/XmlAnnotations.xml16
-rw-r--r--test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyFromAttributeXml.cs10
-rw-r--r--test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyFromAttributeXml.mono.Attributes.xml12
-rw-r--r--test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyFromAttributeXml.netcore.Attributes.xml (renamed from test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyFromAttributeXml.Attributes.xml)2
-rw-r--r--test/Mono.Linker.Tests.Cases/LinkAttributes/OverrideAttributeRemoval.xml3
-rw-r--r--test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj4
-rw-r--r--test/Mono.Linker.Tests.Cases/Reflection/ActivatorCreateInstance.cs4
-rw-r--r--test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/SuppressWarningsUsingTargetViaXml.cs10
-rw-r--r--test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/SuppressWarningsUsingTargetViaXml.mono.xml (renamed from test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/SuppressWarningsUsingTargetViaXml.xml)0
-rw-r--r--test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/SuppressWarningsUsingTargetViaXml.netcore.xml35
-rw-r--r--test/Mono.Linker.Tests/Mono.Linker.Tests.csproj15
-rw-r--r--test/Mono.Linker.Tests/TestCasesRunner/PathUtilities.cs6
-rw-r--r--test/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs4
-rw-r--r--test/Mono.Linker.Tests/TestCasesRunner/TestCaseSandbox.cs2
29 files changed, 116 insertions, 46 deletions
diff --git a/Directory.Build.props b/Directory.Build.props
index 655264983..e1fcd8960 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -7,6 +7,8 @@
<IsReferenceAssembly Condition="'$(IsReferenceAssembly)' == '' and '$([System.IO.Path]::GetFileName($(MSBuildProjectDirectory)))' == 'ref'">true</IsReferenceAssembly>
</PropertyGroup>
<PropertyGroup Condition=" '$(IsReferenceAssembly)' == 'true' ">
+ <!-- Since .NET 5 reference assemblies are always produced -->
+ <ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<ProduceOnlyReferenceAssembly>true</ProduceOnlyReferenceAssembly>
<!-- Used by Arcade to compute OutputPath, IntermediateOutputPath, etc. early in the import chain. -->
<OutDirName>$(MSBuildProjectName)/ref</OutDirName>
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index 1742468cd..0577df921 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -3,7 +3,7 @@
<ProductDependencies>
</ProductDependencies>
<ToolsetDependencies>
- <Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="5.0.0-beta.20464.13">
+ <Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="5.0.0-beta.20466.13">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>bd918c64b786bdba42e895e4cb93603e5a2ca608</Sha>
</Dependency>
diff --git a/eng/Versions.props b/eng/Versions.props
index e5ddd7166..b73c26a7a 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -17,11 +17,12 @@
<!-- see https://github.com/dotnet/runtime/issues/1338 -->
<MicrosoftNETCoreILAsmVersion>$(MicrosoftNETSdkILPackageVersion)</MicrosoftNETCoreILAsmVersion>
<!-- These should match the SDK version at https://github.com/dotnet/sdk/blob/master/eng/Versions.props -->
- <SystemReflectionMetadataVersion>1.5.0</SystemReflectionMetadataVersion>
+ <SystemReflectionMetadataVersion>1.8.0</SystemReflectionMetadataVersion>
<MicrosoftBuildFrameworkVersion>15.4.8</MicrosoftBuildFrameworkVersion>
<MicrosoftBuildUtilitiesCoreVersion>15.4.8</MicrosoftBuildUtilitiesCoreVersion>
<MicrosoftDotNetApiCompatVersion>5.0.0-beta.20464.13</MicrosoftDotNetApiCompatVersion>
<!-- We depend on (and redistribute) the official Mono.Cecil NuGet package built from https://github.com/jbevain/cecil -->
<MonoCecilVersion>0.11.2</MonoCecilVersion>
+ <UseVSTestRunner>true</UseVSTestRunner>
</PropertyGroup>
</Project>
diff --git a/eng/ilasm.ilproj b/eng/ilasm.ilproj
index b8be3b2b2..3a11b2bfe 100644
--- a/eng/ilasm.ilproj
+++ b/eng/ilasm.ilproj
@@ -4,7 +4,7 @@
project. -->
<PropertyGroup>
- <TargetFramework>netcoreapp3.0</TargetFramework>
+ <TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<Target Name="CopyILAsmTool" DependsOnTargets="ResolveIlasmToolPaths" Condition="'$(MonoBuild)' == ''">
diff --git a/global.json b/global.json
index 1ff2cfb51..1c9fe9379 100644
--- a/global.json
+++ b/global.json
@@ -1,14 +1,14 @@
{
"tools": {
- "dotnet": "5.0.100-preview.6.20310.4",
+ "dotnet": "5.0.100-rc.1.20454.5",
"runtimes": {
"dotnet": [
- "3.0.0"
+ "5.0.0-rc.1.20451.14"
]
}
},
"msbuild-sdks": {
- "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20464.13",
+ "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20466.13",
"Microsoft.FIX-85B6-MERGE-9C38-CONFLICT": "1.0.0",
"Microsoft.NET.Sdk.IL": "6.0.0-alpha.1.20463.3"
}
diff --git a/src/ILLink.Tasks/ILLink.Tasks.csproj b/src/ILLink.Tasks/ILLink.Tasks.csproj
index ef9492456..36a49f016 100644
--- a/src/ILLink.Tasks/ILLink.Tasks.csproj
+++ b/src/ILLink.Tasks/ILLink.Tasks.csproj
@@ -2,7 +2,7 @@
<PropertyGroup>
<!-- Keep these in sync with _ILLinkTasksTFM in Sdk.props. -->
<!-- Keep the netcoreapp TFM in sync with the Mono.Linker.csproj condition below. -->
- <TargetFrameworks>netcoreapp3.0;net472</TargetFrameworks>
+ <TargetFrameworks>net5.0;net472</TargetFrameworks>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<Description>MSBuild tasks for running the IL Linker</Description>
<LangVersion>latest</LangVersion>
@@ -36,7 +36,7 @@
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="../linker/Mono.Linker.csproj" PrivateAssets="All" Condition=" '$(TargetFramework)' == 'netcoreapp3.0' " />
+ <ProjectReference Include="../linker/Mono.Linker.csproj" PrivateAssets="All" Condition=" '$(TargetFramework)' == 'net5.0' " />
<PackageReference Condition="'$(UseCecilPackage)' == 'true'" Include="Mono.Cecil" Version="$(MonoCecilVersion)" PrivateAssets="All" Publish="True" />
<ProjectReference Condition="'$(UseCecilPackage)' != 'true'" Include="../../external/cecil/Mono.Cecil.csproj" PrivateAssets="All" />
</ItemGroup>
diff --git a/src/ILLink.Tasks/LinkTask.cs b/src/ILLink.Tasks/LinkTask.cs
index 11da51673..a2960f1c4 100644
--- a/src/ILLink.Tasks/LinkTask.cs
+++ b/src/ILLink.Tasks/LinkTask.cs
@@ -235,7 +235,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), "netcoreapp3.0", "illink.dll");
+ _illinkPath = Path.Combine (Path.GetDirectoryName (taskDirectory), "net5.0", "illink.dll");
return _illinkPath;
}
set => _illinkPath = value;
diff --git a/src/ILLink.Tasks/Sdk/Sdk.props b/src/ILLink.Tasks/Sdk/Sdk.props
index 89633629c..fc938c6b8 100644
--- a/src/ILLink.Tasks/Sdk/Sdk.props
+++ b/src/ILLink.Tasks/Sdk/Sdk.props
@@ -13,7 +13,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<PropertyGroup>
<_ILLinkTasksDirectoryRoot Condition=" '$(_ILLinkTasksDirectoryRoot)' == '' ">$(MSBuildThisFileDirectory)../tools/</_ILLinkTasksDirectoryRoot>
- <_ILLinkTasksTFM Condition=" '$(MSBuildRuntimeType)' == 'Core' ">netcoreapp3.0</_ILLinkTasksTFM>
+ <_ILLinkTasksTFM Condition=" '$(MSBuildRuntimeType)' == 'Core' ">net5.0</_ILLinkTasksTFM>
<_ILLinkTasksTFM Condition=" '$(_ILLinkTasksTFM)' == '' ">net472</_ILLinkTasksTFM>
<_ILLinkTasksDirectory>$(_ILLinkTasksDirectoryRoot)$(_ILLinkTasksTFM)/</_ILLinkTasksDirectory>
<ILLinkTasksAssembly Condition=" '$(ILLinkTasksAssembly)' == '' ">$(_ILLinkTasksDirectory)ILLink.Tasks.dll</ILLinkTasksAssembly>
diff --git a/src/analyzer/analyzer.csproj b/src/analyzer/analyzer.csproj
index c9b38b487..3166183ec 100644
--- a/src/analyzer/analyzer.csproj
+++ b/src/analyzer/analyzer.csproj
@@ -9,7 +9,7 @@
<PropertyGroup Condition="'$(MonoBuild)' == ''">
<DefineConstants>$(DefineConstants);FEATURE_ILLINK</DefineConstants>
- <TargetFramework>netcoreapp3.0</TargetFramework>
+ <TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(MonoBuild)' != ''">
diff --git a/src/analyzer/common/Mono.Options/Options.cs b/src/analyzer/common/Mono.Options/Options.cs
index a68c1608b..a289e6281 100644
--- a/src/analyzer/common/Mono.Options/Options.cs
+++ b/src/analyzer/common/Mono.Options/Options.cs
@@ -748,7 +748,7 @@ namespace Mono.Options
get {return this.option;}
}
-#if !PCL
+#if !PCL && !NETCOREAPP
#pragma warning disable 618 // SecurityPermissionAttribute is obsolete
[SecurityPermission (SecurityAction.LinkDemand, SerializationFormatter = true)]
#pragma warning restore 618
diff --git a/src/linker/Directory.Build.props b/src/linker/Directory.Build.props
index bc3e9d940..1fad0962e 100644
--- a/src/linker/Directory.Build.props
+++ b/src/linker/Directory.Build.props
@@ -10,7 +10,6 @@
<PropertyGroup Condition="'$(MonoBuild)' == ''">
<AssemblyName>illink</AssemblyName>
<Description>IL Linker</Description>
- <TargetFramework>netcoreapp3.0</TargetFramework>
<PackageId>Microsoft.NET.ILLink</PackageId>
</PropertyGroup>
diff --git a/src/linker/Mono.Linker.csproj b/src/linker/Mono.Linker.csproj
index dd9a28c04..471e6d0b3 100644
--- a/src/linker/Mono.Linker.csproj
+++ b/src/linker/Mono.Linker.csproj
@@ -6,6 +6,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(MonoBuild)' == ''">
+ <TargetFramework>net5.0</TargetFramework>
<DefineConstants>$(DefineConstants);FEATURE_ILLINK</DefineConstants>
<IsPackable>true</IsPackable>
<!-- Nuget issues a warning about missing <reference> items in the generated nuspec,
@@ -33,6 +34,7 @@
<Compile Remove="Linker.Steps\PreserveCalendarsStep.cs" />
<Compile Remove="Linker.Steps\RemoveFeaturesStep.cs" />
<Compile Remove="Linker.Steps\ResolveFromXApiStep.cs" />
+ <Compile Remove="System.Diagnostics.CodeAnalysis\*.cs" />
</ItemGroup>
<ItemGroup>
diff --git a/src/linker/ref/Mono.Linker.csproj b/src/linker/ref/Mono.Linker.csproj
index 57aa9c39c..889711910 100644
--- a/src/linker/ref/Mono.Linker.csproj
+++ b/src/linker/ref/Mono.Linker.csproj
@@ -2,6 +2,7 @@
<PropertyGroup>
<BuildOutputTargetFolder>ref</BuildOutputTargetFolder>
+ <TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
diff --git a/test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.csproj b/test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.csproj
index 44010a535..871a186c3 100644
--- a/test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.csproj
+++ b/test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFramework>netcoreapp3.0</TargetFramework>
+ <TargetFramework>net5.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj b/test/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj
index 656d7fd9b..fe28def77 100644
--- a/test/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj
+++ b/test/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj
@@ -5,10 +5,14 @@
</PropertyGroup>
<PropertyGroup Condition="'$(MonoBuild)' == ''">
- <TargetFramework>netcoreapp3.0</TargetFramework>
+ <TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(MonoBuild)' != ''">
<TargetFramework>net471</TargetFramework>
</PropertyGroup>
+ <ItemGroup Condition="'$(MonoBuild)' == ''">
+ <Compile Remove="System.Diagnostics.CodeAnalysis\*.cs" />
+ </ItemGroup>
+
</Project>
diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/XmlAnnotations.xml b/test/Mono.Linker.Tests.Cases/DataFlow/XmlAnnotations.xml
index 46fb37653..2108bcebd 100644
--- a/test/Mono.Linker.Tests.Cases/DataFlow/XmlAnnotations.xml
+++ b/test/Mono.Linker.Tests.Cases/DataFlow/XmlAnnotations.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<linker>
<assembly fullname="Test">
- <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute" assembly="Mono.Linker.Tests.Cases.Expectations">
+ <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2067</argument>
<property name="Scope">member</property>
@@ -18,45 +18,45 @@
</field>
<method signature="System.Void TwoAnnotatedParameters(System.Type,System.Type)">
<parameter name="type">
- <attribute fullname="System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute" assembly="Mono.Linker.Tests.Cases.Expectations">
+ <attribute fullname="System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute">
<argument>PublicParameterlessConstructor</argument>
</attribute>
</parameter>
<parameter name="type2">
- <attribute fullname="System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute" assembly="Mono.Linker.Tests.Cases.Expectations">
+ <attribute fullname="System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute">
<argument>PublicConstructors</argument>
</attribute>
</parameter>
</method>
<method signature="SpacesBetweenParametersWrongArgument (System.Type, System.Boolean)">
<parameter name="type">
- <attribute fullname="System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute" assembly="Mono.Linker.Tests.Cases.Expectations">
+ <attribute fullname="System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute">
<argument>NonValidArgument</argument>
</attribute>
</parameter>
</method>
<method signature="GenericMethod&lt;T&gt;(T,System.Type)">
<parameter name="type">
- <attribute fullname="System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute" assembly="Mono.Linker.Tests.Cases.Expectations">
+ <attribute fullname="System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute">
<argument>PublicParameterlessConstructor</argument>
</attribute>
</parameter>
</method>
<method name="ReturnConstructorsFailure">
<return>
- <attribute fullname="System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute" assembly="Mono.Linker.Tests.Cases.Expectations">
+ <attribute fullname="System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute">
<argument>PublicParameterlessConstructor</argument>
</attribute>
</return>
</method>
<property name="PropertyWithPublicParameterlessConstructor">
- <attribute fullname="System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute" assembly="Mono.Linker.Tests.Cases.Expectations">
+ <attribute fullname="System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute">
<argument>PublicParameterlessConstructor</argument>
</attribute>
</property>
<type name="NestedType">
<field name="_typeWithPublicParameterlessConstructor">
- <attribute fullname="System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute" assembly="Mono.Linker.Tests.Cases.Expectations">
+ <attribute fullname="System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute">
<argument>PublicParameterlessConstructor</argument>
</attribute>
</field>
diff --git a/test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyFromAttributeXml.cs b/test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyFromAttributeXml.cs
index 8383e68aa..ea6fc7570 100644
--- a/test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyFromAttributeXml.cs
+++ b/test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyFromAttributeXml.cs
@@ -6,7 +6,15 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata;
namespace Mono.Linker.Tests.Cases.DynamicDependencies
{
- [SetupLinkAttributesFile ("DynamicDependencyFromAttributeXml.Attributes.xml")]
+ // For netcoreapp we don't have to specify the assembly for the attribute, since the attribute comes from corelib
+ // and will be found always.
+ // For mono though, we have to specify the assembly (Mono.Linker.Tests.Cases.Expectations) because at the time of processing
+ // that assembly is not yet loaded into the closure in the linker, so it won't find the attribute type.
+#if NETCOREAPP
+ [SetupLinkAttributesFile ("DynamicDependencyFromAttributeXml.netcore.Attributes.xml")]
+#else
+ [SetupLinkAttributesFile ("DynamicDependencyFromAttributeXml.mono.Attributes.xml")]
+#endif
[IgnoreLinkAttributes (false)]
class DynamicDependencyFromAttributeXml
{
diff --git a/test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyFromAttributeXml.mono.Attributes.xml b/test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyFromAttributeXml.mono.Attributes.xml
new file mode 100644
index 000000000..cbf1c08ba
--- /dev/null
+++ b/test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyFromAttributeXml.mono.Attributes.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<linker>
+ <assembly fullname="test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
+ <type fullname="Mono.Linker.Tests.Cases.DynamicDependencies.DynamicDependencyFromAttributeXml">
+ <method name="DependencyToUnusedMethod">
+ <attribute fullname="System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute" assembly="Mono.Linker.Tests.Cases.Expectations">
+ <argument>UnusedMethod</argument>
+ </attribute>
+ </method>
+ </type>
+ </assembly>
+</linker> \ No newline at end of file
diff --git a/test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyFromAttributeXml.Attributes.xml b/test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyFromAttributeXml.netcore.Attributes.xml
index ce3e630b1..3d7f8cce5 100644
--- a/test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyFromAttributeXml.Attributes.xml
+++ b/test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyFromAttributeXml.netcore.Attributes.xml
@@ -3,7 +3,7 @@
<assembly fullname="test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<type fullname="Mono.Linker.Tests.Cases.DynamicDependencies.DynamicDependencyFromAttributeXml">
<method name="DependencyToUnusedMethod">
- <attribute fullname="System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute" assembly="Mono.Linker.Tests.Cases.Expectations">
+ <attribute fullname="System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute">
<argument>UnusedMethod</argument>
</attribute>
</method>
diff --git a/test/Mono.Linker.Tests.Cases/LinkAttributes/OverrideAttributeRemoval.xml b/test/Mono.Linker.Tests.Cases/LinkAttributes/OverrideAttributeRemoval.xml
index 7bf987d92..b87939b67 100644
--- a/test/Mono.Linker.Tests.Cases/LinkAttributes/OverrideAttributeRemoval.xml
+++ b/test/Mono.Linker.Tests.Cases/LinkAttributes/OverrideAttributeRemoval.xml
@@ -3,4 +3,7 @@
<assembly fullname="Mono.Linker.Tests.Cases.Expectations">
<type fullname="System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute"/>
</assembly>
+ <assembly fullname="System.Runtime">
+ <type fullname="System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute"/>
+ </assembly>
</linker> \ No newline at end of file
diff --git a/test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj b/test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj
index de6e71c09..645f3523e 100644
--- a/test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj
+++ b/test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj
@@ -5,11 +5,11 @@
<WarningLevel>0</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
- <LangVersion>8.0</LangVersion>
+ <LangVersion>Latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(MonoBuild)' == ''">
- <TargetFramework>netcoreapp3.0</TargetFramework>
+ <TargetFramework>net5.0</TargetFramework>
<DefineConstants>$(DefineConstants);ILLINK</DefineConstants>
</PropertyGroup>
diff --git a/test/Mono.Linker.Tests.Cases/Reflection/ActivatorCreateInstance.cs b/test/Mono.Linker.Tests.Cases/Reflection/ActivatorCreateInstance.cs
index b725e109b..532135da3 100644
--- a/test/Mono.Linker.Tests.Cases/Reflection/ActivatorCreateInstance.cs
+++ b/test/Mono.Linker.Tests.Cases/Reflection/ActivatorCreateInstance.cs
@@ -424,6 +424,10 @@ namespace Mono.Linker.Tests.Cases.Reflection
[Kept]
[UnrecognizedReflectionAccessPattern (typeof (Activator), nameof (Activator.CreateInstance) + "<T>", new Type[0], messageCode: "IL2091")]
+#if NETCOREAPP
+ // Warnings are currently duplicated in NETCORE (annotation and intrinsics) - but they're not identical in this case, so we have to list both cases
+ [UnrecognizedReflectionAccessPattern (typeof (Activator), nameof (Activator.CreateInstance) + "<T>()::T", messageCode: "IL2091")]
+#endif
private static void TestCreateInstanceOfTWithNoConstraint<T> ()
{
Activator.CreateInstance<T> ();
diff --git a/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/SuppressWarningsUsingTargetViaXml.cs b/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/SuppressWarningsUsingTargetViaXml.cs
index 17e4c02a8..7c5eb3512 100644
--- a/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/SuppressWarningsUsingTargetViaXml.cs
+++ b/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/SuppressWarningsUsingTargetViaXml.cs
@@ -8,7 +8,15 @@ using Mono.Linker.Tests.Cases.Warnings.WarningSuppression.Dependencies;
namespace Mono.Linker.Tests.Cases.Warnings.WarningSuppression
{
- [SetupLinkAttributesFile ("SuppressWarningsUsingTargetViaXml.xml")]
+ // For netcoreapp we don't have to specify the assembly for the attribute, since the attribute comes from corelib
+ // and will be found always.
+ // For mono though, we have to specify the assembly (Mono.Linker.Tests.Cases.Expectations) because at the time of processing
+ // that assembly is not yet loaded into the closure in the linker, so it won't find the attribute type.
+#if NETCOREAPP
+ [SetupLinkAttributesFile ("SuppressWarningsUsingTargetViaXml.netcore.xml")]
+#else
+ [SetupLinkAttributesFile ("SuppressWarningsUsingTargetViaXml.mono.xml")]
+#endif
[SetupCompileBefore ("library.dll", new[] { "Dependencies/TriggerWarnings_Lib.cs" })]
[KeptAssembly ("library.dll")]
[SetupLinkerAction ("link", "library.dll")]
diff --git a/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/SuppressWarningsUsingTargetViaXml.xml b/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/SuppressWarningsUsingTargetViaXml.mono.xml
index 84d34f02f..84d34f02f 100644
--- a/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/SuppressWarningsUsingTargetViaXml.xml
+++ b/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/SuppressWarningsUsingTargetViaXml.mono.xml
diff --git a/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/SuppressWarningsUsingTargetViaXml.netcore.xml b/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/SuppressWarningsUsingTargetViaXml.netcore.xml
new file mode 100644
index 000000000..4cc4549e4
--- /dev/null
+++ b/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/SuppressWarningsUsingTargetViaXml.netcore.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<linker>
+ <assembly fullname="library, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
+ <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
+ <argument>ILLink</argument>
+ <argument>IL2072</argument>
+ <property name="Scope">member</property>
+ <property name="Target">M:Mono.Linker.Tests.Cases.Warnings.WarningSuppression.Dependencies.TriggerWarnings_Lib.Main</property>
+ </attribute>
+ <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
+ <argument>ILLink</argument>
+ <argument>IL2072</argument>
+ <property name="Scope">member</property>
+ <property name="Target">M:Mono.Linker.Tests.Cases.Warnings.WarningSuppression.Dependencies.TriggerWarnings_Lib.NestedType.Warning3</property>
+ </attribute>
+ <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
+ <argument>ILLink</argument>
+ <argument>IL2072</argument>
+ <property name="Scope">member</property>
+ <property name="Target">M:Mono.Linker.Tests.Cases.Warnings.WarningSuppression.Dependencies.TriggerWarnings_Lib.NestedType.Warning4``1(System.Collections.Generic.List{``0}@)</property>
+ </attribute>
+ <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
+ <argument>ILLink</argument>
+ <argument>IL2072</argument>
+ <property name="Scope">member</property>
+ <property name="Target">M:Mono.Linker.Tests.Cases.Warnings.WarningSuppression.Dependencies.TriggerWarnings_Lib.Warning1</property>
+ </attribute>
+ <attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
+ <argument>ILLink</argument>
+ <argument>IL2072</argument>
+ <property name="Scope">member</property>
+ <property name="Target">M:Mono.Linker.Tests.Cases.Warnings.WarningSuppression.Dependencies.TriggerWarnings_Lib.get_Warning2</property>
+ </attribute>
+ </assembly>
+</linker> \ No newline at end of file
diff --git a/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj b/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj
index 416b29854..ff19e3e6e 100644
--- a/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj
+++ b/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj
@@ -1,5 +1,4 @@
-<Project>
- <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
+<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<LangVersion>latest</LangVersion>
@@ -7,11 +6,9 @@
</PropertyGroup>
<PropertyGroup Condition="'$(MonoBuild)' == ''">
- <TargetFramework>netcoreapp3.0</TargetFramework>
+ <TargetFramework>net5.0</TargetFramework>
<DefineConstants>$(DefineConstants);ILLINK</DefineConstants>
<DefineConstants Condition="'$(Configuration)' == 'Debug'">$(DefineConstants);DEBUG</DefineConstants>
- <!-- Simulate https://github.com/dotnet/sdk/pull/2073 until it ships. -->
- <DefineConstants Condition="'$(TargetFramework)' == 'netcoreapp3.0'">$(DefineConstants);NETCOREAPP</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(MonoBuild)' != ''">
@@ -72,12 +69,4 @@
<Exec Command="mono $(PkgNUnit_ConsoleRunner)/tools/nunit3-console.exe --result=TestResults.xml $(OutputPath)Mono.Linker.Tests.dll" />
</Target>
- <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
-
- <!-- Arcade's custom test imports assume that we are using xunit. -->
- <!-- Map the Arcade "Test" target to the "VSTest" target used by "dotnet test" -->
- <Target Name="Test" Condition="'$(MonoBuild)' == ''">
- <MSBuild Projects="$(MSBuildProjectFile)" Targets="VSTest" />
- </Target>
-
</Project>
diff --git a/test/Mono.Linker.Tests/TestCasesRunner/PathUtilities.cs b/test/Mono.Linker.Tests/TestCasesRunner/PathUtilities.cs
index c9fbea7cc..b1b7913c7 100644
--- a/test/Mono.Linker.Tests/TestCasesRunner/PathUtilities.cs
+++ b/test/Mono.Linker.Tests/TestCasesRunner/PathUtilities.cs
@@ -15,12 +15,14 @@ namespace Mono.Linker.Tests.TestCasesRunner
public const string ConfigDirectoryName = "Release";
#endif
-#if NETCOREAPP3_0
+#if NET5_0
+ public const string TFMDirectoryName = "net5.0";
+#elif NETCOREAPP3_0
public const string TFMDirectoryName = "netcoreapp3.0";
#elif NET471
public const string TFMDirectoryName = "net471";
#else
- public const string TFMDirectoryName = "";
+#error "Unknown TFM"
#endif
public static string GetTestsSourceRootDirectory ([CallerFilePath] string thisFile = null)
diff --git a/test/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs b/test/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs
index 89af9873e..8389b9ad5 100644
--- a/test/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs
+++ b/test/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs
@@ -880,9 +880,9 @@ namespace Mono.Linker.Tests.TestCasesRunner
// By now all verified recorded patterns were removed from the test recorder lists, so validate
// that there are no remaining patterns for this type.
var recognizedPatternsForType = reflectionPatternRecorder.RecognizedPatterns
- .Where (pattern => pattern.Source.DeclaringType.FullName == typeToVerify.FullName);
+ .Where (pattern => pattern.Source.DeclaringType?.FullName == typeToVerify.FullName);
var unrecognizedPatternsForType = reflectionPatternRecorder.UnrecognizedPatterns
- .Where (pattern => pattern.Source.DeclaringType.FullName == typeToVerify.FullName);
+ .Where (pattern => pattern.Source.DeclaringType?.FullName == typeToVerify.FullName);
if (recognizedPatternsForType.Any () || unrecognizedPatternsForType.Any ()) {
string recognizedPatterns = string.Join (Environment.NewLine, recognizedPatternsForType
diff --git a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseSandbox.cs b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseSandbox.cs
index 24869feef..5c8b2900f 100644
--- a/test/Mono.Linker.Tests/TestCasesRunner/TestCaseSandbox.cs
+++ b/test/Mono.Linker.Tests/TestCasesRunner/TestCaseSandbox.cs
@@ -127,7 +127,7 @@ namespace Mono.Linker.Tests.TestCasesRunner
private static NPath GetExpectationsAssemblyPath ()
{
- return new Uri (typeof (KeptAttribute).Assembly.CodeBase).LocalPath.ToNPath ();
+ return new Uri (typeof (KeptAttribute).Assembly.Location).LocalPath.ToNPath ();
}
protected void CopyToInputAndExpectations (NPath source)