How can i pass for example the text of a textBox UI element into a Task.Run() method? This code will throw an exception(... other thread owns it). When i pass the filter variabele, the exception is gone, is this because the string gets passed as value?
private async void filterTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
if (currentSession.SessionFilenames != null)
{
string filter = filterTextBox.Text;
dirListing.ItemsSource = await Task<IEnumerable<string>>.Run(()=> Filterfiles(filterTextBox.Text));
}
}