diff --git a/src/ObjCRuntime/Runtime.cs b/src/ObjCRuntime/Runtime.cs index 71f615fe14c9..aee3be727fad 100644 --- a/src/ObjCRuntime/Runtime.cs +++ b/src/ObjCRuntime/Runtime.cs @@ -259,7 +259,7 @@ unsafe static void Initialize (InitializationOptions* options) if (options->Size != Marshal.SizeOf ()) { var msg = $"Version mismatch between the native {ProductName} runtime and {AssemblyName}. Please reinstall {ProductName}."; NSLog (msg); -#if MONOMAC +#if MONOMAC && !NET try { // Print out where Xamarin.Mac.dll and the native runtime was loaded from. NSLog ($"{AssemblyName} was loaded from {typeof (NSObject).Assembly.Location}"); diff --git a/src/ObjCRuntime/Runtime.mac.cs b/src/ObjCRuntime/Runtime.mac.cs index 9f092f860e95..019fe1da69bc 100644 --- a/src/ObjCRuntime/Runtime.mac.cs +++ b/src/ObjCRuntime/Runtime.mac.cs @@ -173,9 +173,12 @@ static void VerifyMonoVersion () unsafe static void InitializePlatform (InitializationOptions* options) { +#if !NET // BaseDirectory may not be set in some Mono embedded environments // so try some reasonable fallbacks in these cases. +#endif string basePath = AppDomain.CurrentDomain.BaseDirectory; +#if !NET if(!string.IsNullOrEmpty(basePath)) basePath = Path.Combine (basePath, ".."); else { @@ -189,6 +192,7 @@ unsafe static void InitializePlatform (InitializationOptions* options) basePath = Path.Combine (Environment.CurrentDirectory, ".."); } } +#endif ResourcesPath = Path.Combine (basePath, "Resources"); FrameworksPath = Path.Combine (basePath, "Frameworks");