Catch InvalidOperationException at Array.sort