77using AsmResolver . DotNet . Code . Cil ;
88using AsmResolver . DotNet . Code . Native ;
99using AsmResolver . DotNet . Collections ;
10+ using AsmResolver . DotNet . PortablePdbs ;
1011using AsmResolver . DotNet . Signatures ;
1112using AsmResolver . PE . DotNet . Cil ;
1213using AsmResolver . PE . DotNet . Metadata . Tables ;
@@ -34,6 +35,7 @@ public class MethodDefinition :
3435 private readonly LazyVariable < MethodDefinition , ImplementationMap ? > _implementationMap ;
3536 private readonly LazyVariable < MethodDefinition , MethodSemantics ? > _semantics ;
3637 private readonly LazyVariable < MethodDefinition , UnmanagedExportInfo ? > _exportInfo ;
38+ private readonly LazyVariable < MethodDefinition , MethodDebugInformation > _methodDebugInformation ;
3739 private IList < ParameterDefinition > ? _parameterDefinitions ;
3840 private ParameterCollection ? _parameters ;
3941 private IList < CustomAttribute > ? _customAttributes ;
@@ -60,6 +62,12 @@ protected MethodDefinition(MetadataToken token)
6062 _implementationMap = new LazyVariable < MethodDefinition , ImplementationMap ? > ( x => x . GetImplementationMap ( ) ) ;
6163 _semantics = new LazyVariable < MethodDefinition , MethodSemantics ? > ( x => x . GetSemantics ( ) ) ;
6264 _exportInfo = new LazyVariable < MethodDefinition , UnmanagedExportInfo ? > ( x => x . GetExportInfo ( ) ) ;
65+ _methodDebugInformation = new LazyVariable < MethodDefinition , MethodDebugInformation > ( x =>
66+ {
67+ MethodDebugInformation ? mdi = null ;
68+ _ = x . DeclaringModule ? . PortablePdb ? . TryLookupMember ( new MetadataToken ( TableIndex . MethodDebugInformation , x . MetadataToken . Rid ) , out mdi ) ;
69+ return mdi ?? new MethodDebugInformation ( new MetadataToken ( TableIndex . MethodDebugInformation , x . MetadataToken . Rid ) ) ;
70+ } ) ;
6371 }
6472
6573 /// <summary>
@@ -792,6 +800,12 @@ public UnmanagedExportInfo? ExportInfo
792800 set => _exportInfo . SetValue ( value ) ;
793801 }
794802
803+ public MethodDebugInformation MethodDebugInformation
804+ {
805+ get => _methodDebugInformation . GetValue ( this ) ;
806+ set => _methodDebugInformation . SetValue ( value ) ;
807+ }
808+
795809 /// <summary>
796810 /// Creates a new private static constructor for a type that is executed when its declaring type is loaded by the CLR.
797811 /// </summary>
0 commit comments