File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
src/Microsoft.Performance.SDK/Processing Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,21 @@ private static Type CreateStructFunctionType(MethodInfo methodToCall)
110
110
var resultType = methodToCall . ReturnType ;
111
111
112
112
var type = moduleBuilder . DefineType (
113
- methodToCall . DeclaringType . FullName + "$." + methodToCall . Name ,
113
+ //
114
+ // Notes:
115
+ //
116
+ // 1. `MethodInfo.MethodHandle.Value` is used in the name of the generated type as a unique identifier
117
+ // to avoid type name collisions.
118
+ //
119
+ // `MethofInfo.DelaringType.FullName` and `MethofInfo.DelaringType.Name` are used there only for
120
+ // easy attribution purposes and could, in principle, be removed. The exact `methodToCall` is
121
+ // available in the code of the `get_Item` method of the generated dynamic type.
122
+ //
123
+ // 2. The `MethodInfo.MethodHandle.Value` cannot be reused while this generated type is still loaded
124
+ // because `methodToCall` is referenced directly in the IL code of the `get_Item` method of the
125
+ // generated dynamic type.
126
+ //
127
+ $ "{ methodToCall . DeclaringType . FullName } $.{ methodToCall . Name } $.{ methodToCall . MethodHandle . Value . ToInt64 ( ) : x16} ",
114
128
TypeAttributes . Public ,
115
129
typeof ( ValueType ) ,
116
130
new Type [ ]
You can’t perform that action at this time.
0 commit comments