Repository: microsoft/PowerToys
File: src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandlerControl.cs (C#)

Code before:
            InvokeOnControlThread(() =>
            {
                _loadingBar = new ProgressBar();
                _loadingBar.Width = this.Width;
                _loadingBar.Location = new Point(0, 40);
                _loadingBar.Maximum = 100;
                _loadingBar.Value = 10;
                Controls.Add(_loadingBar);
                this.Update();

                _loading = new Label();
                _loading.Text = Resources.Loading_Screen_Message;
                _loading.Width = this.Width;
                _loading.Height = this.Height;
                _loading.Font = new Font("MS Sans Serif", 16, FontStyle.Bold);
                _loading.ForeColor = Settings.TextColor;
                _loading.BackColor = Settings.BackgroundColor;
                Controls.Add(_loading);
                this.Update();
            });
            Logger.LogInfo("Loading screen initialized");
        }

        private void InitializeIndexFileAndSelectedFile(string filePath)
        {
            Task getFileExtensionTask = new Task(() =>
            {
                Logger.LogInfo("Starting getting monaco language id out of filetype");
                vsCodeLangSet = FileHandler.GetLanguage(Path.GetExtension(filePath));
            });
            getFileExtensionTask.Start();

            Task readPreviewedFileTask = new Task(() =>
            {
                using (StreamReader fileReader = new StreamReader(new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))
                {
                    Logger.LogInfo("Starting reading requested file");
                    var fileContent = fileReader.ReadToEnd();
                    fileReader.Close();
                    base64FileCode = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(fileContent));
                    Logger.LogInfo("Reading requested file ended");
                }
            });

            readPreviewedFileTask.Start();

            Task readHtmlFileTask = new Task(() =>
            {
                // prepping index html to load in
                using (StreamReader htmlFileReader = new StreamReader(new FileStream(Settings.AssemblyDirectory + "\\index.html", FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))
                {

Review comment (performance):
I'm not sure putting everything in tasks here like this brings some improvement tbh. Did you see significant performance improvement? None of these operations should be that consuming.. 

Code after:
        private void SetBackground()
        {
            Logger.LogTrace();
            InvokeOnControlThread(() =>
            {
                this.BackColor = Settings.BackgroundColor;
            });
        }

        private void InitializeLoadingScreen()
        {
            Logger.LogTrace();
            InvokeOnControlThread(() =>
            {
                _loadingBackground = new Label();
                _loadingBackground.BackColor = Settings.BackgroundColor;
                _loadingBackground.Width = this.Width;
                _loadingBackground.Height = this.Height;
                Controls.Add(_loadingBackground);
                _loadingBackground.BringToFront();

                _loadingBar = new ProgressBar();
                _loadingBar.Width = this.Width - 10;
                _loadingBar.Location = new Point(5, this.Height / 2);
                _loadingBar.Maximum = 100;
                _loadingBar.Value = 10;
                Controls.Add(_loadingBar);

                _loading = new Label();
                _loading.Text = Resources.Loading_Screen_Message;
                _loading.Width = this.Width;
                _loading.Height = 45;
                _loading.Location = new Point(0, _loadingBar.Location.Y - _loading.Height);
                _loading.TextAlign = ContentAlignment.TopCenter;
                _loading.Font = new Font("MS Sans Serif", 16, FontStyle.Bold);
                _loading.ForeColor = Settings.TextColor;
                Controls.Add(_loading);

                _loading.BringToFront();
                _loadingBar.BringToFront();

                this.Update();
            });
            Logger.LogInfo("Loading screen initialized");
        }

        private void InitializeIndexFileAndSelectedFile(string filePath)
        {
            Logger.LogInfo("Starting getting monaco language id out of filetype");
            _vsCodeLangSet = FileHandler.GetLanguage(Path.GetExtension(filePath));