Runtime: Directory.EnumerateFiles returns paths with extra path separators

Created on 27 Apr 2018  路  12Comments  路  Source: dotnet/runtime

This was working in 2.0 and once we upgraded to 2.1 preview 2 tests started to fail.

I'm passing "C:\\Code\\Exceptionless\\src\\Exceptionless.Web\\storage\\" to EnumerateFiles and it's returning a path that contains two separators. Which is breaking behavior when I replace the path with the original folder to get the relative path (and getting a root path).

C:\Code\Exceptionless\src\Exceptionless.Web\storage\\archive\18\04\27\11\30\1ecd0826e447ad1e78877ab2\81576cb17e464b9f85cfb0fcfb890409.json

image

area-System.IO bug tenet-compatibility

Most helpful comment

We are very excited so far and are seeing good numbers across the board.

Great to hear. If you wouldn't mind sharing when you have more info, it'd be helpful to see the impact :)

All 12 comments

@karelz @JeremyKuhne this may be related to https://github.com/dotnet/corefx/issues/29368

@JeremyKuhne @pjanotti I put it into 2.1 until proven otherwise ...
@niemyjski which issue did you want to reference? You linked this one (self-reference).

Doh, this one https://github.com/dotnet/corefx/issues/27779 (last comment)

@niemyjski Can you link or include the existing code? What is the searchPattern?

Here is the link to the existing code: https://github.com/FoundatioFx/Foundatio/blob/master/src/Foundatio/Storage/FolderFileStorage.cs#L230 The search pattern was * as it cannot be null.

Ok, I see what happened here. Looking into how to fix it.

@niemyjski Thanks for opening this! I have a PR for a fix up. You can work around the issue by trimming the trailing separator on path before passing to EnumerateFiles.

Reopening to track 2.1 port

Change is in master and was put in release/2.1 for 2.1 RTM here: https://github.com/dotnet/corefx/commit/77732da1052923259a7668540ee62bf48d35956e (PR dotnet/corefx#29440)

Thanks again @niemyjski -- we would welcome any other feedback you have on filesystem enumeration code, given the extensive rework it received for 2.1.

@danmosemsft We just upgraded exceptionless to 2.1-rc and will be testing it and doing benchmarks. I'll let you know how it goes! We are very excited so far and are seeing good numbers across the board.

We are very excited so far and are seeing good numbers across the board.

Great to hear. If you wouldn't mind sharing when you have more info, it'd be helpful to see the impact :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sahithreddyk picture sahithreddyk  路  3Comments

bencz picture bencz  路  3Comments

EgorBo picture EgorBo  路  3Comments

Timovzl picture Timovzl  路  3Comments

aggieben picture aggieben  路  3Comments