2

We are using the GetFiles approach from this question like this:

var pipePrefix = "Test_";
Directory.GetFiles("\\.\pipe\", pipePrefix + "*");

And we are looking for pipes like "Test_1", "Test_2", "Test_3". We know that this apporach has some issues but we couldn't find a explanation for our behaviour.

So far we tested it one three machines with Windows 10 and one with Windows 7. On Windows 10 everything works as expected (as far as we can tell). We find all the pipes every time. On the Windows 7 machine we have some issues:

With the code above we do not find any pipes at all. But if we search by

Directory.GetFiles("\\.\pipe\", "*");

we find all pipes but we then have one more step to select our pipes. And we tried some more queries:

Directory.GetFiles("\\.\pipe\", "*");           //We find our pipes
Directory.GetFiles("\\.\pipe\", "T" + "*");     //We find our pipes
Directory.GetFiles("\\.\pipe\", "Te" + "*");    //We don't find our pipes
Directory.GetFiles("\\.\pipe\", "Tes" + "*");   //We don't find our pipes
Directory.GetFiles("\\.\pipe\", "Test" + "*");  //We don't find our pipes
Directory.GetFiles("\\.\pipe\", "Test_" + "*"); //We don't find our pipes

We don't find any hidden characters and no exception is thrown.

So far we don't know if Windows 7 is the issue.

Update 07.11.19: We set up a new Windows 7 and new Windows 10 machine and tried multiple letters not only T. On Windows 7 we sometimes find the pipes with one letter e.g. T or U and sometimes with two e.g. Te or Ug. But we always find the pipes on Windows 10. We did not set up our software on these machines, we just searched for existing pipes with a console application. So from our perspective it looks like as if this an issue on Windows 7 and not in our application.

So my question is not how we can work around this issue. I am sure we could use a different pattern and filter afterwards or use a completely different approach which is not based on GetFiles/EnumerateFiles (best option I guess). My question is:

Why is the behaviour different based on the input and maybe also on the OS?

0lli.rocks
  • 1,027
  • 1
  • 18
  • 31
  • From Win7: can you add a list of pipes returned by Directory.GetFiles("\\.\pipe\", "T" + "*").? (all pipes beginning with T). – EylM Nov 05 '19 at 15:21
  • @EylM It's not about the letter, we tried multiple letters not only T is it's always the same. – 0lli.rocks Nov 07 '19 at 10:21

0 Answers0