From 5f243f80e439d1deebdb76ac41c2c76fe43b9a13 Mon Sep 17 00:00:00 2001 From: MaceWindu Date: Wed, 30 Oct 2019 14:22:32 +0100 Subject: [PATCH 1/2] release 2.9.3 --- Source/linq2db.LINQPad.csproj | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 @@ - + - + - - + + From 17b6cb5dcd3730a2dde973cf34c4d7f9ef6fc20b Mon Sep 17 00:00:00 2001 From: MaceWindu Date: Wed, 30 Oct 2019 15:34:28 +0100 Subject: [PATCH 2/2] add SAP HANA 2 SPS04 driver bug workaround --- Source/DriverHelper.cs | 22 ++++++++++++++++++++++ Source/LinqToDBDriver.cs | 1 + 2 files changed, 23 insertions(+) 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)