From 8a9803359158aef7ffa72c88388d175efc058a40 Mon Sep 17 00:00:00 2001 From: chaowlert Date: Sun, 17 Nov 2019 16:41:32 +0700 Subject: [PATCH] fix #1 support .net framework --- .../ExpressionDebugger.Console.csproj | 4 ++-- ExpressionDebugger/ExpressionCompiler.cs | 10 ++++++++-- ExpressionDebugger/ExpressionDebugger.csproj | 6 ++++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ExpressionDebugger.Console/ExpressionDebugger.Console.csproj b/ExpressionDebugger.Console/ExpressionDebugger.Console.csproj index 772105d..cdd1b58 100644 --- a/ExpressionDebugger.Console/ExpressionDebugger.Console.csproj +++ b/ExpressionDebugger.Console/ExpressionDebugger.Console.csproj @@ -1,8 +1,8 @@ - + Exe - netcoreapp2.0 + net461 diff --git a/ExpressionDebugger/ExpressionCompiler.cs b/ExpressionDebugger/ExpressionCompiler.cs index 1d8716f..505cc51 100644 --- a/ExpressionDebugger/ExpressionCompiler.cs +++ b/ExpressionDebugger/ExpressionCompiler.cs @@ -9,7 +9,6 @@ using System.Linq; using System.Linq.Expressions; using System.Reflection; -using System.Runtime.Loader; using System.Text; namespace ExpressionDebugger @@ -78,8 +77,11 @@ from n in t.TypeNames if (_options?.References != null) references.UnionWith(_options.References); references.Add(typeof(object).Assembly); + +#if NETSTANDARD2_0 references.Add(Assembly.Load(new AssemblyName("System.Runtime"))); references.Add(Assembly.Load(new AssemblyName("System.Collections"))); +#endif var assemblyName = Path.GetRandomFileName(); var symbolsName = Path.ChangeExtension(assemblyName, "pdb"); @@ -127,7 +129,11 @@ from n in t.TypeNames assemblyStream.Seek(0, SeekOrigin.Begin); symbolsStream.Seek(0, SeekOrigin.Begin); - return AssemblyLoadContext.Default.LoadFromStream(assemblyStream, symbolsStream); +#if NETSTANDARD2_0 + return System.Runtime.Loader.AssemblyLoadContext.Default.LoadFromStream(assemblyStream, symbolsStream); +#else + return Assembly.Load(assemblyStream.ToArray(), symbolsStream.ToArray()); +#endif } } diff --git a/ExpressionDebugger/ExpressionDebugger.csproj b/ExpressionDebugger/ExpressionDebugger.csproj index 7bf71c8..bbfa4fa 100644 --- a/ExpressionDebugger/ExpressionDebugger.csproj +++ b/ExpressionDebugger/ExpressionDebugger.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + netstandard2.0;net461 True Chaowlert Chaisrichalermpol Step into debugging from linq expressions @@ -12,7 +12,7 @@ True true ExpressionDebugger.snk - 2.1.0 + 2.1.1 2.1.0 2.1.0 https://github.com/chaowlert/ExpressionDebugger/blob/master/LICENSE @@ -20,6 +20,8 @@ + +