-
Notifications
You must be signed in to change notification settings - Fork 507
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
Windows' path limits can be exceeded #20053
Comments
BTW, don't forget to update code like |
If we could get a test project we can reproduce this with from the command line, we can easily create a unit test to verify that it actually works (and doesn't regress, which is even more important). Would that be something you have or could create? I can handle the actual code fixing afterwards. |
Hi @jstedfast. We have added the "need-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
I have not had time to verify that the attached project reproduces the issue, but it's the project I had been using to repro the VS-side of things and it is the project I asked CSI to use when testing and they are ones hitting this issue (I could have sworn this worked once I made the VS-side fixes, but apparent not if CSI is using this test project). XamariniOSAppWithLongFilePaths.zip If this doesn't repro, then I don't have a good test case handy. |
Oh, actually, if the above project doesn't repro, you might be able to get it to repro by making the default Archive path something longer. I think CSI mentioned they had done that (as that was the original way that they had been reproing this kind of issue). |
@jstedfast do you have a binlog that shows the failure? I'm having a hard time reproducing this, because my devbox is happy to create long paths even if long path support is disabled in the registry :/ |
@rolfbjarne I'll ask for CSI to provide one. When I fixed this in VS, I'm pretty sure it Just Worked(tm) for me after that - so I was surprised when CSI came back to me with this issue. |
Hi @jstedfast. We have added the "need-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
Hi @jstedfast. Due to inactivity, we will be closing this issue. Please feel free to re-open this issue if the issue persists. For enhanced visibility, if over 7 days have passed, please open a new issue and link this issue there. Thank you. |
Reopening, info was provided in the devops issue. |
… helpful information. Fixes xamarin#20053. Ref: https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1935561 Fixes xamarin#20053.
Background
Windows has a file path limit of 260 characters and a directory path limit of 248 characters even though, technically, Windows can handle much longer path lengths than that.
The work-around is to prefix paths that would normally exceed this limitation with a magical string (
@"\\?\"
).For example, the following code will throw an exception:
However, if you prefix the path string with
@"\\?\"
, things will work as expected.e.g.:
(or if you were using a
string
variable:path = @"\\?\" + path;
)The bug in the VIsual Studio-side of things can be found here: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1935561
Steps to Reproduce
wwwroot\_content\BlazorMaterialWeb.Bundled\roboto\fonts\roboto-v30-cyrillic_cyrillic-ext_greek_greek-ext_latin_latin-ext_vietnamese-100.woff2
Expected Behavior
No errors caused by file or directory paths exceeding the Windows MAX_PATH length.
Actual Behavior
Two example exceptions that can happen:
and
Environment
Windows 11 Enterprise 22H2
Build Logs
Example Project (If Possible)
FileSystem.cs
I started working on a solution you guys could use based on work I did in Visual Studio, but it's started becoming more work than I had hoped and I wasn't sure (without spending more time than I'd like) to figure out which Tasks, at minimum, would need to be updated to use my FileSystem.cs file that I've attached to get you guys started on this.
I'm not sure if you'll want to just make all File/Directory calls go through my FileSystem layer or if you'll want to just do it for the code that can run on the Windows side.
The text was updated successfully, but these errors were encountered: