public static T EvaluateSafe <T>(this IWebView iwb, Func <T> evaluate) { try { return(evaluate()); } catch (InvalidOperationException) { return(iwb.EvaluateSafeAsync(evaluate).Result); } }