Code Monkey home page Code Monkey logo

Comments (5)

jhudsoncedaron avatar jhudsoncedaron commented on June 14, 2024

Please note the XML comments as viewed by Visual Studio also need to be updated.

from dotnet-api-docs.

JeremyKuhne avatar JeremyKuhne commented on June 14, 2024

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.

mairaw avatar mairaw commented on June 14, 2024

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.

jhudsoncedaron avatar jhudsoncedaron commented on June 14, 2024

@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.

mairaw avatar mairaw commented on June 14, 2024

Thanks for the example @jhudsoncedaron. That helps.

from dotnet-api-docs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.