Skip to content

Commit 5f276f4

Browse files
committed
Add BlockingReferences test that reveals #379
1 parent 988b311 commit 5f276f4

File tree

7 files changed

+132
-0
lines changed

7 files changed

+132
-0
lines changed

Confuser2.sln

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "389_MixedCultureCasing", "T
137137
EndProject
138138
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "389_MixedCultureCasing.Test", "Tests\389_MixedCultureCasing.Test\389_MixedCultureCasing.Test.csproj", "{D1CCDA5D-E460-4ACC-B51A-730DE8F0ECF3}"
139139
EndProject
140+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlockingReferences", "Tests\BlockingReferences\BlockingReferences.csproj", "{F602DAFE-E8A2-4CB2-AF0E-656CD357D821}"
141+
EndProject
142+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlockingReferencesHelper", "Tests\BlockingReferencesHelper\BlockingReferencesHelper.csproj", "{9EB8DC3B-60DC-451E-8C18-3D7E38D463FD}"
143+
EndProject
144+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlockingReferences.Test", "Tests\BlockingReferences.Test\BlockingReferences.Test.csproj", "{4FB03AD0-96FF-4730-801A-4F997795D920}"
145+
EndProject
140146
Global
141147
GlobalSection(SolutionConfigurationPlatforms) = preSolution
142148
Debug|Any CPU = Debug|Any CPU
@@ -866,6 +872,42 @@ Global
866872
{D1CCDA5D-E460-4ACC-B51A-730DE8F0ECF3}.Release|x64.Build.0 = Release|Any CPU
867873
{D1CCDA5D-E460-4ACC-B51A-730DE8F0ECF3}.Release|x86.ActiveCfg = Release|Any CPU
868874
{D1CCDA5D-E460-4ACC-B51A-730DE8F0ECF3}.Release|x86.Build.0 = Release|Any CPU
875+
{F602DAFE-E8A2-4CB2-AF0E-656CD357D821}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
876+
{F602DAFE-E8A2-4CB2-AF0E-656CD357D821}.Debug|Any CPU.Build.0 = Debug|Any CPU
877+
{F602DAFE-E8A2-4CB2-AF0E-656CD357D821}.Debug|x64.ActiveCfg = Debug|Any CPU
878+
{F602DAFE-E8A2-4CB2-AF0E-656CD357D821}.Debug|x64.Build.0 = Debug|Any CPU
879+
{F602DAFE-E8A2-4CB2-AF0E-656CD357D821}.Debug|x86.ActiveCfg = Debug|Any CPU
880+
{F602DAFE-E8A2-4CB2-AF0E-656CD357D821}.Debug|x86.Build.0 = Debug|Any CPU
881+
{F602DAFE-E8A2-4CB2-AF0E-656CD357D821}.Release|Any CPU.ActiveCfg = Release|Any CPU
882+
{F602DAFE-E8A2-4CB2-AF0E-656CD357D821}.Release|Any CPU.Build.0 = Release|Any CPU
883+
{F602DAFE-E8A2-4CB2-AF0E-656CD357D821}.Release|x64.ActiveCfg = Release|Any CPU
884+
{F602DAFE-E8A2-4CB2-AF0E-656CD357D821}.Release|x64.Build.0 = Release|Any CPU
885+
{F602DAFE-E8A2-4CB2-AF0E-656CD357D821}.Release|x86.ActiveCfg = Release|Any CPU
886+
{F602DAFE-E8A2-4CB2-AF0E-656CD357D821}.Release|x86.Build.0 = Release|Any CPU
887+
{9EB8DC3B-60DC-451E-8C18-3D7E38D463FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
888+
{9EB8DC3B-60DC-451E-8C18-3D7E38D463FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
889+
{9EB8DC3B-60DC-451E-8C18-3D7E38D463FD}.Debug|x64.ActiveCfg = Debug|Any CPU
890+
{9EB8DC3B-60DC-451E-8C18-3D7E38D463FD}.Debug|x64.Build.0 = Debug|Any CPU
891+
{9EB8DC3B-60DC-451E-8C18-3D7E38D463FD}.Debug|x86.ActiveCfg = Debug|Any CPU
892+
{9EB8DC3B-60DC-451E-8C18-3D7E38D463FD}.Debug|x86.Build.0 = Debug|Any CPU
893+
{9EB8DC3B-60DC-451E-8C18-3D7E38D463FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
894+
{9EB8DC3B-60DC-451E-8C18-3D7E38D463FD}.Release|Any CPU.Build.0 = Release|Any CPU
895+
{9EB8DC3B-60DC-451E-8C18-3D7E38D463FD}.Release|x64.ActiveCfg = Release|Any CPU
896+
{9EB8DC3B-60DC-451E-8C18-3D7E38D463FD}.Release|x64.Build.0 = Release|Any CPU
897+
{9EB8DC3B-60DC-451E-8C18-3D7E38D463FD}.Release|x86.ActiveCfg = Release|Any CPU
898+
{9EB8DC3B-60DC-451E-8C18-3D7E38D463FD}.Release|x86.Build.0 = Release|Any CPU
899+
{4FB03AD0-96FF-4730-801A-4F997795D920}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
900+
{4FB03AD0-96FF-4730-801A-4F997795D920}.Debug|Any CPU.Build.0 = Debug|Any CPU
901+
{4FB03AD0-96FF-4730-801A-4F997795D920}.Debug|x64.ActiveCfg = Debug|Any CPU
902+
{4FB03AD0-96FF-4730-801A-4F997795D920}.Debug|x64.Build.0 = Debug|Any CPU
903+
{4FB03AD0-96FF-4730-801A-4F997795D920}.Debug|x86.ActiveCfg = Debug|Any CPU
904+
{4FB03AD0-96FF-4730-801A-4F997795D920}.Debug|x86.Build.0 = Debug|Any CPU
905+
{4FB03AD0-96FF-4730-801A-4F997795D920}.Release|Any CPU.ActiveCfg = Release|Any CPU
906+
{4FB03AD0-96FF-4730-801A-4F997795D920}.Release|Any CPU.Build.0 = Release|Any CPU
907+
{4FB03AD0-96FF-4730-801A-4F997795D920}.Release|x64.ActiveCfg = Release|Any CPU
908+
{4FB03AD0-96FF-4730-801A-4F997795D920}.Release|x64.Build.0 = Release|Any CPU
909+
{4FB03AD0-96FF-4730-801A-4F997795D920}.Release|x86.ActiveCfg = Release|Any CPU
910+
{4FB03AD0-96FF-4730-801A-4F997795D920}.Release|x86.Build.0 = Release|Any CPU
869911
EndGlobalSection
870912
GlobalSection(SolutionProperties) = preSolution
871913
HideSolutionNode = FALSE
@@ -923,6 +965,9 @@ Global
923965
{5E9715AB-CAF7-4FFF-8E14-A8727891DA93} = {356BDB31-853E-43BB-8F9A-D8AC08F69EBB}
924966
{75E5F9A0-8D69-4426-9F16-4A65E941974D} = {356BDB31-853E-43BB-8F9A-D8AC08F69EBB}
925967
{D1CCDA5D-E460-4ACC-B51A-730DE8F0ECF3} = {356BDB31-853E-43BB-8F9A-D8AC08F69EBB}
968+
{F602DAFE-E8A2-4CB2-AF0E-656CD357D821} = {356BDB31-853E-43BB-8F9A-D8AC08F69EBB}
969+
{9EB8DC3B-60DC-451E-8C18-3D7E38D463FD} = {356BDB31-853E-43BB-8F9A-D8AC08F69EBB}
970+
{4FB03AD0-96FF-4730-801A-4F997795D920} = {356BDB31-853E-43BB-8F9A-D8AC08F69EBB}
926971
EndGlobalSection
927972
GlobalSection(ExtensibilityGlobals) = postSolution
928973
SolutionGuid = {0D937D9E-E04B-4A68-B639-D4260473A388}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net461</TargetFramework>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<ProjectReference Include="..\BlockingReferences\BlockingReferences.csproj" />
9+
<ProjectReference Include="..\Confuser.UnitTest\Confuser.UnitTest.csproj" />
10+
</ItemGroup>
11+
</Project>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System.Threading.Tasks;
2+
using Confuser.Core;
3+
using Confuser.Core.Project;
4+
using Confuser.UnitTest;
5+
using Xunit;
6+
using Xunit.Abstractions;
7+
8+
namespace BlockingReferences.Test {
9+
public class BlockingReferencesTest : TestBase {
10+
public BlockingReferencesTest(ITestOutputHelper outputHelper) : base(outputHelper) { }
11+
12+
[Fact]
13+
[Trait("Category", "Protection")]
14+
[Trait("Protection", "rename")]
15+
[Trait("Issue", "https://github.com/mkaring/ConfuserEx/issues/379")]
16+
public async Task BlockingReferences() =>
17+
await Run(
18+
new [] { "BlockingReferences.exe", "BlockingReferencesHelper.dll" },
19+
new [] {
20+
"",
21+
"Implementation2",
22+
},
23+
new SettingItem<Protection>("rename") { ["renPublic"] = "true", ["mode"] = "decodable" }
24+
);
25+
}
26+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net461</TargetFramework>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<ProjectReference Include="..\BlockingReferencesHelper\BlockingReferencesHelper.csproj" />
10+
</ItemGroup>
11+
12+
</Project>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System;
2+
using BlockingReferencesHelper;
3+
4+
namespace BlockingReferences {
5+
public interface IBaseInterface {
6+
string Method();
7+
}
8+
9+
public class Implementation1 : BaseImplementation<string>, IBaseInterface {
10+
}
11+
12+
public class Implementation2 : BaseImplementation<string>, IBaseInterface {
13+
public override string Method() => "Implementation2";
14+
}
15+
16+
public static class Program {
17+
public static int Main() {
18+
Console.WriteLine("START");
19+
Console.WriteLine(new Implementation1().Method());
20+
Console.WriteLine(new Implementation2().Method());
21+
Console.WriteLine("END");
22+
23+
return 42;
24+
}
25+
}
26+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
namespace BlockingReferencesHelper {
2+
public class BaseImplementation<T> {
3+
public virtual T Method() => default;
4+
}
5+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
</PropertyGroup>
6+
7+
</Project>

0 commit comments

Comments
 (0)