You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please note that the user code must not rely on the ordering of the methods returned from reflection - DeclaredMethods is one such example. The API officially specified that the returned order is "undefined". The reason for the differences is that the method doesn't internally sort the list before returning it (for performance reasons), it simply walks the runtime structures. So any change to how the runtime stores these internally will be potentially observable in the order reported through the API. You might also see different order on different platforms (X86/X64, or Windows/Linux, ...). Also note that for example using Ready2Run on the assembly will likely change the order as well.
That said we could track down what exact change in the runtime caused the difference between .NET Core 2.* and .NET Core 3.*, but I don't think it's worth the effort.
Activity
vitek-karas commentedon Jan 29, 2020
Please note that the user code must not rely on the ordering of the methods returned from reflection - DeclaredMethods is one such example. The API officially specified that the returned order is "undefined". The reason for the differences is that the method doesn't internally sort the list before returning it (for performance reasons), it simply walks the runtime structures. So any change to how the runtime stores these internally will be potentially observable in the order reported through the API. You might also see different order on different platforms (X86/X64, or Windows/Linux, ...). Also note that for example using Ready2Run on the assembly will likely change the order as well.
That said we could track down what exact change in the runtime caused the difference between .NET Core 2.* and .NET Core 3.*, but I don't think it's worth the effort.
steveharter commentedon Mar 10, 2020
Closing; reflection order is non-deterministic.