@@ -54,7 +54,7 @@ private static void InjectFieldOffsetAttribute(ApplicationAnalysisContext appCon
54
54
var newAttribute = new AnalyzedCustomAttribute ( fieldOffsetConstructor ) ;
55
55
56
56
//This loop is not done parallel because f.Offset has heavy lock contention
57
- newAttribute . Fields . Add ( new ( offsetField , new CustomAttributePrimitiveParameter ( $ "0x{ f . Offset : X} ") ) ) ;
57
+ newAttribute . Fields . Add ( new ( offsetField , new CustomAttributePrimitiveParameter ( $ "0x{ f . Offset : X} ", newAttribute , CustomAttributeParameterKind . Field , 0 ) ) ) ;
58
58
f . CustomAttributes . Add ( newAttribute ) ;
59
59
}
60
60
}
@@ -87,12 +87,12 @@ private static void InjectAddressAttribute(ApplicationAnalysisContext appContext
87
87
88
88
if ( ! _useEzDiffMode )
89
89
{
90
- newAttribute . Fields . Add ( new ( rvaField , new CustomAttributePrimitiveParameter ( $ "0x{ m . Definition . Rva : X} ") ) ) ;
90
+ newAttribute . Fields . Add ( new ( rvaField , new CustomAttributePrimitiveParameter ( $ "0x{ m . Definition . Rva : X} ", newAttribute , CustomAttributeParameterKind . Field , 0 ) ) ) ;
91
91
if ( appContext . Binary . TryMapVirtualAddressToRaw ( m . UnderlyingPointer , out var offset ) )
92
- newAttribute . Fields . Add ( new ( offsetField , new CustomAttributePrimitiveParameter ( $ "0x{ offset : X} ") ) ) ;
92
+ newAttribute . Fields . Add ( new ( offsetField , new CustomAttributePrimitiveParameter ( $ "0x{ offset : X} ", newAttribute , CustomAttributeParameterKind . Field , 1 ) ) ) ;
93
93
}
94
94
95
- newAttribute . Fields . Add ( new ( lengthField , new CustomAttributePrimitiveParameter ( $ "0x{ m . RawBytes . Length : X} ") ) ) ;
95
+ newAttribute . Fields . Add ( new ( lengthField , new CustomAttributePrimitiveParameter ( $ "0x{ m . RawBytes . Length : X} ", newAttribute , CustomAttributeParameterKind . Field , newAttribute . Fields . Count ) ) ) ;
96
96
m . CustomAttributes . Add ( newAttribute ) ;
97
97
}
98
98
}
@@ -125,7 +125,7 @@ private static void InjectTokenAttribute(ApplicationAnalysisContext appContext)
125
125
return ;
126
126
127
127
var newAttribute = new AnalyzedCustomAttribute ( tokenConstructor ) ;
128
- newAttribute . Fields . Add ( new ( tokenField , new CustomAttributePrimitiveParameter ( $ "0x{ context . Token : X} ") ) ) ;
128
+ newAttribute . Fields . Add ( new ( tokenField , new CustomAttributePrimitiveParameter ( $ "0x{ context . Token : X} ", newAttribute , CustomAttributeParameterKind . Field , 0 ) ) ) ;
129
129
context . CustomAttributes . Add ( newAttribute ) ;
130
130
} ) ;
131
131
}
@@ -210,12 +210,12 @@ private static void ProcessCustomAttributesForContext(HasCustomAttributes contex
210
210
offsetInBinary = 0 ;
211
211
212
212
//Add the 3 fields to the replacement attribute
213
- replacementAttribute . Fields . Add ( new ( nameField , new CustomAttributePrimitiveParameter ( attribute . Constructor . DeclaringType ! . Name ) ) ) ;
214
- replacementAttribute . Fields . Add ( new ( rvaField , new CustomAttributePrimitiveParameter ( $ "0x{ generatorRva : X} ") ) ) ;
215
- replacementAttribute . Fields . Add ( new ( offsetField , new CustomAttributePrimitiveParameter ( $ "0x{ offsetInBinary : X} ") ) ) ;
213
+ replacementAttribute . Fields . Add ( new ( nameField , new CustomAttributePrimitiveParameter ( attribute . Constructor . DeclaringType ! . Name , replacementAttribute , CustomAttributeParameterKind . Field , 0 ) ) ) ;
214
+ replacementAttribute . Fields . Add ( new ( rvaField , new CustomAttributePrimitiveParameter ( $ "0x{ generatorRva : X} ", replacementAttribute , CustomAttributeParameterKind . Field , 1 ) ) ) ;
215
+ replacementAttribute . Fields . Add ( new ( offsetField , new CustomAttributePrimitiveParameter ( $ "0x{ offsetInBinary : X} ", replacementAttribute , CustomAttributeParameterKind . Field , 2 ) ) ) ;
216
216
217
217
//Replace the original attribute with the replacement attribute
218
218
context . CustomAttributes [ index ] = replacementAttribute ;
219
219
}
220
220
}
221
- }
221
+ }
0 commit comments