Currently I have the code that is called from a Task that is causing performance issues.
var jsBoardInfo = Board.ConvertToJS((Board)pathItem);
Tuple<Board, CurrentPiece> returnItem = (Tuple<Board, CurrentPiece>)realInfo.form.Invoke(
new Func<object, Tuple<Board, CurrentPiece>>((jsBoardObj) =>
var jsBoard = (int)jsBoardObj;
return new Tuple<Board, CurrentPiece>(newBoard, newPiece);