Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TaskOrchestrationContext GetInput Returns Null #2577

Closed
krieger04 opened this issue Sep 12, 2023 · 4 comments · Fixed by #2578
Closed

TaskOrchestrationContext GetInput Returns Null #2577

krieger04 opened this issue Sep 12, 2023 · 4 comments · Fixed by #2578

Comments

@krieger04
Copy link

Description

After updating the Nuget package "Microsoft.Azure.Functions.Worker.Extensions.DurableTask" from 1.0.2 to 1.0.3, GetInput returns null.

await starter.ScheduleNewOrchestrationInstanceAsync("FuntionName", processingData);

[Function("FuntionName")]
public async Task ProcessOcrTaskFunction([OrchestrationTrigger] TaskOrchestrationContext context)
{
var processingData= context.GetInput(); //Returns Null
}

@engstrumpan
Copy link

+1
Just pulled my hair on this for the last couple of hours and realised upgrading to 1.0.3 from 1.0.0 which is part of the template shipped with Visual Studio 2022.

@jviau
Copy link
Contributor

jviau commented Sep 12, 2023

The fix has been published and will be available here: https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.DurableTask/2.11.2

When using dotnet isolated (Microsoft.Azure.Functions.Worker.Extensions.DurableTask), you need only clean & rebuild your project. Microsoft.Azure.Functions.Worker.Extensions.DurableTask/1.0.3 will pull in Microsoft.Azure.WebJobs.Extensions.DurableTask/2.11.*, which should pick up the latest of 2.11.2 which includes the fix.

@recumbented
Copy link

Primitive types seems working well, whereas passing object type throws in deserialization.

public class InputModel
{
    [JsonPropertyName("stringValue")]
    public String StringValue { get; set; }
}
[Function("RunOrchestration")]
public static Task RunOrchestration([OrchestrationTrigger] TaskOrchestrationContext context)
{
    var input = context.GetInput<InputModel>();
    Console.WriteLine(Assembly.GetAssembly(typeof(TaskOrchestrationContext)).GetName().Version);
    if (input is null)
        Console.WriteLine("INPUT IS NULL");
    else
        Console.WriteLine($"INPUT OK: {input.StringValue}");

    return Task.CompletedTask;
}
System.Text.Json.JsonException: The JSON value could not be converted to Durapippi.Models.InputModel. Path: $ | LineNumber: 0 | BytePositionInLine: 160.
   at System.Text.Json.ThrowHelper.ThrowJsonException_DeserializeUnableToConvertValue(Type propertyType)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 utf8Json, JsonTypeInfo jsonTypeInfo, Nullable`1 actualByteCount)
   at System.Text.Json.JsonSerializer.ReadUsingMetadata[TValue](JsonElement element, JsonTypeInfo jsonTypeInfo)
   at Microsoft.Azure.Functions.Worker.Extensions.DurableTask.FunctionsOrchestrationContext.JsonElementInputConverter.Get[T]() in /_/src/Worker.Extensions.DurableTask/FunctionsOrchestrationContext.InputConverter.cs:line 57
   at Microsoft.Azure.Functions.Worker.Extensions.DurableTask.FunctionsOrchestrationContext.GetInput[T]() in /_/src/Worker.Extensions.DurableTask/FunctionsOrchestrationContext.cs:line 66
   at Durapippi.Trigger.RunOrchestration(TaskOrchestrationContext context) in D:\Volatile\Durapippi\Durapippi\QueueTrigger.cs:line 21
   at lambda_method2(Closure, Trigger, Object[])
   at Microsoft.Azure.Functions.Worker.Invocation.VoidTaskMethodInvoker`2.InvokeAsync(TReflected instance, Object[] arguments) in D:\a\_work\1\s\src\DotNetWorker.Core\Invocation\VoidTaskMethodInvoker.cs:line 22

@davidmrdavid
Copy link
Contributor

@recumbented: Thanks for the report; the team is working on a hotfix now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants