PR feedback fixes.

This commit is contained in:
Shyju Krishnankutty
2026-02-17 18:31:07 -08:00
Unverified
parent 3248060903
commit 13e53eec8f
3 changed files with 21 additions and 6 deletions
@@ -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;
}
@@ -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