diff --git a/Source/DriverHelper.cs b/Source/DriverHelper.cs
index 472c23a..73a2443 100644
--- a/Source/DriverHelper.cs
+++ b/Source/DriverHelper.cs
@@ -11,6 +11,7 @@
using LINQPad.Extensibility.DataContext;
using System.Reflection;
+using System.IO;
namespace LinqToDB.LINQPad
{
@@ -190,5 +191,26 @@ public static void ConfigureRedirects()
return typeof(DataContext).Assembly;
};
}
+
+ public static void SapHanaSPS04Fixes()
+ {
+ // recent SAP HANA provider (SPS04) uses Assembly.GetEntryAssembly() calls during native dlls discovery, which
+ // leads to NRE as it returns null under NETFX, so we need to fake this method result to unblock HANA testing
+ // https://github.com/microsoft/vstest/issues/1834
+ // https://dejanstojanovic.net/aspnet/2015/january/set-entry-assembly-in-unit-testing-methods/
+ try
+ {
+ var assembly = Assembly.GetCallingAssembly();
+
+ var manager = new AppDomainManager();
+ var entryAssemblyfield = manager.GetType().GetField("m_entryAssembly", BindingFlags.Instance | BindingFlags.NonPublic);
+ entryAssemblyfield.SetValue(manager, assembly);
+
+ var domain = AppDomain.CurrentDomain;
+ var domainManagerField = domain.GetType().GetField("_domainManager", BindingFlags.Instance | BindingFlags.NonPublic);
+ domainManagerField.SetValue(domain, manager);
+ }
+ catch { /* ne shmagla */ }
+ }
}
}
diff --git a/Source/LinqToDBDriver.cs b/Source/LinqToDBDriver.cs
index 110aabd..527b6a6 100644
--- a/Source/LinqToDBDriver.cs
+++ b/Source/LinqToDBDriver.cs
@@ -31,6 +31,7 @@ public class LinqToDBDriver : DynamicDataContextDriver
static LinqToDBDriver()
{
DriverHelper.ConfigureRedirects();
+ DriverHelper.SapHanaSPS04Fixes();
}
public override string GetConnectionDescription(IConnectionInfo cxInfo)
diff --git a/Source/linq2db.LINQPad.csproj b/Source/linq2db.LINQPad.csproj
index 9c0f4cb..b7718c3 100644
--- a/Source/linq2db.LINQPad.csproj
+++ b/Source/linq2db.LINQPad.csproj
@@ -6,7 +6,7 @@
linq2db
linq2db.LINQPad
$(Product)
- 2.9.1
+ 2.9.3
$(Version)
$(Version)
Copyright © 2018 Igor Tkachev, Ilya Chudin, Svyatoslav Danyliv, Dmitry Lukashenko
@@ -20,14 +20,14 @@
-
+
-
+
-
-
+
+