@@ -48,10 +48,10 @@ internal static void RetrieveCallSites(Dictionary<string, AspectClass> aspectCla
48
48
continue ;
49
49
}
50
50
51
- var aspectClassLine = GetAspectLine ( aspectClassAttribute , out var category ) ;
51
+ var aspectClassLine = $ " { GetAspectLine ( aspectClassAttribute , out var category ) } { aspectClassType . FullName } " ;
52
52
if ( ! aspectClasses . TryGetValue ( aspectClassLine , out var aspectClass ) )
53
53
{
54
- aspectClass = new AspectClass ( aspectClassType , aspectClassAttribute ) ;
54
+ aspectClass = new AspectClass ( ) ;
55
55
aspectClass . Categories |= category ;
56
56
aspectClasses [ aspectClassLine ] = aspectClass ;
57
57
}
@@ -61,10 +61,10 @@ internal static void RetrieveCallSites(Dictionary<string, AspectClass> aspectCla
61
61
{
62
62
foreach ( var aspectAttribute in method . CustomAttributes . Where ( IsAspect ) )
63
63
{
64
- var aspectLine = GetAspectLine ( aspectAttribute , out _ ) ;
64
+ var aspectLine = $ " { GetAspectLine ( aspectAttribute , out _ ) } { GetMethodName ( method ) } " ;
65
65
if ( ! aspectClass . Aspects . TryGetValue ( aspectLine , out var aspect ) )
66
66
{
67
- aspect = new Aspect ( method , aspectAttribute ) ;
67
+ aspect = new Aspect ( ) ;
68
68
}
69
69
70
70
aspect . Tfms |= tfmCategory ;
@@ -73,6 +73,12 @@ internal static void RetrieveCallSites(Dictionary<string, AspectClass> aspectCla
73
73
}
74
74
}
75
75
76
+ string GetMethodName ( MethodDefinition method )
77
+ {
78
+ var fullName = method . FullName ;
79
+ return fullName . Substring ( fullName . IndexOf ( "::" ) + 2 ) . Replace ( "<T>" , "<!!0>" ) ;
80
+ }
81
+
76
82
bool IsAspectClass ( Mono . Cecil . CustomAttribute attribute )
77
83
{
78
84
return attribute . AttributeType . FullName . StartsWith ( "Datadog.Trace.Iast.Dataflow.AspectClass" ) ;
@@ -278,40 +284,26 @@ internal static TargetFrameworks GetCategory(TargetFramework tfm)
278
284
279
285
internal struct AspectClass
280
286
{
281
- public AspectClass ( TypeDefinition aspectClassType , CustomAttribute aspectClassAttribute )
282
- {
283
- AspectClassType = aspectClassType ;
284
- AspectClassAttribute = aspectClassAttribute ;
285
- }
287
+ public AspectClass ( ) { }
286
288
287
- public TypeDefinition AspectClassType ;
288
- public CustomAttribute AspectClassAttribute ;
289
289
public Dictionary < string , Aspect > Aspects = new Dictionary < string , Aspect > ( ) ;
290
290
public InstrumentationCategory Categories = InstrumentationCategory . Iast ;
291
291
292
292
public string Subfix ( )
293
293
{
294
- return $ " { AspectClassType . FullName } { ( ( long ) Categories ) . ToString ( ) } ";
294
+ return $ " { ( ( long ) Categories ) . ToString ( ) } ";
295
295
}
296
296
}
297
297
298
298
internal struct Aspect
299
299
{
300
- public Aspect ( MethodDefinition aspectMethod , CustomAttribute aspectAttribute )
301
- {
302
- AspectMethod = aspectMethod ;
303
- AspectAttribute = aspectAttribute ;
304
- }
300
+ public Aspect ( ) { }
305
301
306
- public MethodDefinition AspectMethod ;
307
- public CustomAttribute AspectAttribute ;
308
302
public TargetFrameworks Tfms = TargetFrameworks . None ;
309
303
310
304
public string Subfix ( )
311
305
{
312
- var fullName = AspectMethod . FullName ;
313
- var methodName = fullName . Substring ( fullName . IndexOf ( "::" ) + 2 ) . Replace ( "<T>" , "<!!0>" ) ;
314
- return $ " { methodName } { ( ( long ) Tfms ) . ToString ( ) } ";
306
+ return $ " { ( ( long ) Tfms ) . ToString ( ) } ";
315
307
}
316
308
}
317
309
}
0 commit comments