I have some weird problem when I'm adding the following line into my WPF App.

private void button1_Click(object sender, RoutedEventArgs e)
{

    foreach(string files in Directory.GetFiles(path,".",SearchOption.TopDirectoryOnly))
      tb_FileBrowse.Text = files;

}

The thing is that in FrameWork 3.5 the above method does nothing, not even an error, but if I change it to FrameWork 4.5 it Works!. Also if I'm using Framework 3.5 and change it into ConsolApp like this

foreach (string files in Directory.GetFiles(path, ".", SearchOption.TopDirectoryOnly))
{
   Console.WriteLine("{0}",files);
}

The code give some results.

Does anyone have the same problem?

Edit
Report