Inheritance: IApplication
Beispiel #1
0
        public static int Main(string[] args, IdeCustomizer customizer = null)
        {
            // Using a Stopwatch instead of a TimerCounter since calling
            // TimerCounter.BeginTiming here would occur before any timer
            // handlers can be registered. So instead the startup duration is
            // set as a metadata property on the Counters.Startup counter.
            startupTimer.Start();

            var options = MonoDevelopOptions.Parse(args);

            if (options.ShowHelp || options.Error != null)
            {
                return(options.Error != null? -1 : 0);
            }

            LoggingService.Initialize(options.RedirectOutput);

            if (customizer == null)
            {
                customizer = LoadBrandingCustomizer();
            }
            options.IdeCustomizer = customizer;

            if (!Platform.IsWindows)
            {
                // Limit maximum threads when running on mono
                int threadCount = 125;
                ThreadPool.SetMaxThreads(threadCount, threadCount);
            }

            int ret = -1;

            try {
                var exename = Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location);
                if (!Platform.IsMac && !Platform.IsWindows)
                {
                    exename = exename.ToLower();
                }
                Runtime.SetProcessName(exename);

                sectionTimings ["mainInitialization"] = startupTimer.ElapsedMilliseconds;
                startupTimer.Restart();

                var app = new IdeStartup();
                ret = app.Run(options);
            } catch (Exception ex) {
                LoggingService.LogFatalError(
                    string.Format(
                        "{0} failed to start. Some of the assemblies required to run {0} (for example gtk-sharp)" +
                        "may not be properly installed in the GAC.",
                        BrandingService.ApplicationName
                        ), ex);
            } finally {
                Runtime.Shutdown();
            }

            LoggingService.Shutdown();

            return(ret);
        }
		public static int Main (string[] args)
		{
			bool retry = false;

			EnableFileLogging ();
			
			do {
				try {
					Runtime.SetProcessName ("monodevelop");
					IdeStartup app = new IdeStartup ();
					return app.Run (args);
				} catch (Exception ex) {
					if (!retry && AddinManager.IsInitialized) {
						LoggingService.LogWarning (BrandingService.ApplicationName + " failed to start. Rebuilding addins registry.");
						AddinManager.Registry.Rebuild (new Mono.Addins.ConsoleProgressStatus (true));
						LoggingService.LogInfo ("Addin registry rebuilt. Restarting MonoDevelop.");
						retry = true;
					} else {
						LoggingService.LogFatalError (BrandingService.ApplicationName + " failed to start. Some of the assemblies required to run MonoDevelop (for example gtk-sharp, gnome-sharp or gtkhtml-sharp) may not be properly installed in the GAC.", ex);
						retry = false;
					}
				} finally {
					Runtime.Shutdown ();
				}
			}
			while (retry);

			if (logFile != null)
				logFile.Close ();

			return -1;
		}
Beispiel #3
0
        public static int Main(string[] args, IdeCustomizer customizer = null)
        {
            var options = MonoDevelopOptions.Parse(args);

            if (options.ShowHelp || options.Error != null)
            {
                return(options.Error != null? -1 : 0);
            }

            LoggingService.Initialize(options.RedirectOutput);

            if (customizer == null)
            {
                customizer = LoadBrandingCustomizer();
            }
            options.IdeCustomizer = customizer;

            int  ret   = -1;
            bool retry = false;

            do
            {
                try {
                    var exename = Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location);
                    if (!Platform.IsMac && !Platform.IsWindows)
                    {
                        exename = exename.ToLower();
                    }
                    Runtime.SetProcessName(exename);
                    var app = new IdeStartup();
                    ret = app.Run(options);
                    break;
                } catch (Exception ex) {
                    if (!retry && AddinManager.IsInitialized)
                    {
                        LoggingService.LogWarning(BrandingService.ApplicationName + " failed to start. Rebuilding addins registry.", ex);
                        AddinManager.Registry.Rebuild(new Mono.Addins.ConsoleProgressStatus(true));
                        LoggingService.LogInfo("Addin registry rebuilt. Restarting {0}.", BrandingService.ApplicationName);
                        retry = true;
                    }
                    else
                    {
                        LoggingService.LogFatalError(
                            string.Format(
                                "{0} failed to start. Some of the assemblies required to run {0} (for example gtk-sharp)" +
                                "may not be properly installed in the GAC.",
                                BrandingService.ApplicationName
                                ), ex);
                        retry = false;
                    }
                } finally {
                    Runtime.Shutdown();
                }
            }while (retry);

            LoggingService.Shutdown();

            return(ret);
        }
