Repository: AvaloniaUI/Avalonia
File: src/Avalonia.Controls/AppBuilderBase.cs (C#)

Code before:
        public TAppBuilder AfterPlatformServicesSetup(Action<TAppBuilder> callback)
        {
            AfterPlatformServicesSetupCallback = (Action<TAppBuilder>)Delegate.Combine(AfterPlatformServicesSetupCallback, callback);
            return Self;
        }

        /// <summary>
        /// Starts the application with an instance of <typeparamref name="TMainWindow"/>.
        /// </summary>
        /// <typeparam name="TMainWindow">The window type.</typeparam>
        /// <param name="dataContextProvider">A delegate that will be called to create a data context for the window (optional).</param>
        [Obsolete("Use either lifetimes or AppMain overload. See see https://github.com/AvaloniaUI/Avalonia/wiki/Application-lifetimes for details")]
        public void Start<TMainWindow>(Func<object> dataContextProvider = null)
            where TMainWindow : Window, new()
        {
            AfterSetup(builder =>
            {
                var window = new TMainWindow();
                if (dataContextProvider != null)
                    window.DataContext = dataContextProvider();
                ((IClassicDesktopStyleApplicationLifetime)builder.Instance.ApplicationLifetime)
                    .MainWindow = window;
            });
            
            // Copy-pasted because we can't call extension methods due to generic constraints
            var lifetime = new ClassicDesktopStyleApplicationLifetime(Instance) {ShutdownMode = ShutdownMode.OnMainWindowClose};
            SetupWithLifetime(lifetime);
            lifetime.Start(Array.Empty<string>());
        }

        public delegate void AppMainDelegate(Application app, string[] args);

        [Obsolete("Use either lifetimes or AppMain overload. See see https://github.com/AvaloniaUI/Avalonia/wiki/Application-lifetimes for details", true)]
        public void Start()
        {
            throw new NotSupportedException();
        }

        public void Start(AppMainDelegate main, string[] args)
        {
            Setup();
            main(Instance, args);
        }

        /// <summary>
        /// Sets up the platform-specific services for the application, but does not run it.
        /// </summary>
        /// <returns></returns>
        public TAppBuilder SetupWithoutStarting()
        {
            Setup();

Review comment (security):
btw here `Instance` is null and `ClassicDesktopStyleApplicationLifetime` in general is always having a null application.
it's good that  `app.Run(...)` is extension method and everything is working fine, but there might be some general architecture design vulnerabilities

Code after:
        public TAppBuilder AfterPlatformServicesSetup(Action<TAppBuilder> callback)
        {
            AfterPlatformServicesSetupCallback = (Action<TAppBuilder>)Delegate.Combine(AfterPlatformServicesSetupCallback, callback);
            return Self;
        }

        /// <summary>
        /// Starts the application with an instance of <typeparamref name="TMainWindow"/>.
        /// </summary>
        /// <typeparam name="TMainWindow">The window type.</typeparam>
        /// <param name="dataContextProvider">A delegate that will be called to create a data context for the window (optional).</param>
        [Obsolete("Use either lifetimes or AppMain overload. See see https://github.com/AvaloniaUI/Avalonia/wiki/Application-lifetimes for details")]
        public void Start<TMainWindow>(Func<object> dataContextProvider = null)
            where TMainWindow : Window, new()
        {
            AfterSetup(builder =>
            {
                var window = new TMainWindow();
                if (dataContextProvider != null)
                    window.DataContext = dataContextProvider();
                ((IClassicDesktopStyleApplicationLifetime)builder.Instance.ApplicationLifetime)
                    .MainWindow = window;
            });
            
            // Copy-pasted because we can't call extension methods due to generic constraints
            var lifetime = new ClassicDesktopStyleApplicationLifetime() {ShutdownMode = ShutdownMode.OnMainWindowClose};
            SetupWithLifetime(lifetime);
            lifetime.Start(Array.Empty<string>());
        }

        public delegate void AppMainDelegate(Application app, string[] args);

        [Obsolete("Use either lifetimes or AppMain overload. See see https://github.com/AvaloniaUI/Avalonia/wiki/Application-lifetimes for details", true)]
        public void Start()
        {
            throw new NotSupportedException();
        }

        public void Start(AppMainDelegate main, string[] args)
        {
            Setup();
            main(Instance, args);
        }

        /// <summary>
        /// Sets up the platform-specific services for the application, but does not run it.
        /// </summary>
        /// <returns></returns>
        public TAppBuilder SetupWithoutStarting()
        {
            Setup();