Why can not we use the Await
operator within the statements Catch
, Finally
and Synclock
in VB?
The C # 6.0 has support for using Await
within Catch
/ Finally
.
Why can not we use the Await
operator within the statements Catch
, Finally
and Synclock
in VB?
The C # 6.0 has support for using Await
within Catch
/ Finally
.
I do not know how to give you a definitive answer on this. I can say that was because the language specified so. So C # coimo had specified so in version 5. Then they realized that they could relax this restriction, but they did not do the same for VB.Net. They probably thought it did not pay. But there may be something that VB.Net allows you to create a complicator if you use this build. I would not know how to report.
The documentation speaks some things about the method terminating in failed state and a await
will be able to return to that failed point, which should not be adequate. But in C # the same thing can happen. What I can speculate is that they trusted that the C # programmer will understand this and know how to use it without causing major problems. synclock
is an exception.