File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44namespace Firebase . Auth
55{
66 public partial class Auth {
7- static string currentVersion ;
7+ static string ? currentVersion ;
88 public static string CurrentVersion {
99 get {
1010 if ( currentVersion == null ) {
1111 IntPtr RTLD_MAIN_ONLY = Dlfcn . dlopen ( null , 0 ) ;
12- IntPtr ptr = Dlfcn . dlsym ( RTLD_MAIN_ONLY , "FirebaseAuthVersionStr" ) ;
13- currentVersion = Marshal . PtrToStringAnsi ( ptr ) ;
14- Dlfcn . dlclose ( RTLD_MAIN_ONLY ) ;
12+ if ( RTLD_MAIN_ONLY == IntPtr . Zero )
13+ throw new InvalidOperationException ( "Unable to open the main program handle." ) ;
14+
15+ try {
16+ IntPtr ptr = Dlfcn . dlsym ( RTLD_MAIN_ONLY , "FirebaseAuthVersionStr" ) ;
17+ if ( ptr == IntPtr . Zero )
18+ throw new InvalidOperationException ( "Unable to resolve FirebaseAuthVersionStr." ) ;
19+
20+ currentVersion = Marshal . PtrToStringAnsi ( ptr )
21+ ?? throw new InvalidOperationException ( "Unable to read FirebaseAuthVersionStr." ) ;
22+ } finally {
23+ Dlfcn . dlclose ( RTLD_MAIN_ONLY ) ;
24+ }
1525 }
1626
1727 return currentVersion ;
Original file line number Diff line number Diff line change 33using ObjCRuntime ;
44namespace Firebase . CloudFunctions {
55 public partial class CloudFunctions {
6- static string currentVersion ;
6+ static string ? currentVersion ;
77 public static string CurrentVersion {
88 get {
99 if ( currentVersion == null ) {
1010 IntPtr RTLD_MAIN_ONLY = Dlfcn . dlopen ( null , 0 ) ;
11- IntPtr ptr = Dlfcn . dlsym ( RTLD_MAIN_ONLY , "FirebaseCloudFunctionsVersionStr" ) ;
12- currentVersion = Marshal . PtrToStringAnsi ( ptr ) ;
13- Dlfcn . dlclose ( RTLD_MAIN_ONLY ) ;
11+ if ( RTLD_MAIN_ONLY == IntPtr . Zero )
12+ throw new InvalidOperationException ( "Unable to open the main program handle." ) ;
13+
14+ try {
15+ IntPtr ptr = Dlfcn . dlsym ( RTLD_MAIN_ONLY , "FirebaseCloudFunctionsVersionStr" ) ;
16+ if ( ptr == IntPtr . Zero )
17+ throw new InvalidOperationException ( "Unable to resolve FirebaseCloudFunctionsVersionStr." ) ;
18+
19+ currentVersion = Marshal . PtrToStringAnsi ( ptr )
20+ ?? throw new InvalidOperationException ( "Unable to read FirebaseCloudFunctionsVersionStr." ) ;
21+ } finally {
22+ Dlfcn . dlclose ( RTLD_MAIN_ONLY ) ;
23+ }
1424 }
1525
1626 return currentVersion ;
Original file line number Diff line number Diff line change @@ -8,13 +8,16 @@ public partial class App {
88 [ DllImport ( "__Internal" , EntryPoint = "FIRFirebaseVersion" ) ]
99 extern internal static IntPtr _FIRFirebaseVersion ( ) ;
1010
11- static string firebaseVersion ;
11+ static string ? firebaseVersion ;
1212 public static string FirebaseVersion {
1313 get {
1414 if ( firebaseVersion == null ) {
15-
1615 IntPtr verStrPtr = _FIRFirebaseVersion ( ) ;
17- firebaseVersion = NSString . FromHandle ( verStrPtr ) ;
16+ if ( verStrPtr == IntPtr . Zero )
17+ throw new InvalidOperationException ( "Unable to resolve FIRFirebaseVersion." ) ;
18+
19+ firebaseVersion = NSString . FromHandle ( verStrPtr )
20+ ?? throw new InvalidOperationException ( "Unable to read FIRFirebaseVersion." ) ;
1821 }
1922
2023 return firebaseVersion ;
You can’t perform that action at this time.
0 commit comments