For some unknown reason that would be unreasonably complicated to find out why, dotnet/linker removes IEnumerator interface method implementations from the Enumerator class which we generate. Might be something related to their issues with cecil https://github.com/dotnet/linker/issues/1187
NativeAOT linked works just fine with implicit methods.
But for mono/linker changing methods to explicitly implement interface helps here.
Other possible reasons: linker doesn't have enough information, because we use this enumerator from "object GetService(Type)" method, or we simply have a mistake in IL generation somewhere (or Cecil has). Like, our methods unnecessarily marked as "virtual" by default.
See this unusual stack trace for more context: https://github.com/AvaloniaUI/Avalonia/issues/9127#issuecomment-1327976983
For some unknown reason that would be unreasonably complicated to find out why, dotnet/linker removes IEnumerator interface method implementations from the Enumerator class which we generate. Might be something related to their issues with cecil https://github.com/dotnet/linker/issues/1187
NativeAOT linked works just fine with implicit methods. But for mono/linker changing methods to explicitly implement interface helps here. Other possible reasons: linker doesn't have enough information, because we use this enumerator from "object GetService(Type)" method, or we simply have a mistake in IL generation somewhere (or Cecil has). Like, our methods unnecessarily marked as "virtual" by default.