dotnet / dotnet/dotnet-api-docs

DirectoryInfo.GetFiles Method throws FileNotFoundException

Open
#3,819 0 comments 0 reactions 0 assignees View on GitHub
area-System.IO Pri3 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

In doc https://docs.microsoft.com/en-us/dotnet/api/system.io.directoryinfo.getfiles?view=netcore-3.1
there is no mention that when you run this method and there is no file in directory the FileNotFoundException is raised.

I run code from:
https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/file-system/how-to-get-information-about-files-folders-and-drives
but I tried to check empty usb pendrive. When i created any file everything starts to work fine.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.