Azure-docs: The examples do not work for new function signature"public static async Task<IActionResult> Run(HttpRequest req, ILogger log)"

Created on 18 Jul 2019  Â·  6Comments  Â·  Source: MicrosoftDocs/azure-docs

This page is outdated and thus confusing for new Azure users (students!).
New function apps have async in their signature, e.g.

"public static async Task<IActionResult> Run(HttpRequest req, ILogger log)"

You can't have 'out' parameters in async methods. So the example code in the paragraph "Update the function code" does not show how to use the created output binding to Cosmos DB.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri2 azure-functionsvc cxp doc-enhancement triaged

Most helpful comment

Thanks for clearing up. However it took me some time to find the solution that uses the IAsyncCollector. For programmers starting with Azure, it would be nice if code examples in the official documentation match the latest standards / templates /....

@jovabel Just following up here... Hope my previous comment clears things up.

All 6 comments

@jovabel Thanks for the feedback! We will review and update accordingly.

@jovabel While the default template created now are async functions, the code present in the tutorial will work when replaced as the document instructs.

For async functions, you will have to use IAsyncCollector as described in the docs.

@jovabel Just following up here... Hope my previous comment clears things up.

@jovabel We will now proceed to close this thread. If there are further questions regarding this matter, please tag me in your reply. We will gladly continue the discussion and we will reopen the issue.

Thanks for clearing up. However it took me some time to find the solution that uses the IAsyncCollector. For programmers starting with Azure, it would be nice if code examples in the official documentation match the latest standards / templates /....

@jovabel Just following up here... Hope my previous comment clears things up.

I am looking for a working introduction or example for this but whole MS examples are not working. Also official azure functions output for cosmos db snippets are not running! It's really hard to understand why every documentation is wrong here!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

monteledwards picture monteledwards  Â·  3Comments

mrdfuse picture mrdfuse  Â·  3Comments

DeepPuddles picture DeepPuddles  Â·  3Comments

JamesDLD picture JamesDLD  Â·  3Comments

bdcoder2 picture bdcoder2  Â·  3Comments