File tree Expand file tree Collapse file tree 1 file changed +9
-13
lines changed
Provider/src/FirebirdSql.Data.FirebirdClient/FirebirdClient Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Original file line number Diff line number Diff line change 2222using System . Diagnostics ;
2323using System . IO ;
2424using System . Reflection ;
25- #if NETSTANDARD1_6
26- using Microsoft . Extensions . PlatformAbstractions ;
27- #endif
2825using FirebirdSql . Data . Common ;
2926#if ! NETSTANDARD1_6
3027using FirebirdSql . Data . Schema ;
@@ -467,9 +464,7 @@ private string GetProcessName()
467464
468465 private string GetHostingPath ( )
469466 {
470- #if NETSTANDARD1_6
471- return PlatformServices . Default . Application . ApplicationBasePath ;
472- #elif NETSTANDARD2_0
467+ #if NETSTANDARD1_6 || NETSTANDARD2_0
473468 return System . AppContext . BaseDirectory ;
474469#else
475470 Assembly assembly ;
@@ -497,18 +492,19 @@ private string GetHostingPath()
497492 }
498493 private string GetRealProcessName ( )
499494 {
500- var assembly = Assembly . GetEntryAssembly ( ) ;
501- return assembly ? . Location ?? Process . GetCurrentProcess ( ) . MainModule . FileName ;
495+ return Assembly . GetEntryAssembly ( ) ? . Location ?? Process . GetCurrentProcess ( ) . MainModule . FileName ;
502496 }
503497
504498 private int GetProcessId ( )
505499 {
506- #if ! NETSTANDARD1_6
507- var assembly = Assembly . GetEntryAssembly ( ) ;
508- if ( ! ( assembly ? . IsFullyTrusted ) ?? false )
500+ try
501+ {
502+ return Process . GetCurrentProcess ( ) . Id ;
503+ }
504+ catch ( InvalidOperationException )
505+ {
509506 return - 1 ;
510- #endif
511- return Process . GetCurrentProcess ( ) . Id ;
507+ }
512508 }
513509
514510 private void EnsureActiveTransaction ( )
You can’t perform that action at this time.
0 commit comments