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.
pull/8/head
KFL 2018-04-16 19:29:14 -07:00
parent 1120fc6b2e
commit e99a70fec2
1 changed files with 2 additions and 2 deletions

View File

@ -51,13 +51,13 @@ namespace Schemy
private IEnumerable<TextReader> 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))