Skip to content
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

Fatal crash if solution filter is built from within a path that contains an @ sign #11050

Open
siegfriedpammer opened this issue Nov 29, 2024 · 1 comment · May be fixed by #11421
Open

Fatal crash if solution filter is built from within a path that contains an @ sign #11050

siegfriedpammer opened this issue Nov 29, 2024 · 1 comment · May be fixed by #11421
Assignees
Labels

Comments

@siegfriedpammer
Copy link

siegfriedpammer commented Nov 29, 2024

Issue Description

I downloaded source code from some hosting site, which produces a zipfile "project@commithash.zip". Extracting and building that using "dotnet build/msbuild" works fine, if it's a solution, but not if it's a solution filter.

Steps to Reproduce

  1. download bugtest@commithash.zip
  2. extract to some location such that it still contains "@"
  3. cd to \bugtest@commithash\Solution
  4. run dotnet build Test.slnf

Expected Behavior

The project is built successfully.

Actual Behavior

D:\Projects\bugtest@commithash\Solution
❯ dotnet build Test.slnf
D:\Projects\bugtest@commithash\Solution\Test.slnf : error MSB4014:
  The build stopped unexpectedly because of an internal failure.
  System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\Projects\bugtest%40commithash\Solution\Solution.sln'.
     at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
     at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
     at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
     at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
     at System.IO.File.OpenRead(String path)
     at Microsoft.Build.Construction.SolutionFile.GetSolutionFileAndVisualStudioMajorVersions(String solutionFile, Int32& solutionVersion, Int32& visualStudioMajorVersion)
     at Microsoft.Build.Execution.ProjectInstance.LoadSolutionForBuild(String projectFile, PropertyDictionary`1 globalPropertiesInstances, String toolsVersion, BuildParameters buildParameters, ILoggingService loggingService, BuildEventContext projectBuildEventContext, B
  oolean isExplicitlyLoaded, IReadOnlyCollection`1 targetNames, ISdkResolverService sdkResolverService, Int32 submissionId)
     at Microsoft.Build.Execution.BuildManager.LoadSolutionIntoConfiguration(BuildRequestConfiguration config, BuildRequest request)
     at Microsoft.Build.Execution.BuildManager.HandleNewRequest(Int32 node, BuildRequestBlocker blocker)
     at Microsoft.Build.Execution.BuildManager.<>c__DisplayClass99_0.<IssueBuildRequestForBuildSubmission>g__IssueBuildSubmissionToSchedulerImpl|1(BuildSubmission submission, Boolean allowMainThreadBuild)

Build failed with 1 error(s) in 0,0s

Analysis

Notice %40 (which is @) in the path mentioned in the error message. It seems that when resolving the path to the solution file from the slnf JSON file, a URL is constructed at some point and is not properly unescaped when converting it back to a filesystem path.

Versions & Configurations

❯ dotnet build --version
17.12.0.47303

❯ dotnet --info
.NET SDK:
Version: 9.0.100-rc.2.24474.11
Commit: 315e1305db
Workload version: 9.0.100-manifests.4872d5d5
MSBuild version: 17.12.0-preview-24473-03+fea15fbd1

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.100-rc.2.24474.11\

@surayya-MS surayya-MS self-assigned this Dec 4, 2024
@surayya-MS
Copy link
Member

surayya-MS commented Feb 11, 2025

I checked, this is NOT a regression caused by recent slnx support work. This existed before.

I tried it out on main branch and didn't get unexpected internal failure. I got:

{my-path-to}/bugtest%40commithash/Solution/Solution.sln : Solution file error MSB5026: The solution filter file at "{my-path-to}/bugtest@commithash/Solution/Test.slnf" specifies there will be a solution file at "{my-path-to}/bugtest%40commithash/Solution/Solution.sln", but that file does not exist.

The '@' problem still remains

@surayya-MS surayya-MS linked a pull request Feb 11, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants