-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Support long module path #33505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support long module path #33505
Conversation
Why not? I believe that our general strategy is to strip and append this prefix around the Win32 API calls, so that the rest of the code does not need to deal with it. cc @JeremyKuhne |
OK. I'm fine with that. |
|
This PR is now purely about using ArrayPool, and the PR/commit title and description are stale, correct? |
The existing implementation doesn't support paths longer than 1024 characters. |
|
Ok. Can you please add a test for this? |
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Win32.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Win32.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Win32.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Win32.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Win32.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the purpose of toReturn - can't you do:
ArrayPool<char>.Shared.Return(chars);
minimumLength = Math.Min(minimumLength * 2, short.MaxValue);
chars = ArrayPool<char>.Shared.Rent(minimumLength);There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danmosemsft This would call Return multiple timeswhenRent` throws an exception.
It would be fine to write it this way if the Return is not inside finally block (ie we let GC take care of collecting the buffer when exception is thrown).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yes - tricky. might be worth a comment.
|
@stephentoub I have no idea why the test failed. It passed on my machine. Could you please have a look? |
It appears you just pushed a new commit, so any old failures are no longer showing up. |
|
This is a failure I see from a previous commit: |
It reappeared. I added a |
eed369a to
c6e93bd
Compare
|
@danmosemsft This PR has stagnated for a while. Do you think we should try to get it merged for 5.0? |
|
@eiriktsarpalis I do not think it is worth rushing over the next few days without evidence of widespread impact. After that, I hope we can work to complete this PR one way or another, like any other community PR. |
|
Hi there, I need some suggestions to complete the test. I couldn't make the symbolic link work here. WDYT about copying an arbitrary system library to a temporary long path and loading it for testing? |
|
@adamsitnik @eiriktsarpalis Do you have any suggestions for the question about how to test this? |
I am OK with that. @NextTurn please let me know if you have time to work on this, if not we can finish what you have started. Thank you! |
|
It's succeeding on Windows x64, but on Windows x86 it gives me this: |
| // .stackreserve 0x00100000 | ||
| // .subsystem 0x0003 // WINDOWS_CUI | ||
| // .corflags 0x00000001 // ILONLY | ||
| byte[] assemblyImage = Convert.FromBase64String( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@steveharter @GrabYourPitchforks (as you are the owners of System.Reflection.Emit) I remember that Full .NET Framework offered a way to dynamically generate, save to disk, and load from disk a managed assembly. Is this still supported?
We need to test the long process module paths and our current best idea is to dynamically load such an assembly to the test runner process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dynamically generate, save to disk [...] Is this still supported?
No.
#15704
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stephentoub do you know if we have any existing test that we could just extend? Like something that validates that a .NET executable with path > MAX_PATH can just run for example?
I was thinking about creating a new standalone .exe with just a very long name and asserting the module inside. Something like the standalone coreclr regression tests: https://github.com/dotnet/runtime/tree/master/src/tests/Regressions/coreclr
My other idea is to... add a new project with a very long output dll name to the System.Diagnostics.sln, reference it from this tests project, and load it dynamically.
I am not sure if this would work if we run our test on machines where long path support is disabled on purpose. In such a case we would have to give it a short name, and after detecting that it's fine (conditional fact), rename the file and then load it. Any thoughts on that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most or all of our developers have long paths enabled (since it is/was documented as a requirement to build the repo) so I think if the test simply checks for it being enabled that makes sense to me and it would still run fairly often.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've sent a proposal #46685
we test the code path that rents a bigger array from ArrayPool
|
@nxtn / @adamsitnik -- I wasn't sure between the two of you who was going to try to carry this forward. @nxtn, are you blocked by the test failure? Thanks! |
Ping on this @nxtn. Please let us know if you'd like help moving this forward. Thanks! |
|
I'm going to close this PR as stalled. @nxtn thank you for your work, and feel free to reopen if you wish to pick this up. |
The "\?" prefix which indicates it's a long path should not be stripped.