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

Quotes added around activity function string parameter in isolated mode #2674

Closed
buckprime opened this issue Nov 14, 2023 · 11 comments · Fixed by #2708
Closed

Quotes added around activity function string parameter in isolated mode #2674

buckprime opened this issue Nov 14, 2023 · 11 comments · Fixed by #2708
Assignees
Labels
bug P1 Priority 1

Comments

@buckprime
Copy link

Description

Using Microsoft.Azure.Functions.Worker.Extensions.DurableTask version 1.1.0, when you pass a string parameter to an activity function (as a parameter with the [ActivityTrigger] attribute), the activity function receives it with quotes added around it.

I have an app that uses Durable Functions isolated mode in .NET 7, and when I upgraded the Microsoft.Azure.Functions.Worker.Extensions.DurableTask package to 1.1.0 this started happening. Thinking it might be something to do with my code, I used the new project wizard in Visual Studio to create a new Durable Functions isolated project and chose to have it create an orchestration function, so I now had the example "SayHello" app. Running this, it generates the expected Saying hello to Tokyo, Saying hello to Seattle, Saying hello to London messages. But when I updated the NuGet packages so that I'm now using Microsoft.Azure.Functions.Worker.Extensions.DurableTask 1.1.0, it now generates Saying hello to "Tokyo", Saying hello to "Seattle", Saying hello to "London". Also, if you break in the SayHello function, you'll see that the variable "name" doesn't just contain, say, "Tokyo," it contains "\"Tokyo\"".

A clear and concise description of what you expected to happen.

I expected that the activity function would receive the string passed in the CallAcivityAsync call unchanged, as it did in previous versions of the library.

Actual behavior

The activity function received the string with quotes added around it.

Relevant source code snippets

You can get this code by just creating the default app with the wizard in Visual Studio, but here are the relevant parts of the code. The orchestration function calls the activity function here:

outputs.Add(await context.CallActivityAsync<string>(nameof(SayHello), "Tokyo"));

And then the activity function starts with:

public static string SayHello([ActivityTrigger] string name, FunctionContext executionContext)
{   
    ...

In that function, "name" contains (for the above call) "Tokyo".

Known workarounds

None that I know of, except for stripping the quotes out of any strings passed to activity functions.

App Details

Microsoft.Azure.Functions.Worker.Extensions.DurableTask 1.1.0
Azure Functions runtime version 4
Programming language used: C#

@Ilia-Kosenkov
Copy link

Can this be related to #2656 and an attempt to fix #2504?
In my case, after this PR was merged, I no longer experience activity input deserialization issues, but I do see now extra " added to just plain strings.

@betim-raqi
Copy link

#2677 same problem

@Tiktack
Copy link

Tiktack commented Nov 23, 2023

Facing same problem. Downgrade to 1.0.4 helped.

@nytian nytian added the P1 Priority 1 label Dec 6, 2023
@jviau
Copy link
Contributor

jviau commented Dec 6, 2023

Linking this here microsoft/durabletask-dotnet#245

@jviau
Copy link
Contributor

jviau commented Dec 8, 2023

@Ilia-Kosenkov that is the cause indeed. The dotnet worker special cases string and byte[], which causes this issue. I am looking into this to see what the best fix will be.

@MatLeger
Copy link

MatLeger commented Jan 4, 2024

I have the same problem. However, if I downgrade Microsoft.Azure.Functions.Worker.Extensions.DurableTask to 1.0.4 or if I upgrade to 1.2.0-rc.1 then my project won't build because the Microsoft.DurableTask.Entities namespace no longer exists.

error CS0234: The type or namespace name 'Entities' does not exist in the namespace 'Microsoft.DurableTask' (are you missing an assembly reference?)
error CS0246: The type or namespace name 'TaskEntityDispatcher' could not be found (are you missing a using directive or an assembly reference?)
error CS0246: The type or namespace name 'EntityTriggerAttribute' could not be found (are you missing a using directive or an assembly reference?)
error CS0246: The type or namespace name 'EntityTrigger' could not be found (are you missing a using directive or an assembly reference?)

@nilsmehlhorn
Copy link

Is there an ETA for the fix to be released? Not wanting to be rude, but the current release is basically broken for 2 months now. We'd really like to upgrade to resolve other issues.

@nilsmehlhorn
Copy link

@jviau would it be possible to get a new release of Microsoft.Azure.Functions.Worker.Extensions.DurableTask? Or am I missing something and this fix is already available otherwise for the isolated worker mode?

@prashantagrawalcrowe
Copy link

@nilsmehlhorn Fix is already released in Microsoft.Azure.Functions.Worker.Extensions.DurableTask 1.1.1

@jsabev
Copy link

jsabev commented Mar 6, 2024

@nilsmehlhorn @jviau We are experiencing the issue with quotes added to string parameters in activity functions in Java. Our existing orchestration broke out of the blue and digging around I found this issue.

In our case, it seems to be happening only when testing locally on windows (the orchestration works on a linux app service plan in azure).

Issue reported in durabletask-java/issues/193

@Diegobar
Copy link

Hi, the problem still exists in Microsoft.Azure.Functions.Worker.Extensions.DurableTask 1.1.1.
When using an Activity function's string parameter for argument in a binding, i.e.:

public async Task Run(
[ActivityTrigger] string xyz
[BlobInput("input-{xyz}", Connection = "MyStorage")] BlobContainerClient blobContainer)

Blob's path become "input-"abc""

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

Successfully merging a pull request may close this issue.