diff --git a/src/AutoRest.CSharp/build/CodeGeneration.targets b/src/AutoRest.CSharp/build/CodeGeneration.targets index d80769ae65d..18ec3036c6e 100644 --- a/src/AutoRest.CSharp/build/CodeGeneration.targets +++ b/src/AutoRest.CSharp/build/CodeGeneration.targets @@ -2,10 +2,10 @@ pwsh - $(MSBuildProjectDirectory)/../../../../eng/scripts/Cadl-Project-Sync.ps1 - $(MSBuildProjectDirectory)/../../../../eng/scripts/Cadl-Project-Generate.ps1 + $(MSBuildProjectDirectory)/../../../../eng/common/scripts/Cadl-Project-Sync.ps1 + $(MSBuildProjectDirectory)/../../../../eng/common/scripts/Cadl-Project-Generate.ps1 <_DefaultInputName Condition="Exists('$(MSBuildProjectDirectory)/autorest.md')">$(MSBuildProjectDirectory)/autorest.md - $(MSBuildProjectDirectory)/cadl-location.yaml + $(MSBuildProjectDirectory)/../cadl-location.yaml $(_DefaultInputName) $(MSBuildProjectDirectory)/autorest.tests.md $(MSBuildThisFileDirectory)../tools/autorest/entrypoints/app.js diff --git a/src/assets/Azure.Core.Shared/DiagnosticScope.cs b/src/assets/Azure.Core.Shared/DiagnosticScope.cs index c58c99af8cd..f1c303e64dc 100644 --- a/src/assets/Azure.Core.Shared/DiagnosticScope.cs +++ b/src/assets/Azure.Core.Shared/DiagnosticScope.cs @@ -340,7 +340,8 @@ public void AddLink(string traceparent, string tracestate, IDictionary? SetTraceStateStringMethod; private static Func? GetIdFormatMethod; private static Action? ActivityAddTagMethod; - private static Func>?, IList?, DateTimeOffset, Activity?>? ActivitySourceStartActivityMethod; + private static Func>?, IList?, DateTimeOffset, Activity?>? ActivitySourceStartActivityMethod; private static Func? ActivitySourceHasListenersMethod; private static Func>?, object?>? CreateActivityLinkMethod; private static Func>?>? CreateTagsCollectionMethod; @@ -667,7 +671,7 @@ public static bool ActivitySourceHasListeners(object? activitySource) return ActivitySourceHasListenersMethod.Invoke(activitySource); } - public static Activity? ActivitySourceStartActivity(object? activitySource, string activityName, int kind, DateTimeOffset startTime, ICollection>? tags, IList? links) + public static Activity? ActivitySourceStartActivity(object? activitySource, string activityName, int kind, DateTimeOffset startTime, ICollection>? tags, IList? links, string? parentId) { if (activitySource == null) { @@ -681,7 +685,7 @@ public static bool ActivitySourceHasListeners(object? activitySource) ActivityContextType == null || ActivityKindType == null) { - ActivitySourceStartActivityMethod = (_, _, _, _, _, _) => null; + ActivitySourceStartActivityMethod = (_, _, _, _, _, _, _) => null; } else { @@ -689,7 +693,7 @@ public static bool ActivitySourceHasListeners(object? activitySource) { typeof(string), ActivityKindType, - ActivityContextType, + typeof(string), typeof(IEnumerable>), typeof(IEnumerable<>).MakeGenericType(ActivityLinkType), typeof(DateTimeOffset) @@ -697,33 +701,34 @@ public static bool ActivitySourceHasListeners(object? activitySource) if (method == null) { - ActivitySourceStartActivityMethod = (_, _, _, _, _, _) => null; + ActivitySourceStartActivityMethod = (_, _, _, _, _, _, _) => null; } else { var sourceParameter = Expression.Parameter(typeof(object)); var nameParameter = Expression.Parameter(typeof(string)); var kindParameter = Expression.Parameter(typeof(int)); + var parentIdParameter = Expression.Parameter(typeof(string)); var startTimeParameter = Expression.Parameter(typeof(DateTimeOffset)); var tagsParameter = Expression.Parameter(typeof(ICollection>)); var linksParameter = Expression.Parameter(typeof(IList)); var methodParameter = method.GetParameters(); - ActivitySourceStartActivityMethod = Expression.Lambda>?, IList?, DateTimeOffset, Activity?>>( + ActivitySourceStartActivityMethod = Expression.Lambda>?, IList?, DateTimeOffset, Activity?>>( Expression.Call( Expression.Convert(sourceParameter, method.DeclaringType!), method, nameParameter, Expression.Convert(kindParameter, methodParameter[1].ParameterType), - Expression.Default(ActivityContextType), + Expression.Convert(parentIdParameter, methodParameter[2].ParameterType), Expression.Convert(tagsParameter, methodParameter[3].ParameterType), Expression.Convert(linksParameter, methodParameter[4].ParameterType), Expression.Convert(startTimeParameter, methodParameter[5].ParameterType)), - sourceParameter, nameParameter, kindParameter, tagsParameter, linksParameter, startTimeParameter).Compile(); + sourceParameter, nameParameter, kindParameter, parentIdParameter, tagsParameter, linksParameter, startTimeParameter).Compile(); } } } - return ActivitySourceStartActivityMethod.Invoke(activitySource, activityName, kind, tags, links, startTime); + return ActivitySourceStartActivityMethod.Invoke(activitySource, activityName, kind, parentId, tags, links, startTime); } public static object? CreateActivitySource(string name)