File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change 1111using System . Reflection ;
1212using System . Runtime . CompilerServices ;
1313using System . Runtime . ExceptionServices ;
14+ using System . Runtime . InteropServices ;
1415using System . Runtime . Versioning ;
1516using System . Text ;
1617using System . Threading ;
@@ -358,6 +359,12 @@ sealed internal class InOutOfProcHelper
358359 [ ResourceConsumption ( ResourceScope . Process , ResourceScope . Process ) ]
359360 private InOutOfProcHelper ( )
360361 {
362+ if ( ! RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
363+ {
364+ // SafeNativeMethods.GetModuleHandle calls into kernel32.dll, so return early to avoid
365+ // a System.EntryPointNotFoundException on non-Windows platforms, e.g. Mono.
366+ return ;
367+ }
361368 // Don't need to close this handle...
362369 // SxS: we use this method to check if we are running inside the SQL Server process. This call should be safe in SxS environment.
363370 IntPtr handle = SafeNativeMethods . GetModuleHandle ( null ) ;
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ When using NuGet 3.x this package requires at least version 3.4.</description>
3535 <dependency id =" Microsoft.IdentityModel.Protocols.OpenIdConnect" version =" 6.8.0" />
3636 <dependency id =" Microsoft.IdentityModel.JsonWebTokens" version =" 6.8.0" />
3737 <dependency id =" System.Configuration.ConfigurationManager" version =" 4.7.0" exclude =" Compile" />
38+ <dependency id =" System.Runtime.InteropServices.RuntimeInformation" version =" 4.3.0" />
3839 </group >
3940 <group targetFramework =" netcoreapp2.1" >
4041 <dependency id =" Microsoft.Data.SqlClient.SNI.runtime" version =" 3.0.0" exclude =" Compile" />
You can’t perform that action at this time.
0 commit comments