void ParseMarkers(object data) { #if USEAFFINITY // The "extension" method SetThreadProcessorAffinity was missing the "this" notation, // so it's not really an extension hence this style of call. RuntimeExtensions.SetThreadProcessorAffinity(Thread.CurrentThread, 4); #endif try { string result = data as string; XDocument markerXml = XDocument.Parse(result); IEnumerable <MediaMarker> markers = _markerParser.ParseMarkerCollection(markerXml, TimeSpan.Zero, TimeSpan.MaxValue) .Cast <MediaMarker>() .ToList(); System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() => ParseSucceeded(markers)); } catch (Exception ex) { System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() => LogParseError(ex)); } }