C# Why do I not get the "Cross-thread operation not valid" error
I use a BackgroundWorker and do this:

    private void loadNewAsyncToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Text = "RunWorkerAsync()";
            backgroundWorkerLoading.RunWorkerAsync();
        }

    private void backgroundWorkerLoading_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            UnsafeThreadMethod("hello");
            EvenUnsaferThreadMethod();
        }

And now the two methods.

    private void UnsafeThreadMethod(string text)
        {
            toolStripLabelRssFeedData.Text = text;
        }

    private void EvenUnsaferThreadMethod()
        {
            panelLoading.Visible = true;
        }

I don't understand why `UnsafeThreadMethod` doesn't throw the following exception but `EvenUnsaferThreadMethod` does.

> Cross-thread operation not valid: Control 'panelLoading' accessed from a thread other than the > thread it was created on.

According to the message it's because `toolStripLabelRssFeedData` was created on the same thread but it wasn't.

I thought that I can't call controls created by the main thread and have to use the `ProgressChanged` event. What's going on?

And I have a second question. What is the advantage of doing it like this when I can use `ProgressChanged`? What should I do?

    private void EvenUnsaferThreadMethod()
        {
            if (panelLoading.InvokeRequired)
            {
                panelLoading.Invoke(new MethodInvoker(() => { EvenUnsaferThreadMethod(); }));
            }
            else
            {
                panelLoading.Visible = true;
            }
        }

Thank you for reading and hopefully for answering as well. :)
C# Why do I not get the "Cross-thread operation not valid" error
===

I use a BackgroundWorker and do this:

    private void loadNewAsyncToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Text = "RunWorkerAsync()";
            backgroundWorkerLoading.RunWorkerAsync();
        }

    private void backgroundWorkerLoading_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            UnsafeThreadMethod("hello");
            EvenUnsaferThreadMethod();
        }

And now the two methods.

    private void UnsafeThreadMethod(string text)
        {
            toolStripLabelRssFeedData.Text = text;
        }

    private void EvenUnsaferThreadMethod()
        {
            panelLoading.Visible = true;
        }

I don't understand why `UnsafeThreadMethod` doesn't throw the following exception but `EvenUnsaferThreadMethod` does.

> Cross-thread operation not valid: Control 'panelLoading' accessed from a thread other than the > thread it was created on.

According to the message it's because `toolStripLabelRssFeedData` was created on the same thread but it wasn't.

I thought that I can't call controls created by the main thread and have to use the `ProgressChanged` event. What's going on?

And I have a second question. What is the advantage of doing it like this when I can use `ProgressChanged`? What should I do?

    private void EvenUnsaferThreadMethod()
        {
            if (panelLoading.InvokeRequired)
            {
                panelLoading.Invoke(new MethodInvoker(() => { EvenUnsaferThreadMethod(); }));
            }
            else
            {
                panelLoading.Visible = true;
            }
        }

Thank you for reading and hopefully for answering as well. :)