Comments (5)
That code sample is buggy and does not correctly follow the APM pattern. BeginXx methods may complete the operation synchronously, which is why the IAsyncResult.CompletedSynchronously property exists. The callback needs to check that property, and if it's true, exit immediately and instead allow the BeginXx call site to perform the continuation. Otherwise, a string of synchronously completing operations may stack dive. The docs should be fixed, but this isn't a bug in .NET Core nor is it configurable. .NET Core is simply faster and much more likely for operations to complete synchronously.
from referencesource.
Thanks, got it.
It is clear how it works now =)
Funny that this shoud work from .NET 4.5 but on practice I do not see that even at .NET 4.8 .
Only .net core sends CompletedSynchronously == true .
I found your comment here dotnet/runtime#29024 also
and it has the same story.
If anyone works in Microsoft or anyone knows anybody works in Microsoft
ask Microsoft to adjust this samples =) because it is wrong now.
About this case the some relevant answer it to look at
https://learn.microsoft.com/en-us/dotnet/api/system.iasyncresult.completedsynchronously?view=net-7.0
when it is possible to find
Notes to Callers
Use this property to determine if the asynchronous operation completed synchronously. For example, this property can return true for an asynchronous I/O operation if the I/O request was small.
Hope that somebody will find that via google also.
Thanks for your help again!
Best regards.
Nik
from referencesource.
If anyone works in Microsoft or anyone knows anybody works in Microsoft
ask Microsoft to adjust this samples =) because it is wrong now.
Most things are open now in .Net, so we don't have to rely on Microsoft employees. Namely:
- Anyone can open an issue, making sure the problem is properly tracked. I just did that at dotnet/dotnet-api-docs#8662.
- Anyone can open a Pull Request, fixing the documentation. If you want to do that, click the pencil icon on the documentation page, then click another pencil icon on the opened GitHub page.
from referencesource.
@thenik I wonder what is the reason you are using HttpWebRequest
and not HttpClient
?
from referencesource.
@antonfirsov it is an old legacy project ( https://mydataprovider.com web scraper ).
Started since Microsoft .NET Framework 2.0 .
I migrate it to .net 6. So it is hard to use HttpClient.
Additionally , in a real life I saw many times when
WebClient, HttpClient, HttpWebRequest do not work as expected,
all these classes can hang-up under the high load.
So we if you want a reliable software (webscraper) you have to managing all http requests itself.
from referencesource.
Related Issues (20)
- This repo is missing important files HOT 3
- EnsureCapacity should not have if (newCapacity < min) newCapacity = min; HOT 1
- Help building HOT 3
- Why `Substring` cannot make a reference to the original data instead of a copy? HOT 1
- Multipart/form-data upload from HttpClient blocked by Azure Application Gateway WAF rule 920140 REQUEST-920-PROTOCOL-ENFORCEMENT
- Missing Float HOT 1
- System.Data.DataRowExtensions.UnboxT`1.NullableField[TElem](Object value)
- https://sourceof.net/ incorrect X.509 certificate HOT 7
- Broken String.prototype.startsWith polyfill
- CompareAttribute won't work on records values HOT 1
- C# ADO.NET (System.Data.OleDb) Transaction Scope Auto Committed Before Calling Complete() HOT 1
- How to connect the database connection of SQLDependency using managed identity in Azure? HOT 1
- Missing .NET Framework 4.8.1 source code HOT 1
- XIRR
- Calculation of field Timeout of type TimeSpan in HttpClient doesn't match Timespan definition of MaxValue.
- Fhir Epic Sandbox : Creating a JWT in C# to Obtain an Access Token for a Backend Service
- Vulnerability Issue CVE-2024-0057 : [email protected]
- ServiceDependsOn throwing win32 error when switching to Turkish Language
- http://referencesource.microsoft.com/ lost source in the namespace `Microsoft.VisualBasic`
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 referencesource.