Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Three year old code suddenly broke for some servers, and not others

$
0
0

No changes to the code were made, but suddenly File.Exists(path) started returning true even though there was no file there. (and no spaces in the file name.)  It appears to be related to changes in network configuration.

This exception/catch fixes the result to false like it should be, but is too slow (and a poor practice.)

Any ideas? 

Thanks,

 string path = machineName + Order;
    result = File.Exists(path);

       if (result == true)
           {
              try
              {
                string temp = File.ReadAllText(path);
                }
            catch (Exception)
               {
                 result = false;

               }

           }




Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>