I am working on something like Task Manager. I have UserControl with async method added to Initialized event that once every second gets all required data from system.
private async void UserControl_Initialized(object sender, EventArgs e)
        {
            try
            {
                await Task.Run(() =>
                {
                    while (true)
                    {
                        string cpuU = this.CpuUsage;
                        string cpuC = this.CpuClock;
                        string cpuPC = this.CpuProcesses;
                        string cpuTC = this.CpuThreads;
                        string memU = this.MemUsage;
                        string memA = this.MemAvailable;
                        string memC = this.MemCached;
                        Dispatcher.Invoke(() => {
                            this.usageBlock.Text = cpuU;
                            this.frequencyBlock.Text = cpuC;
                            this.processesBlock.Text = cpuPC;
                            this.threadsBlock.Text = cpuTC;
                            this.ramUsageBlock.Text = memU;
                            this.ramAvailableBlock.Text = memA;
                            this.ramCachedBlock.Text = memC;
                            });
                        Thread.Sleep(1000);
                    }
                });
            }
            catch(Exception ee)
            {
                Debug.WriteLine(ee.Message);
            }
        }
All of this works perfectly. The problem is that the project runs even when i didn't start debug. Video
I suppose Visual Studio somehow triggers Initialize event for designer to work. How to prevent this strange behavior and stop the rise of the machines?