mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
PR feedback fixes.
This commit is contained in:
@@ -127,7 +127,6 @@ internal sealed class DurableStreamingWorkflowRun : IStreamingWorkflowRun
|
||||
}
|
||||
}
|
||||
|
||||
// On terminal status, re-fetch with outputs to get the final result.
|
||||
// Check terminal states after draining events from custom status
|
||||
if (metadata.RuntimeStatus == OrchestrationRuntimeStatus.Completed)
|
||||
{
|
||||
@@ -304,7 +303,7 @@ internal sealed class DurableStreamingWorkflowRun : IStreamingWorkflowRun
|
||||
return (TResult)(object)resultJson;
|
||||
}
|
||||
|
||||
return JsonSerializer.Deserialize<TResult>(resultJson);
|
||||
return JsonSerializer.Deserialize<TResult>(resultJson, DurableSerialization.Options);
|
||||
}
|
||||
|
||||
// Fallback: the output is not wrapped in DurableWorkflowResult.
|
||||
@@ -320,7 +319,7 @@ internal sealed class DurableStreamingWorkflowRun : IStreamingWorkflowRun
|
||||
|
||||
if (innerString is not null)
|
||||
{
|
||||
return JsonSerializer.Deserialize<TResult>(innerString);
|
||||
return JsonSerializer.Deserialize<TResult>(innerString, DurableSerialization.Options);
|
||||
}
|
||||
}
|
||||
catch (JsonException)
|
||||
@@ -333,7 +332,7 @@ internal sealed class DurableStreamingWorkflowRun : IStreamingWorkflowRun
|
||||
return (TResult)(object)serializedOutput;
|
||||
}
|
||||
|
||||
return JsonSerializer.Deserialize<TResult>(serializedOutput);
|
||||
return JsonSerializer.Deserialize<TResult>(serializedOutput, DurableSerialization.Options);
|
||||
}
|
||||
|
||||
[UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Deserializing workflow event types.")]
|
||||
|
||||
@@ -177,7 +177,6 @@ internal sealed class DurableWorkflowRunner
|
||||
|
||||
if (haltRequested)
|
||||
{
|
||||
logger.LogWorkflowCompleted();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+18
-1
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
|
||||
using System.Text.Json;
|
||||
using Microsoft.Agents.AI.DurableTask.Workflows;
|
||||
@@ -587,6 +587,23 @@ public sealed class DurableStreamingWorkflowRunTests
|
||||
Assert.Equal(42, result.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExtractResult_CamelCaseSerializedObject_DeserializesToPascalCaseMembers()
|
||||
{
|
||||
// Arrange — executor outputs are serialized with DurableSerialization.Options (camelCase)
|
||||
TestPayload original = new() { Name = "camel", Value = 99 };
|
||||
string resultJson = JsonSerializer.Serialize(original, DurableSerialization.Options);
|
||||
string serializedOutput = SerializeWorkflowResult(resultJson, []);
|
||||
|
||||
// Act
|
||||
TestPayload? result = DurableStreamingWorkflowRun.ExtractResult<TestPayload>(serializedOutput);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal("camel", result.Name);
|
||||
Assert.Equal(99, result.Value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private sealed class TestPayload
|
||||
|
||||
Reference in New Issue
Block a user