From e99a70fec2e758a550f286db04976da07d002e41 Mon Sep 17 00:00:00 2001 From: KFL Date: Mon, 16 Apr 2018 19:29:14 -0700 Subject: [PATCH] Fixes issue Microsoft/schemy/issues/7 `Assembly.GetEntryAssembly()` and `Assembly.GetExecutingAssembly()` doesn't work properly when the user assembly is loaded by reflection or in another appdomain. --- src/schemy/Schemy.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/schemy/Schemy.cs b/src/schemy/Schemy.cs index 668752e..c7e30e0 100644 --- a/src/schemy/Schemy.cs +++ b/src/schemy/Schemy.cs @@ -51,13 +51,13 @@ namespace Schemy private IEnumerable GetInitializeFiles() { - using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("init.ss")) + using (Stream stream = typeof(Interpreter).Assembly.GetManifestResourceStream("init.ss")) using (StreamReader reader = new StreamReader(stream)) { yield return reader; } - string initFile = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), ".init.ss"); + string initFile = Path.Combine(Path.GetDirectoryName(typeof(Interpreter).Assembly.Location), ".init.ss"); if (File.Exists(initFile)) { using (var reader = new StreamReader(initFile))