diff options
4 files changed, 38 insertions, 0 deletions
diff --git a/external/cecil b/external/cecil -Subproject 8cf97c125748b0a2832f0420728c8fac2ae2234 +Subproject 2f9b2fb759c50e756f9c6580b9fb8518581020c diff --git a/src/linker/Linker.Steps/SweepStep.cs b/src/linker/Linker.Steps/SweepStep.cs index 5f74b3075..4bf6a60da 100644 --- a/src/linker/Linker.Steps/SweepStep.cs +++ b/src/linker/Linker.Steps/SweepStep.cs @@ -223,6 +223,10 @@ namespace Mono.Linker.Steps if (main.HasModuleReferences) SweepCollectionMetadata (main.ModuleReferences); + if (main.EntryPoint != null && !Annotations.IsMarked (main.EntryPoint)) { + main.EntryPoint = null; + } + SweepTypeForwarders (assembly); SweepAssemblyReferences (assembly); diff --git a/test/Mono.Linker.Tests.Cases/References/Dependencies/ReferenceWithEntryPoint_Lib.cs b/test/Mono.Linker.Tests.Cases/References/Dependencies/ReferenceWithEntryPoint_Lib.cs new file mode 100644 index 000000000..a11080c39 --- /dev/null +++ b/test/Mono.Linker.Tests.Cases/References/Dependencies/ReferenceWithEntryPoint_Lib.cs @@ -0,0 +1,13 @@ +namespace Mono.Linker.Tests.Cases.References.Dependencies +{ + public class ReferenceWithEntryPoint_Lib + { + public static void Main () + { + } + + public static void UsedMethod () + { + } + } +}
\ No newline at end of file diff --git a/test/Mono.Linker.Tests.Cases/References/ReferenceWithEntryPoint.cs b/test/Mono.Linker.Tests.Cases/References/ReferenceWithEntryPoint.cs new file mode 100644 index 000000000..dd572e64e --- /dev/null +++ b/test/Mono.Linker.Tests.Cases/References/ReferenceWithEntryPoint.cs @@ -0,0 +1,21 @@ +using Mono.Linker.Tests.Cases.Expectations.Assertions; +using Mono.Linker.Tests.Cases.Expectations.Metadata; +using Mono.Linker.Tests.Cases.References.Dependencies; + +namespace Mono.Linker.Tests.Cases.References +{ + // Actions: + // link - This assembly + // link - lib.exe + + [SetupCompileBefore ("lib.exe", new[] { "Dependencies/ReferenceWithEntryPoint_Lib.cs" })] + [KeptAssembly ("lib.exe")] + [KeptMemberInAssembly ("lib.exe", typeof (ReferenceWithEntryPoint_Lib), "UsedMethod()")] + class ReferenceWithEntryPoint + { + public static void Main () + { + ReferenceWithEntryPoint_Lib.UsedMethod (); + } + } +} |