From 9621c13cb21ae5801447e3d8fc2dd8502e6aa1c2 Mon Sep 17 00:00:00 2001 From: jiftle Date: Sun, 18 Nov 2018 00:10:34 +0800 Subject: [PATCH] clr.FindAssembly() method,throw exception when file not found. --- src/runtime/moduleobject.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/runtime/moduleobject.cs b/src/runtime/moduleobject.cs index 8af722d29..f471520c2 100644 --- a/src/runtime/moduleobject.cs +++ b/src/runtime/moduleobject.cs @@ -451,7 +451,12 @@ public static Type GetClrType(Type type) public static string FindAssembly(string name) { AssemblyManager.UpdatePath(); - return AssemblyManager.FindAssembly(name); + string assemblyName = AssemblyManager.FindAssembly(name); + if (assemblyName == null) + { + throw new FileNotFoundException($"Unable to find assembly '{name}' dll or exe."); + } + return assemblyName; } [ModuleFunction]