Add async operation for ToHtml() method
See original GitHub issueNew Feature Proposal
Description
Add async
operation for Node.ToHtml(TextWriter writer, IMarkupFormatter formatter)
method.
Background
In AspNet Core 3.0, Synchronous IO is disallowed in default, AllowSynchronousIO disabled in all servers, this means if we call doc.ToHtml()
in AspNet will throw an error: Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead
.
AspNet code:
using (var writer = _writerFactory.CreateWriter(Response.Body, encoding){
doc.ToHtml(writer);
await writer.FlushAsync();
}
Specification
Wish to add new ToHtmlAsync()
method for asynchronous
IO operation or add new options for ToHtml()
allows asynchronous write operation.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
async function - JavaScript - MDN Web Docs - Mozilla
The async function declaration creates a binding of a new async function to a given name. The await keyword is permitted within the...
Read more >Updating HTML inside async function - javascript
I suspect that async function doesn't stop on time when Updated content is requested. That is why I'm trying window.onload, but still not ......
Read more >JavaScript Async
Let's go slowly and learn how to use it. Basic Syntax. async function myDisplay() { let myPromise = new Promise(function(resolve, reject) { resolve("I ......
Read more >Asynchronous programming: futures, async, await
When you call an asynchronous function, it returns an uncompleted future. That future is waiting for the function's asynchronous operation to finish or...
Read more >Using Asynchronous Methods in ASP.NET MVC 4
The async keyword represents a hint that you can use to mark methods as task-based asynchronous methods. The combination of await, async, and ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@zhengchun what’s the stack trace for the exception?
Writing to a MemoryStream should be fine, but flushing it out to the response body needs to be async.
Hi @Tratcher that’s certainly a good point. The average write here is about 4 to 16 characters dep. on the document. So we do not talk in ~1k (or more) chunks (which would benefit the specific IO). With small I refer to a single write unit in AngleSharp - which is way less than usual IO buffers used these days.