Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Wednesday, 9 May 2018

The device is not ready. Error in Visual Studio - Solved

Hello developers, I am writing this article to give a solution to an error which came across to me recently. I am working on a Console Application where I am saving my files to a system. Everything is working perfectly fine. But suddenly the system starts throwing Error: The device is not ready. I googled and find nothing over this with respect to Visual Studio Console Application.

 I am sharing the file and code on which the error is occurring for future reference.

In Program.cs File

class Program
    static void Main(string[] args)
            //Determine whether the ImaginationHunt directory exist
            if (Directory.Exists(System.Configuration.ConfigurationManager.AppSettings["FilePath"]) == false)
                //Creating directory
                DirectoryInfo di = Directory.CreateDirectory(System.Configuration.ConfigurationManager.AppSettings["FilePath"]);
        catch (Exception ex)

In App.Config File

    <add key="FilePath" value="F:/ImaginationHunt Reports/" />

While googling, I noticed that the “Device is not ready” occurs when the Flash drive/HDD is not working. So, I go to the path that I have mentioned in App.Config file. And what I find out is the “F:/” drive is not available means the system is searching for the path is unavailable and hence could not able to find a part of the path which results in throwing the title error.

Solution: I change the path to an existing drive and also put a check on it.

Hope you find the article helpful & interesting.

For any query, comment us below.

Click imagination hunt to read latest blogs.

Keep learning and sharing...

No comments:

Post a comment

Featured post

Think that makes you rich and richer

 Napolean said: “You can think and grow rich, but if you can be brought up like most people with work and you won't starve, this wil...