Comments (6)
In my opinion we should apply the same idea as for guards/preconditions where we want to fail at the spot without the need to await the call. But after a quick look on the internet I found this, where nobody mentioned the option to only throw the raw exception without wrapping it into a task. Currently I fixed this by throwing a raw exception but I will leave the issue open and do a deeper research about this.
from asyncgenerator.
The same problem could apply also for NotSupportedException
and other exceptions, so I think that we shall not wrap into a try/catch block when the first statement is a throw statement.
from asyncgenerator.
Agree. The NotImplementedException was just an example. I was to lazy to write about other exceptions:)
from asyncgenerator.
Shall it be just a throw or return Task.FromException(...)
?
from asyncgenerator.
From this it looks like
public async Task X2Async() {
throw new NotImplementedException();
}
Is really overcomplicated version of this:
public Task X3Async() {
return Task.FromException(new NotImplementedException());
}
from asyncgenerator.
As far as I concern the 87643c8 has fixed this issue.
from asyncgenerator.
Related Issues (20)
- Async locking HOT 1
- Seems to not work with VS 2017 15.9.15 HOT 2
- Wrong async generation after a null coalesce in 0.8.2.11 HOT 2
- Support C# 8 nullables HOT 3
- Plugins overrides user type/method conversions
- Improve CS0103 error scanning for private methods
- Use <inheritdoc /> for generating obsolete methods for a base/interface method
- Avoid calling obsolete async methods
- Copying already async methods for new types
- Invalid generated code for void async counterparts
- Indentation for generated local functions is not always preserved
- Fails opening project with "Could not load file or assembly NuGet.ProjectModel" HOT 3
- dotnet tool does not work HOT 6
- Does not work on .NET 6 HOT 12
- Use cases ? HOT 2
- 0.20.1 suddenly stopped working HOT 2
- Add support for out parameters
- TextReader.ReadLine and TextWriter.WriteLine seems to be ignored HOT 4
- Init properties crash AsyncGenerator HOT 1
- Add option to generate async-over-sync templates
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asyncgenerator.