diff --git a/runtime/monotouch-main.m b/runtime/monotouch-main.m index 791901bd65c6..933c1c03d344 100644 --- a/runtime/monotouch-main.m +++ b/runtime/monotouch-main.m @@ -454,9 +454,6 @@ - (void) memoryWarning: (NSNotification *) sender case XamarinLaunchModeApp: rv = mono_jit_exec (mono_domain_get (), assembly, managed_argc, managed_argv); break; - case XamarinLaunchModeEmbedded: - // do nothing - break; default: xamarin_assertion_message ("Invalid launch mode: %i.", launch_mode); break; diff --git a/runtime/runtime.m b/runtime/runtime.m index 4f77f3c4705f..76147283117c 100644 --- a/runtime/runtime.m +++ b/runtime/runtime.m @@ -140,10 +140,6 @@ struct MTRegistrationMap* RegistrationData; enum MarshalObjectiveCExceptionMode MarshalObjectiveCExceptionMode; enum MarshalManagedExceptionMode MarshalManagedExceptionMode; -#if MONOMAC - enum XamarinLaunchMode LaunchMode; - const char *EntryAssemblyPath; -#endif struct AssemblyLocations* AssemblyLocations; // This struct must be kept in sync with the corresponding struct in Runtime.cs, and since we use the same managed code for both MonoVM and CoreCLR, // we can't restrict the following fields to CORECLR_RUNTIME only, we can only exclude it from legacy Xamarin. @@ -1085,37 +1081,6 @@ -(struct NSObjectData*) xamarinGetNSObjectData; return entry->wrapper_token; } -void -xamarin_initialize_embedded () -{ - static bool initialized = false; - if (initialized) - return; - initialized = true; - - char *argv[] = { NULL }; - char *libname = NULL; - - Dl_info info; - if (dladdr ((void *) xamarin_initialize_embedded, &info) != 0) { - const char *last_sep = strrchr (info.dli_fname, '/'); - if (last_sep == NULL) { - libname = strdup (info.dli_fname); - } else { - libname = strdup (last_sep + 1); - } - argv [0] = libname; - } - - if (argv [0] == NULL) - argv [0] = (char *) "embedded"; - - xamarin_main (1, argv, XamarinLaunchModeEmbedded); - - if (libname != NULL) - free (libname); -} - /* Installs g_print/g_error handlers that will redirect output to the system Console */ void xamarin_install_log_callbacks () @@ -1168,10 +1133,6 @@ -(struct NSObjectData*) xamarinGetNSObjectData; options.Trampolines = &trampolines; options.MarshalObjectiveCExceptionMode = xamarin_marshal_objectivec_exception_mode; options.MarshalManagedExceptionMode = xamarin_marshal_managed_exception_mode; -#if MONOMAC - options.LaunchMode = xamarin_launch_mode; - options.EntryAssemblyPath = xamarin_entry_assembly_path; -#endif #if defined (CORECLR_RUNTIME) options.xamarin_objc_msgsend = (void *) xamarin_dyn_objc_msgSend; @@ -1238,11 +1199,7 @@ -(struct NSObjectData*) xamarinGetNSObjectData; xamarin_assertion_message ("Could not find the main bundle in the app ([NSBundle mainBundle] returned nil)"); #if TARGET_OS_MACCATALYST || TARGET_OS_OSX - if (xamarin_launch_mode == XamarinLaunchModeEmbedded) { - bundle_path = [[[NSBundle bundleForClass: [XamarinAssociatedObject class]] bundlePath] stringByAppendingPathComponent: @"Versions/Current"]; - } else { - bundle_path = [[main_bundle bundlePath] stringByAppendingPathComponent:@"Contents"]; - } + bundle_path = [[main_bundle bundlePath] stringByAppendingPathComponent:@"Contents"]; bundle_path = [bundle_path stringByAppendingPathComponent: xamarin_custom_bundle_name]; #else bundle_path = [main_bundle bundlePath]; diff --git a/runtime/xamarin/main.h b/runtime/xamarin/main.h index 8c58735b0f6a..8f41feb03601 100644 --- a/runtime/xamarin/main.h +++ b/runtime/xamarin/main.h @@ -41,7 +41,6 @@ enum MarshalManagedExceptionMode : int { enum XamarinLaunchMode { XamarinLaunchModeApp = 0, XamarinLaunchModeExtension = 1, - XamarinLaunchModeEmbedded = 2, }; // This has a managed equivalent in NSObject2.cs @@ -111,7 +110,6 @@ extern bool xamarin_disable_omit_fp; #if MONOMAC extern bool xamarin_mac_hybrid_aot; extern bool xamarin_mac_modern; -extern char *xamarin_entry_assembly_path; #endif extern bool xamarin_init_mono_debug; extern int xamarin_log_level; diff --git a/runtime/xamarin/runtime.h b/runtime/xamarin/runtime.h index 0ffb5c9b1f75..a15ff6a2a4ce 100644 --- a/runtime/xamarin/runtime.h +++ b/runtime/xamarin/runtime.h @@ -158,7 +158,6 @@ struct AssemblyLocations { }; void xamarin_initialize (); -void xamarin_initialize_embedded (); /* Public API, must not change - this is used by the embeddinator */ void xamarin_assertion_message (const char *msg, ...) __attribute__((__noreturn__)); // Gets the bundle path (where the managed executable is). This is *not* the path of the app bundle (.app/.appex). diff --git a/src/ObjCRuntime/Runtime.cs b/src/ObjCRuntime/Runtime.cs index bc0f0ad50cb5..b1daec22eac9 100644 --- a/src/ObjCRuntime/Runtime.cs +++ b/src/ObjCRuntime/Runtime.cs @@ -177,15 +177,6 @@ internal enum InitializationFlags : int { IsNativeAOT = 0x40, } -#if MONOMAC - /* This enum must always match the identical enum in runtime/xamarin/main.h */ - internal enum LaunchMode : int { - App = 0, - Extension = 1, - Embedded = 2, - } -#endif - [StructLayout (LayoutKind.Sequential)] internal unsafe struct InitializationOptions { public int Size; @@ -195,10 +186,6 @@ internal unsafe struct InitializationOptions { public MTRegistrationMap* RegistrationMap; public MarshalObjectiveCExceptionMode MarshalObjectiveCExceptionMode; public MarshalManagedExceptionMode MarshalManagedExceptionMode; -#if MONOMAC - public LaunchMode LaunchMode; - public IntPtr EntryAssemblyPath; /* char * */ -#endif IntPtr AssemblyLocations; public IntPtr xamarin_objc_msgsend; @@ -577,16 +564,9 @@ static IntPtr PrintAllExceptions (IntPtr exception_gchandle) return Marshal.StringToHGlobalAuto (str.ToString ()); } - // IL2026: Using member 'System.Reflection.Assembly.LoadFile(String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Types and members the loaded assembly depends on might be removed. - [UnconditionalSuppressMessage ("", "IL2026", Justification = "We only want the entry assembly, and then we only want the entry point, which survives trimming.")] static unsafe Assembly? GetEntryAssembly () { - var asm = Assembly.GetEntryAssembly (); -#if MONOMAC - if (asm is null) - asm = Assembly.LoadFile (Marshal.PtrToStringAuto (options->EntryAssemblyPath)!); -#endif - return asm; + return Assembly.GetEntryAssembly (); } // This method will register all assemblies referenced by the entry assembly.