question

jpgordon00 avatar image
jpgordon00 asked

Azure Functions Documentation Error

I am not sure where this post belongs, I apologize if it is found in the wrong section.

In the documentation for "Quickstart: Cloudscript using Azure Functions", you display sample C# code. The following code is in your documentation and checks for a specific function argument equaling null before setting another local variable:

if (args != null && args["inputValue"] != null)

The above code produces an "Failed" function result with the following message:

The key inputValue was not found in the Dictionary

Anytime you access an item in a Dictionary that doesn't exist the code produces an error. To check for an arguments existence, use the containsKey method.

For example, the corrected code would be:

if (args != null && !args.ContainsKey("inputValue"))
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Seth Du avatar image
Seth Du answered

Thanks for the feedback and I will reach the team to discuss it.

containsKey should be a better way to avoid errors. However, in my point of view, if you are referring PlayFab CloudScript Context, Variables and Server SDKs of Azure Function Quickstart, usually it is the next step of previous section Usingand Calling CloudScript using Azure Functions from your PlayFab Title. And, inputValue has been defined in the FunctionParameter and in the common scenario, it will work fine and simply illustrate the basic Azure Function usage.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.