Comments (5)
Please note the XML comments as viewed by Visual Studio also need to be updated.
from dotnet-api-docs.
The key thing is that the API returns false if the file doesn't exist or if it is unable to determine the file's status (which can be a number of reasons).
A common mistake should be called out, and that is making assumptions based on the results of this or any other I/O API is dangerous. I/O is transient, and as such you always need to catch errors when attempting to access or modify files (reading/writing/copying/etc.). For example: If File.Exists()
returns true it was true at one point during the call to File.Exists()
. It may no longer be true even by the time the API returns. Some other process may have moved or deleted the file, remote or removable media may become disconnected or unreachable. Even if the risk of the file being deleted/disconnected is low, permissions can fail for a variety of reasons, including interaction with things such as antivirus programs and indexers.
from dotnet-api-docs.
Thanks @jhudsoncedaron and @JeremyKuhne. The way I see this, we need to update the API docs to change the description/remarks and some of the IO conceptual articles to explain the transient nature of I/O operations. The IntelliSense gets updated with the content fixes we make here on a certain cadence.
from dotnet-api-docs.
@mairaw The way I ended up caring about this was a transient network failure causing a spurious false
from File.Exists()
causing huge problems in production and to me that's what needs documenting the most.
from dotnet-api-docs.
Thanks for the example @jhudsoncedaron. That helps.
from dotnet-api-docs.
Related Issues (20)
- Documentation on tooltip timings doesn't specify the unit HOT 2
- Assigning things into Data throws if the key or value isn't Serializable. this should be documented. HOT 1
- Inaccurate/incomplete documentation of some Convert.ToString functions HOT 1
- Same example HOT 3
- IConfigurationBuilder.Add(IConfigurationSource) HOT 2
- System.IO.Directory.GetFiles(string, string, EnumerationOptions) - parameter description incorrect HOT 2
- The IEqualityComparer<T> does not used in List<T>.Sort HOT 1
- JsonNode.DeepEquals仅在.net8及以上支持,但文档中显示所有版本均支持 HOT 1
- Document Tracing/Activity sampling HOT 5
- Replace use of String.Copy in code examples
- أوتاز HOT 1
- BitMap.GetPixel Documentation HOT 2
- StructLayoutAttribute.Pack Field should give an example of nested packing HOT 3
- Update API ref for .NET 9 Preview 6 HOT 1
- Update API ref for .NET 9 Preview 7 HOT 1
- Update API ref for .NET 9 RC 1 HOT 1
- Update API ref for .NET 9 RC 2 HOT 1
- Update API ref for .NET 9 GA HOT 1
- An example !!!!!!!!!!!!!!!!!!!!!!!!!!!! HOT 2
- Add security-related documentation to AssemblyBuilder and PersistedAssemblyBuilder
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 dotnet-api-docs.