I get an InvalidCastException without actually stripping anything

AutoResetEvent receiver = new AutoResetEvent(false); Thread t = null; t = new Thread(new ThreadStart(() => { while (Browser.ReadyState != WebBrowserReadyState.Complete) // error { Thread.Sleep(10); } receiver.Set(); t.Abort(); })); t.Start(); // Timeout success = receiver.WaitOne(10000); 

Browser

 public WebBrowser Browser { get; set; } 

Screenshothot

I do not understand why I get such an error. Browser.ReadyState is an enumeration type of WebBrowserReadyState

And what do you think?

EDIT: First: SS1 Second: SS2

+7
casting c # browser
source share

No one has answered this question yet.

See similar questions:

8
WebBrowser DocumentCompleted event fired more than once
2
InvalidCastException using WebBrowser.IsBusy or ReadyState (VB.NET)

or similar:

480
Curious collaboration operator with zero coalescence
66
How to apply an object to its actual type?
4
Using streams to update tags after receiving a string from bluetooth
2
WCF service thread interruption exception
one
Creating a new thread () queries the ParameterizedThreadStart object as a parameter in C sharp
0
AutoResetEvent and COM Objects
0
Triggered object using lambda on the thread is always null when comparing
0
WebBrowser navigating inside STAThread in the understanding of BackgroundWorker
0
Multithreading - wait until the object is initialized?
-one
Why the function does not work procedurally

All Articles