mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Add diag logging to findout CI test failure.
This commit is contained in:
+17
@@ -38,6 +38,23 @@ internal sealed class ValidateOrder() : Executor<string, OrderDetails>("Validate
|
||||
string message,
|
||||
IWorkflowContext context,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await HandleAsyncCore(message, context, cancellationToken);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.Error.WriteLine($"[DIAG] ValidateOrder.HandleAsync failed: {ex.GetType().FullName}: {ex.Message}");
|
||||
Console.Error.WriteLine($"[DIAG] StackTrace: {ex.StackTrace}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private async ValueTask<OrderDetails> HandleAsyncCore(
|
||||
string message,
|
||||
IWorkflowContext context,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
await Task.Delay(TimeSpan.FromMilliseconds(200), cancellationToken);
|
||||
|
||||
|
||||
@@ -46,14 +46,46 @@ internal static class DurableActivityExecutor
|
||||
object typedInput = DeserializeInput(executorInput, inputType);
|
||||
|
||||
DurableWorkflowContext workflowContext = new(sharedState, executor);
|
||||
object? result = await executor.ExecuteCoreAsync(
|
||||
typedInput,
|
||||
new TypeId(inputType),
|
||||
workflowContext,
|
||||
WorkflowTelemetryContext.Disabled,
|
||||
cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return SerializeActivityOutput(result, workflowContext);
|
||||
object? result;
|
||||
try
|
||||
{
|
||||
result = await executor.ExecuteCoreAsync(
|
||||
typedInput,
|
||||
new TypeId(inputType),
|
||||
workflowContext,
|
||||
WorkflowTelemetryContext.Disabled,
|
||||
cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Diagnostic logging to surface inner exception details in CI
|
||||
Console.Error.WriteLine($"[DIAG] DurableActivityExecutor: ExecuteCoreAsync failed for '{binding.Id}' (inputType={inputType.FullName})");
|
||||
Console.Error.WriteLine($"[DIAG] Exception: {ex.GetType().FullName}: {ex.Message}");
|
||||
for (Exception? inner = ex.InnerException; inner is not null; inner = inner.InnerException)
|
||||
{
|
||||
Console.Error.WriteLine($"[DIAG] Inner: {inner.GetType().FullName}: {inner.Message}");
|
||||
Console.Error.WriteLine($"[DIAG] StackTrace: {inner.StackTrace}");
|
||||
}
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
string serialized;
|
||||
try
|
||||
{
|
||||
serialized = SerializeActivityOutput(result, workflowContext);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.Error.WriteLine($"[DIAG] DurableActivityExecutor: SerializeActivityOutput failed for '{binding.Id}'");
|
||||
Console.Error.WriteLine($"[DIAG] Result type: {result?.GetType().FullName ?? "null"}");
|
||||
Console.Error.WriteLine($"[DIAG] Exception: {ex.GetType().FullName}: {ex.Message}");
|
||||
Console.Error.WriteLine($"[DIAG] StackTrace: {ex.StackTrace}");
|
||||
throw;
|
||||
}
|
||||
|
||||
return serialized;
|
||||
}
|
||||
|
||||
private static string SerializeActivityOutput(object? result, DurableWorkflowContext context)
|
||||
|
||||
@@ -284,7 +284,11 @@ public abstract class Executor : IIdentified
|
||||
|
||||
if (!result.IsSuccess)
|
||||
{
|
||||
throw new TargetInvocationException($"Error invoking handler for {message.GetType()}", result.Exception);
|
||||
// Include inner exception details for diagnostics (otherwise hidden by DTS FailureDetails)
|
||||
string innerDetails = result.Exception is not null
|
||||
? $" --> {result.Exception.GetType().Name}: {result.Exception.Message}"
|
||||
: string.Empty;
|
||||
throw new TargetInvocationException($"Error invoking handler for {message.GetType()}{innerDetails}", result.Exception);
|
||||
}
|
||||
|
||||
if (result.IsVoid)
|
||||
|
||||
Reference in New Issue
Block a user