-4

I was searching for a test project I had coded a few months ago, and could not remember in which solution I had placed it. I decided to write some quick code to get all my Visual Studio 2010 projects' c-sharp source files, and look through them for a literal I know should exist in the file.

I started in debug mode, and when my code executed this statement, I got a blue screen of death:

            string[] results = System.IO.Directory.GetFiles(@"C:\Users\<user name>\Documents\Visual Studio 2010\Projects\", "*.cs", SearchOption.AllDirectories);

After a reboot, I checked the event logs, and I only saw the generic unexpected shut-down messages. I brought up the temp project, ran in debug mode again, and got the BSOD again. If I remove the SearchOption.AllDirectories param, the code doesn't break, but it doesn't get me the results I want either. But when I put it back, BSOD again.

Does anyone have any insight as to what could be causing this, or where I might be able to look (logs, etc) to see what the issue is? I did not see a kernel dump in the Windows directory, and the event log doesn't show anything that would stand out to me. FYI, I can run the same search from Windows Explorer with no errors and all the files returned.

* Update * I ran the same snippet of code but changed the file mask to *.txt, and it runs with no issue, so the .cs extension is playing into the error for some reason. Could it be having an issue listing the .cs file that I am running in debug?

dejfatman
  • 21
  • 2
  • 1
    just use built-in windows search, would save you time – athabaska Nov 13 '14 at 14:57
  • 6
    Perhaps a hardware error in the disk or the disk controller which only manifests when certain parts of the disk are accessed? – Matthew Watson Nov 13 '14 at 14:57
  • You state you have ran the search successfully already in windows explorer... doesn't this solve the purpose you created this project for? – Sayse Nov 13 '14 at 14:59
  • Blue screens from managed code were discussed here http://stackoverflow.com/q/277959/397817 and the consensus was that only kernel level failures can cause it. I concur with Matthew that it's more likely a system/disk failure than a problem with your code. – Stephen Kennedy Nov 13 '14 at 15:00
  • athabaska, I could do that, but I actually wanted to search for various terms, etc. It seemed easier at the time to just write some quick and dirty code in a test project I already had up at the time. After the error occurred, I'm curious as to what would cause it. – dejfatman Nov 13 '14 at 15:28

1 Answers1

-2

I guess there is a disk hardware error in one of your projects. Try enumerating all files there recursively and log it to see which one causes BSOD.

IS4
  • 11,945
  • 2
  • 47
  • 86
  • This is just plagiarism of Matthew Watson's comment. – Sayse Nov 13 '14 at 15:00
  • @Sayse But he didn't provide a possible solution. – IS4 Nov 13 '14 at 15:03
  • I would argue you haven't either since your "possible solution" is purely guesswork which would indicate that more information would be required from the OP to give a valid answer. – Sayse Nov 13 '14 at 15:06
  • @Sayse But then one could argue there is no better solution, as disk problems fall out of this site's purpose. – IS4 Nov 13 '14 at 15:09