From f4a77d1c97c05fd60d1c1eeebeb40b652ed85a83 Mon Sep 17 00:00:00 2001 From: Sven Boemer Date: Fri, 12 Jul 2019 17:10:40 -0700 Subject: [PATCH] Skip C++/CLI assemblies --- src/ILLink.Tasks/Utils.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ILLink.Tasks/Utils.cs b/src/ILLink.Tasks/Utils.cs index 265f61ab29bc..966ef5003fd1 100644 --- a/src/ILLink.Tasks/Utils.cs +++ b/src/ILLink.Tasks/Utils.cs @@ -1,5 +1,6 @@ using System; using Mono.Cecil; +using System.Linq; public static class Utils { @@ -7,9 +8,16 @@ public static bool IsManagedAssembly (string fileName) { try { ModuleDefinition module = ModuleDefinition.ReadModule (fileName); - return true; + return !IsCPPCLIAssembly (module); } catch (BadImageFormatException) { return false; } } + + private static bool IsCPPCLIAssembly (ModuleDefinition module) + { + return module.Types.Any(t => + t.Namespace == "" || + t.Namespace == ""); + } }