Customization code often uses product DLLs, in which sometimes only asynchronous method calls are possible.
These calls have several problems:
1.) Scripts (DialogScript, but also all other VB.NET code snippets, cannot be defined as asynchronous methods.
2.) Async/wait is not supported by the designer/code editor/intellisense (compile works)
An enhancement request (#31157) has been created.
The asynchronous function can simply be waited for synchronously via .Result or .Wait(). However, care must be taken that a ConfigureAwait(false) is appended to each await, otherwise there will be deadlocks in the frontends.
So instead of:
Dim result = Await AsyncFunction()
must be written:
Dim result = Await AsyncFunction().ConfigureAwait(False)
The synchronous variant:
Dim result = AsyncFunction().Result
The product team will evaluate the request and this feature may become available in a future release of the product.