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
Wildcard expansion is silently disabled when a glob expansion encounters an I/O exception #406
Comments
There are a couple of questions here.
For 2, I think the answer is "no". Being able to do pattern-based set exclusions seems like an awful lot of work for fairly minimal gain. |
Thanks for troubleshooting this! You're right about my expectations. At minimum MSBuild should report a meaningful error here, but yes, I do expect that excluding the directory will avoid any problems with it. "Precomputing the impact of the exclude list" is an implementation detail. From the user point of view, the ItemList is "everything in MyDir, except node_modules" - same as manually listing every other sub-directory in the include list (which works). Yes, it is a problem with NPM that it builds a directory structure that exceeds MAX_PATH, but I have no control over that. All I can do is exclude the directory. |
Thinking about it a bit more, it may not be that difficult to consider the If it's not easy, I think fixing the long-path behavior would be sufficient to avoid this problem--it's inefficient to add and then remove things from a list but would produce the desired behavior. |
@shift-evgeny This should already be available in VS "15" Preview 5. I'm not closing this issue because the bad doesn't-expand-wildcards behavior persists if you don't have an exclude. But at least the obvious workaround for |
The built-in
Resulting in the
https://github.com/dotnet/cli/issues/6561 If it's difficult to properly fix this, could you please at least update the |
…net/cli/issues/6561 and dotnet/msbuild#406), and run correct test command
* Upgrade to Visual Studio 2017 + csproj tooling * Include workaround for NuGet/Home#4337 (explicitly specify version when restoring NuGet packages) * Work around dotnet/cli-migrate#11 * Upgrade to .NET Core 1.1.x * Remove VersionPrefix from all csproj files * Legacy NuGet restore is no longer needed * Disable CS1701 warning for sample projects * Turns out we actually do need the legacy NuGet restore * Use VS2017 AppVeyor image * Remove project dependencies to work around NuGet/Home#5193 and NuGet/Home#4578 * Use MSBuild 15 on AppVeyor * Enforce .NET Core tools 1.0.0 in global.json * Use newer npm on AppVeyor (as a workaround for https://github.com/dotnet/cli/issues/6561 and dotnet/msbuild#406), and run correct test command
Just started getting this error from Travis CI here. My path doesn't even seem that long.
I guess my solution is to somehow tell Travis CI to put my code in folder at a lower level? |
One cause for that error in web apps is node_modules. Older versions of npm
had very deep directory structures. If you're using npm, you should ensure
that it's the latest version rather than an older version like npm2. You
can run "npm install --global npm" to upgrade it.
Sent from my phone.
On Jul 2, 2017 9:43 AM, "Muhammad Rehan Saeed" <notifications@github.com> wrote:
Just started getting this error from Travis CI here
<https://travis-ci.org/RehanSaeed/Schema.NET/jobs/249300823>. My path
doesn't even seem that long.
/usr/share/dotnet/sdk/1.0.1/Microsoft.Common.CurrentVersion.targets(2865,5):
error MSB3552: Resource file "**/*.resx" cannot be found.
[/home/travis/build/RehanSaeed/Schema.NET/Source/
Schema.NET/Schema.NET.csproj]
I guess my solution is to somehow tell Travis CI to put my code in folder
at a lower level.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#406 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAFnHRWNLx_ydPYoDzxayCOS0jDk8oyIks5sJ8i2gaJpZM4G221q>
.
|
Not using npm, just a simple class library. |
Try running |
@Daniel15 Thanks for the suggestion. Just tried that and this is what I found: The longest path from the project causing the build error is 110 characters:
The longest path from another project in the solution is 118 characters:
These paths are well short of the 260 character max path, unless I'm missing something about Linux or MacOS where I'm running the |
i am totally blocked by this. I am also on osx and having the same results as @RehanSaeed |
@RehanSaeed for what its worth, it seems like some issue with the hidden keys folder thats generated when launching debug session. to solve this: i created a keys folder (not hidden), and then within that a file with the same filename as the one that had been generated in the hidden .keys folder. i left the file empty. now every time i build / launch it works fine... |
VM Ubuntu 17.04 dotnet build throws same issue. basically i cannot deploy to production. i don't see any '.keys' folder. Thanks in advance. |
This fixes building within VS 2017 community. node_modules can sometimes contain paths that are very long, which can trigger an msbuild bug dotnet/msbuild#406
This fixes building within VS 2017 community. node_modules can sometimes contain paths that are very long, which can trigger an msbuild bug dotnet/msbuild#406
Having same issue on both osx and ubuntu. Getting the latest version of npm did not help. Moving the project to root in order to shorten the path also did not work. No keys file either. Won't build locally or as a docker build on osx or ubuntu, but builds fine in a windows environment both locally and as docker build. |
Can you try running |
@radical not sure if you were talking to me, but if I run it, it just returns a single file which is an NServiceBus log file. |
@dasjestyr I hit this issue too and have a workaround. The problem is that the wildcard expansion is skipped if there is any error while trying to expand the wildcard. And the |
@dasjestyr um btw, was it a file or a directory for you? My patch might need to be fixed to handle files too. But this is a hack anyway. |
…0331.1 (dotnet#406) - Microsoft.Dotnet.Toolset.Internal - 3.1.202-servicing.20181.1 Dependency coherency updates - Microsoft.DotNet.Cli.Runtime - 3.1.202-servicing.20181.3 (parent: Microsoft.Dotnet.Toolset.Internal) Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
If MSBuild can detect when an item group evaluation has reached MAX_PATH, at least log a normal or diagnostic log saying "ItemGroup evaluation for X reached MAX_PATH at C:\longpath... and will be discarded" so that the user sees this is happening to them. We ran into this issue internally due to a misbehaving program that generated a very long path which then causes MSBuild to suddenly stop building inexplicably because it couldn't expand a dirs.proj with an |
@rainersigwald Would you be opposed to adding diagnostic logs when this situation is detected? I can make the change and raise a PR if you don't have any objections and if it would not be a breaking change. |
@ghidalgo3 No, that sounds good. But I'm not sure the logging context is available at all the right places. Feel free to take a shot at it and put up a draft PR. A message wouldn't be a breaking change, but we'll have to balance chattiness/usefulness. For MAX_PATH it's likely always nice. For "couldn't expand and falling back to literal" in general, a lot of times that's intentional and we shouldn't always message. |
* Upgrade to Visual Studio 2017 + csproj tooling * Include workaround for NuGet/Home#4337 (explicitly specify version when restoring NuGet packages) * Work around dotnet/cli-migrate#11 * Upgrade to .NET Core 1.1.x * Remove VersionPrefix from all csproj files * Legacy NuGet restore is no longer needed * Disable CS1701 warning for sample projects * Turns out we actually do need the legacy NuGet restore * Use VS2017 AppVeyor image * Remove project dependencies to work around NuGet/Home#5193 and NuGet/Home#4578 * Use MSBuild 15 on AppVeyor * Enforce .NET Core tools 1.0.0 in global.json * Use newer npm on AppVeyor (as a workaround for https://github.com/dotnet/cli/issues/6561 and dotnet/msbuild#406), and run correct test command
This fixes building within VS 2017 community. node_modules can sometimes contain paths that are very long, which can trigger an msbuild bug dotnet/msbuild#406
Let's reboot this issue given there is support beyond Win32 MAX PATH now in .NET cc @jaredpar |
Curious: this issue seems to predate us having pretty solid long path support in .NET. Now though it's a fairly established feature and supported by our build tools. Given the current state of our tech is there a reason why this still needs to be unsupported? Basically can wildcards now expand beyond |
@mjsabby what made you comment on this? Exceeding MAX_PATH in a glob should not hit this problem any more (in a context where long paths are supported, i.e. on modern OS with long paths enabled and anywhere outside of Visual Studio's |
Yes, in any case where the long-path support works, which is still not everywhere. This issue is still open because any other I/O exception still triggers the silent assume-they-meant-a-literal-string-with- |
cc @JeremyKuhne as both wildcards and max path are his thing. |
We have discussed in internally and would like to consider this approach: If exception is thrown during globing consider in "non-glob" only if that patterns does not fit "high-confident-glob-pattern" High confident glob patterns could consist of most common patterns which indicates intent was almost sure a glob. Examples:
So if ItemSpec will fits high-confident-glob-pattern and it will fail we can log error leading customer to self-solving it. |
This was reported as a Connect issue.
The repro is simple:
Where there are files in
MyDir\node_modules
that exceedMAX_PATH
. That returns:Note that the wildcards weren't actually expanded.
The original issue mentions an expectation that the
Exclude
element would prevent this from happening because that directory and all its contents are excluded. The reason that doesn't work is because we build theInclude
list fully first, then build theExclude
list, then do a subtraction. The failure occurs when building theInclude
list, soExclude
has no effect.The text was updated successfully, but these errors were encountered: