diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/OutputInfoBuilder.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/OutputInfoBuilder.cs index ca6efc9edb1116..21f9169f294a7f 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/OutputInfoBuilder.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/OutputInfoBuilder.cs @@ -183,24 +183,22 @@ public IEnumerable EnumerateMethods() { DebugNameFormatter nameFormatter = new DebugNameFormatter(); TypeNameFormatter typeNameFormatter = new TypeString(); - HashSet emittedMethods = new HashSet(); foreach (KeyValuePair symbolMethodPair in _methodSymbolMap) { - EcmaMethod ecmaMethod = symbolMethodPair.Value.Method.GetTypicalMethodDefinition() as EcmaMethod; - if (ecmaMethod != null && emittedMethods.Add(ecmaMethod)) + MethodInfo methodInfo = new MethodInfo(); + if (symbolMethodPair.Value.Method.GetTypicalMethodDefinition() is EcmaMethod ecmaMethod) { - MethodInfo methodInfo = new MethodInfo(); methodInfo.MethodToken = (uint)MetadataTokens.GetToken(ecmaMethod.Handle); methodInfo.AssemblyName = ecmaMethod.Module.Assembly.GetName().Name; - methodInfo.Name = FormatMethodName(symbolMethodPair.Value.Method, typeNameFormatter); - OutputNode node = _nodeSymbolMap[symbolMethodPair.Key]; - Section section = _sections[node.SectionIndex]; - methodInfo.HotRVA = (uint)(section.RVAWhenPlaced + node.Offset); - methodInfo.HotLength = (uint)node.Length; - methodInfo.ColdRVA = 0; - methodInfo.ColdLength = 0; - yield return methodInfo; } + methodInfo.Name = FormatMethodName(symbolMethodPair.Value.Method, typeNameFormatter); + OutputNode node = _nodeSymbolMap[symbolMethodPair.Key]; + Section section = _sections[node.SectionIndex]; + methodInfo.HotRVA = (uint)(section.RVAWhenPlaced + node.Offset); + methodInfo.HotLength = (uint)node.Length; + methodInfo.ColdRVA = 0; + methodInfo.ColdLength = 0; + yield return methodInfo; } }