Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/ILLink.Tasks/ILLink.Tasks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@
<ItemGroup>
<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" />
<ProjectReference Condition="'$(UseCecilPackage)' != 'true'" Include="../../external/cecil/Mono.Cecil.csproj" PrivateAssets="All">
<!-- https://github.com/dotnet/sdk/issues/2280#issuecomment-392815466 -->
<SetTargetFramework>TargetFramework=netstandard2.0</SetTargetFramework>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this needed? (Or is it just to be safe?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason it picked the net40 version... it's weird, but I just could not make it work otherwise.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird... 🤷‍♂️ Glad you figured it out. I didn't know about SetTargetFramework

</ProjectReference>
<ProjectReference Condition="('$(UseCecilPackage)' != 'true') And ('$(TargetFramework)' != 'net472')" Include="../../external/cecil/symbols/pdb/Mono.Cecil.Pdb.csproj" PrivateAssets="All" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<PropertyGroup>
<RunAnalyzers>false</RunAnalyzers>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Nullable>disable</Nullable>
</PropertyGroup>
</Project>
5 changes: 5 additions & 0 deletions test/ILLink.RoslynAnalyzer.Tests/TestCaseUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,12 @@ internal static void GetDirectoryPaths (out string rootSourceDirectory, out stri
#else
var configDirectoryName = "Release";
#endif

#if NET6_0
const string tfm = "net6.0";
#else
const string tfm = "net5.0";
#endif

// working directory is artifacts/bin/Mono.Linker.Tests/<config>/<tfm>
var artifactsBinDir = Path.Combine (Directory.GetCurrentDirectory (), "..", "..", "..");
Expand Down
1 change: 1 addition & 0 deletions test/ILLink.Tasks.Tests/Mock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public MockTask ()
// Ensure that [Required] members are non-null
AssemblyPaths = new ITaskItem[0];
RootAssemblyNames = new ITaskItem[0];
ILLinkPath = Path.Combine (Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location), "illink.dll");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious what prompted this change

Copy link
Member Author

@vitek-karas vitek-karas Mar 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic in the ILLink is basically MyPath/../../bin/net5.0/illink.dll. Which worked before by luck, since the folder in the artifacts where the test lives ends with bin/net5.0 as well. Now when the test is running on 6, the path ends with bin/net6.0.
But the product is still NET5.

}

public MockDriver CreateDriver ()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,13 @@ private class SimpleGetMembers
public SimpleGetMembers ()
{ }

[Kept]
private SimpleGetMembers (int i)
{ }

[Kept]
public void PublicMethod ()
{ }

[Kept]
private void PrivateMethod ()
{ }

Expand All @@ -117,16 +115,11 @@ private void PrivateMethod ()
[KeptEventRemoveMethod]
public event EventHandler<EventArgs> PublicEvent;

[Kept]
[KeptBackingField]
[KeptEventAddMethod]
[KeptEventRemoveMethod]
private event EventHandler<EventArgs> MarkedDueToPutRefDispPropertyEvent;

[Kept]
public static int _publicField;

[Kept]
private int _privateField;

[Kept]
Expand All @@ -137,27 +130,19 @@ public int PublicProperty {
set { _publicField = value; }
}

[Kept]
private int PrivateProperty {
[Kept]
get { return _privateField; }
[Kept]
set { _privateField = value; }
}

[Kept]
public static class PublicNestedType
{
// Due to annotations in runtime the GetMembers call keeps the following members
// See issue https://github.com/dotnet/runtime/issues/36708
[Kept]
public static int _nestedPublicField;
[Kept]
public static void NestedPublicMethod ()
{ }
}

[Kept]
private static class PrivateNestedType { }
}

Expand Down
4 changes: 3 additions & 1 deletion test/Mono.Linker.Tests/TestCasesRunner/PathUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ public static class PathUtilities
public const string ConfigDirectoryName = "Release";
#endif

#if NET5_0
#if NET6_0
public const string TFMDirectoryName = "net6.0";
#elif NET5_0
public const string TFMDirectoryName = "net5.0";
#elif NETCOREAPP3_0
public const string TFMDirectoryName = "netcoreapp3.0";
Expand Down