Why can’t we use Await inside a Catch, Finally and Synclock in VB?

Asked

Viewed 66 times

4

Why can’t we use the operator Await within the statements Catch, Finally and Synclock in VB?

The C# 6.0 has support to use the Await within the Catch/Finally.

1 answer

3


I don’t know how to give you a definitive answer on that. I can say that it was because the language specified so. So C# had specified so in version 5. Later they realized that they could relax this restriction, but they did not do the same for VB.NET. They probably thought it didn’t pay off. But there might be something that VB.NET allows you to create a complicator by using this construct. I wouldn’t know how to inform.

To documentation says something about the method ending in a failed state and a await you can return to that point in failure, which should not be appropriate. But in C# the same may occur. What I can speculate is that they trusted that the C# programmer will understand this and know how to use it without causing any major problems. The synclock is still an exception.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.