Skip to content

Commit 59aa8f2

Browse files
Fix issue in GenerateIntegrationDefinitions.cs
Before: If an integration specified TargetMethodArgumentsToLoad as an empty array, it would be converted to null in InstrumentationDefinitions.Generated.cs and the automatic instrumentation would pass all parameters to the integration method. After: If an integration specified TargetMethodArgumentsToLoad as an empty array, it is preserved as an emptry array in InstrumentationDefinitions.Generated.cs and the automatic instrumentation will pass no method arguments (so only the object instance) to the integration method. Note: This may not need to be backported because no integrations in the 1.x branch actually set TargetMethodArgumentsToLoad to an empty array
1 parent 3b348df commit 59aa8f2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tracer/build/_build/PrepareRelease/GenerateIntegrationDefinitions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ from assemblyNames in GetPropertyValue<string[]>(attribute, "AssemblyNames")
9292
TargetAssembly = assemblyNames,
9393
TargetType = GetPropertyValue<string>(attribute, "TypeName"),
9494
TargetMethod = GetPropertyValue<string>(attribute, "MethodName"),
95-
TargetMethodArgumentsToLoad = (GetPropertyValue<ushort[]>(attribute, "TargetMethodArgumentsToLoad") ?? Enumerable.Empty<ushort>()).ToArray(),
95+
TargetMethodArgumentsToLoad = GetPropertyValue<ushort[]>(attribute, "TargetMethodArgumentsToLoad"),
9696
TargetSignatureTypes = new string[] { GetPropertyValue<string>(attribute, "ReturnTypeName") }
9797
.Concat(GetPropertyValue<string[]>(attribute, "ParameterTypeNames") ?? Enumerable.Empty<string>())
9898
.ToArray(),
@@ -149,7 +149,7 @@ static void WriteCallTargetDefinitionFile(StreamWriter swriter, IEnumerable<Call
149149

150150
swriter.Write(" }, ");
151151

152-
if (integration.TargetMethodArgumentsToLoad.Length > 0)
152+
if (integration.TargetMethodArgumentsToLoad is not null)
153153
{
154154
swriter.Write($" new ushort[] {{ ");
155155
for (var s = 0; s < integration.TargetMethodArgumentsToLoad.Length; s++)

0 commit comments

Comments
 (0)