The built-in definition of get-enum sees a class as IEnumerable and returns it, even if it also implements IEnumerator.
Obviously the code can be changed in Primitives.cs (get_enum_IEnumerator), but the simple override that provides correct behaviour for enumerable enumerators (such as the Linq enumerators) is:
; 'Fix' get-enum so it defaults to
; calling .GetEnumerator even if it
; implements IEnumerator
(def-method (get-enum
(e System.Collections.IEnumerator.))
(if (is? e System.Collections.IEnumerable.)
(.System.Collections.IEnumerable:GetEnumerator e)
e))
I've added the above to my personal extra.lisp (with some extra tracing to see how often it is exercised) and it hasn't broken anything yet.
It /will/ break something if existing code starts an enumeration and calls something else with the 'active' enumerator and that calls get-enum again, where the enumerator still implements IEnumerable.