Beispiel #4
0
        public static int Main(string[] args, IdeCustomizer customizer = null)
        {
            IdeStartupTracker.StartupTracker.Start();

            var options = MonoDevelopOptions.Parse(args);

            if (options.ShowHelp || options.Error != null)
            {
                return(options.Error != null? -1 : 0);
            }

            LoggingService.Initialize(options.RedirectOutput);

            if (customizer == null)
            {
                customizer = LoadBrandingCustomizer();
            }
            options.IdeCustomizer = customizer;

            if (!Platform.IsWindows)
            {
                // Limit maximum threads when running on mono
                int threadCount = 125;
                ThreadPool.SetMaxThreads(threadCount, threadCount);
            }

            int ret = -1;

            try {
                var exename = Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location);
                if (!Platform.IsMac && !Platform.IsWindows)
                {
                    exename = exename.ToLower();
                }
                Runtime.SetProcessName(exename);

                IdeStartupTracker.StartupTracker.MarkSection("mainInitialization");

                var app = new IdeStartup();
                ret = app.Run(options);
            } catch (Exception ex) {
                LoggingService.LogFatalError(
                    string.Format(
                        "{0} failed to start. Some of the assemblies required to run {0} (for example gtk-sharp)" +
                        "may not be properly installed in the GAC.",
                        BrandingService.ApplicationName
                        ), ex);
            } finally {
                Runtime.Shutdown();
            }

            LoggingService.Shutdown();

            return(ret);
        }
Beispiel #5
0
        public static int Main(string[] args)
        {
            var options = MonoDevelopOptions.Parse(args);

            if (options.ShowHelp || options.Error != null)
            {
                return(options.Error != null? -1 : 0);
            }

            LoggingService.Initialize(options.RedirectOutput);

            int  ret   = -1;
            bool retry = false;

            do
            {
                try
                {
                    Runtime.SetProcessName(BrandingService.ApplicationName);
                    var app = new IdeStartup();
                    ret = app.Run(options);
                    break;
                }
                catch (Exception ex)
                {
                    if (!retry && AddinManager.IsInitialized)
                    {
                        LoggingService.LogWarning(BrandingService.ApplicationName + " failed to start. Rebuilding addins registry.");
                        AddinManager.Registry.Rebuild(new Mono.Addins.ConsoleProgressStatus(true));
                        LoggingService.LogInfo("Addin registry rebuilt. Restarting MonoDevelop.");
                        retry = true;
                    }
                    else
                    {
                        LoggingService.LogFatalError(BrandingService.ApplicationName + " failed to start. Some of the assemblies required to run MonoDevelop (for example gtk-sharp, gnome-sharp or gtkhtml-sharp) may not be properly installed in the GAC.", ex);
                        retry = false;
                    }
                }
                finally
                {
                    Runtime.Shutdown();
                }
            }while (retry);

            LoggingService.Shutdown();

            return(ret);
        }
Beispiel #6
0
        public static int Main(string[] args)
        {
            bool retry = false;

            EnableFileLogging();

            do
            {
                try {
                    Runtime.SetProcessName(BrandingService.ApplicationName);
                    var app = new IdeStartup();
                    return(app.Run(args));
                } catch (Exception ex) {
                    if (!retry && AddinManager.IsInitialized)
                    {
                        LoggingService.LogWarning(BrandingService.ApplicationName + " failed to start. Rebuilding addins registry.");
                        AddinManager.Registry.Rebuild(new Mono.Addins.ConsoleProgressStatus(true));
                        LoggingService.LogInfo("Addin registry rebuilt. Restarting MonoDevelop.");
                        retry = true;
                    }
                    else
                    {
                        LoggingService.LogFatalError(BrandingService.ApplicationName + " failed to start. Some of the assemblies required to run MonoDevelop (for example gtk-sharp, gnome-sharp or gtkhtml-sharp) may not be properly installed in the GAC.", ex);
                        retry = false;
                    }
                } finally {
                    Runtime.Shutdown();
                }
            }while (retry);

            if (logFile != null)
            {
                logFile.Close();
            }

            return(-1);
        }
Beispiel #7
0
		public static int Main (string[] args, IdeCustomizer customizer = null)
		{
			var options = MonoDevelopOptions.Parse (args);
			if (options.ShowHelp || options.Error != null)
				return options.Error != null? -1 : 0;
			
			LoggingService.Initialize (options.RedirectOutput);

			if (customizer == null)
				customizer = LoadBrandingCustomizer ();
			options.IdeCustomizer = customizer;

			int ret = -1;
			try {
				var exename = Path.GetFileNameWithoutExtension (Assembly.GetEntryAssembly ().Location);
				if (!Platform.IsMac && !Platform.IsWindows)
					exename = exename.ToLower ();
				Runtime.SetProcessName (exename);
				var app = new IdeStartup ();
				ret = app.Run (options);
			} catch (Exception ex) {
				LoggingService.LogFatalError (
					string.Format (
						"{0} failed to start. Some of the assemblies required to run {0} (for example gtk-sharp)" +
						"may not be properly installed in the GAC.",
						BrandingService.ApplicationName
					), ex);
			} finally {
				Runtime.Shutdown ();
			}

			LoggingService.Shutdown ();

			return ret;
		}
