Fix intermittent crash under AOT caused by IEnumerable.GetEnumerator() resolving to IEnumerator<T>, which gives a System.String instead of an enumerator