Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Async method without await #2

Open
abilson opened this issue May 5, 2017 · 1 comment
Open

Async method without await #2

abilson opened this issue May 5, 2017 · 1 comment

Comments

@abilson
Copy link
Contributor

abilson commented May 5, 2017

In CreateWorkspace.cs line 32 the method definition is marked async, however, there is no await call in the method body.

This would be a quick fix to add the await keyword, however, the async call on line 77 returns an object, ProcessOperationResult, which returns a compiler error when using the await keyword,

'ProcessOperationResult' does not contain a definition for 'GetAwaiter'

This may indicate a defect, not in this source code, but in the API call not being properly async:

proxy.Repositories.Workspace.CreateAsync(templateArtifactID, workspaceDTO);

@abilson
Copy link
Contributor Author

abilson commented May 8, 2017

After further investigation, I've discovered that the API call, although async in nature, is not architected in an async manner I'm familiar with. While the workspace does appear to be created in a separate thread, in order for our code to remain async we must subscribe to the proxy's event listeners. The definition of this method ought not to be async since we are blocking the execution to wait for the ProcessState to return Completed.

For more information about the documented use of the CreateAsync method, please see Creating Workspaces and Monitoring Asynchronous Processes

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

No branches or pull requests

1 participant