Beispiel #8
0
		public static int Main (string[] args)
		{
			var options = MonoDevelopOptions.Parse (args);
			if (options.ShowHelp || options.Error != null)
				return options.Error != null? -1 : 0;
			
			LoggingService.Initialize (options.RedirectOutput);
			
			int ret = -1;
			bool retry = false;
			do {
				try {
					var exename = Path.GetFileNameWithoutExtension (Assembly.GetEntryAssembly ().Location);
					if (!Platform.IsMac && !Platform.IsWindows)
						exename = exename.ToLower ();
					Runtime.SetProcessName (exename);
					var app = new IdeStartup ();
					ret = app.Run (options);
					break;
				} catch (Exception ex) {
					if (!retry && AddinManager.IsInitialized) {
						LoggingService.LogWarning (BrandingService.ApplicationName + " failed to start. Rebuilding addins registry.", ex);
						AddinManager.Registry.Rebuild (new Mono.Addins.ConsoleProgressStatus (true));
						LoggingService.LogInfo ("Addin registry rebuilt. Restarting {0}.", BrandingService.ApplicationName);
						retry = true;
					} else {
						LoggingService.LogFatalError (
							string.Format (
								"{0} failed to start. Some of the assemblies required to run {0} (for example gtk-sharp)" +
								"may not be properly installed in the GAC.",
								BrandingService.ApplicationName
							), ex);
						retry = false;
					}
				} finally {
					Runtime.Shutdown ();
				}
			}
			while (retry);

			LoggingService.Shutdown ();

			return ret;
		}
Beispiel #9
0
		public static int Main (string[] args)
		{
			var options = MonoDevelopOptions.Parse (args);
			if (options.ShowHelp || options.Error != null)
				return options.Error != null? -1 : 0;
			
			LoggingService.Initialize (options.RedirectOutput);
			
			int ret = -1;
			bool retry = false;
			do {
				try {
					Runtime.SetProcessName (BrandingService.ApplicationName);
					var app = new IdeStartup ();
					ret = app.Run (options);
					break;
				} catch (Exception ex) {
					if (!retry && AddinManager.IsInitialized) {
						LoggingService.LogWarning (BrandingService.ApplicationName + " failed to start. Rebuilding addins registry.");
						AddinManager.Registry.Rebuild (new Mono.Addins.ConsoleProgressStatus (true));
						LoggingService.LogInfo ("Addin registry rebuilt. Restarting MonoDevelop.");
						retry = true;
					} else {
						LoggingService.LogFatalError (BrandingService.ApplicationName + " failed to start. Some of the assemblies required to run MonoDevelop (for example gtk-sharp, gnome-sharp or gtkhtml-sharp) may not be properly installed in the GAC.", ex);
						retry = false;
					}
				} finally {
					Runtime.Shutdown ();
				}
			}
			while (retry);

			return ret;
		}
Beispiel #10
0
        public static int Main(string[] args, IdeCustomizer customizer = null)
        {
            var options = MonoDevelopOptions.Parse(args);

            if (options.ShowHelp || options.Error != null)
            {
                return(options.Error != null? -1 : 0);
            }

            LoggingService.Initialize(options.RedirectOutput);

            if (customizer == null)
            {
                customizer = LoadBrandingCustomizer();
            }
            options.IdeCustomizer = customizer;

            int ret = -1;

            try {
                var exename = Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location);
                if (!Platform.IsMac && !Platform.IsWindows)
                {
                    exename = exename.ToLower();
                }
                Runtime.SetProcessName(exename);
                var app = new IdeStartup();
                ret = app.Run(options);
            } catch (Exception ex) {
                LoggingService.LogFatalError(
                    string.Format(
                        "{0} failed to start. Some of the assemblies required to run {0} (for example gtk-sharp)" +
                        "may not be properly installed in the GAC.",
                        BrandingService.ApplicationName
                        ), ex);

                if (Platform.IsWindows)
                {
                    string url     = "http://monodevelop.com/Download";
                    string caption = "Fatal Error";
                    string message =
                        "{0} failed to start. Some of the assemblies required to run {0} (for example GTK#) " +
                        "may not be properly installed in the GAC.\n\r\n\r" +
                        "Please click OK to open the download page, where " +
                        "you can download the necessary dependencies for {0} to run.";

                    if (DisplayWindowsOkCancelMessage(
                            string.Format(message, BrandingService.ApplicationName, url), caption)
                        )
                    {
                        Process.Start(url);
                    }
                }
            } finally {
                Runtime.Shutdown();
            }

            LoggingService.Shutdown();

            return(ret);
        }