Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix EntryPointNotFoundException in InOutOfProcHelper constructor #1120

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using System.Threading;
Expand Down Expand Up @@ -358,6 +359,12 @@ sealed internal class InOutOfProcHelper
[ResourceConsumption(ResourceScope.Process, ResourceScope.Process)]
private InOutOfProcHelper()
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
// SafeNativeMethods.GetModuleHandle calls into kernel32.dll, so return early to avoid
// a System.EntryPointNotFoundException on non-Windows platforms, e.g. Mono.
return;
}
// Don't need to close this handle...
// SxS: we use this method to check if we are running inside the SQL Server process. This call should be safe in SxS environment.
IntPtr handle = SafeNativeMethods.GetModuleHandle(null);
Expand Down
1 change: 1 addition & 0 deletions tools/specs/Microsoft.Data.SqlClient.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ When using NuGet 3.x this package requires at least version 3.4.</description>
<dependency id="Microsoft.IdentityModel.Protocols.OpenIdConnect" version="6.8.0" />
<dependency id="Microsoft.IdentityModel.JsonWebTokens" version="6.8.0" />
<dependency id="System.Configuration.ConfigurationManager" version="4.7.0" exclude="Compile" />
<dependency id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" />
</group>
<group targetFramework="netcoreapp2.1">
<dependency id="Microsoft.Data.SqlClient.SNI.runtime" version="3.0.0" exclude="Compile" />
Expand Down