Skip to content

WindowsDriver.cs sporadically triggering 'System.IndexOutOfRange' errors #3033

Answered by tznind
dkim-epic asked this question in Q&A
Discussion options

You must be logged in to vote

When you access UI code from a thread make sure to use Application.MainLoop.Invoke

For example

Application.Init ();


Task.Run (() => {
	// Runs on another Thread
	Task.Delay (5000).Wait ();

	// Invoke the action onto main UI thread
	Application.MainLoop.Invoke (() => {

		// Your UI code here
		MessageBox.Query ("Heya", "Hey", "ok");
		
	});
});

Application.Run (new Window("yar"));
Application.Shutdown ();

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@dkim-epic
Comment options

@BDisp
Comment options

@dkim-epic
Comment options

Answer selected by dkim-epic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants