NuGet/Home
GitHub で見るinvalid paths in configuration files should report actionable error message
Open
#9,766 opened on 2020年7月8日
Area:SettingsFunctionality:RestoreIcebox cleanup candidatePriority:3Status:InactiveType:Bughelp wanted
Repository metrics
- Stars
- (1,459 stars)
- PR merge metrics
- (平均マージ 464d 23h) (30d で 1 merged PR)
説明
edit: There are multiple possible issues that could be created after investigating this issue, but I think they're low impact, so possibly not worth tracking separately:
- better error messages when unable to load file
- however, I believe the path being walked is
..\, so it's hard to give a good, actionable error message from NuGet.Configuration
- however, I believe the path being walked is
- msbuild restore uses the
SolutionDirproperty, only needed for packages.config projects, even whenRestorePackagesConfig=trueis not used. - msbuild restore of packages.config projects can't handle
SolutionDirbeing a relative path, which is what NuGet itself added to the project file when using the "Enable NuGet Package Restore" command, only available in VS2010 to VS2012.
When the customer runs restore, they are simply getting the error:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.targets(536,5): error : The path is not of a legal form. [<path_to_proj>\MyApp.API.csproj]
After getting a binlog, I can see the stack trace:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.targets(536,5): System.ArgumentException: The path is not of a legal form.
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.InternalGetDirectoryName(String path)
at NuGet.Configuration.Settings.<GetSettingsFilePaths>d__44.MoveNext()
at NuGet.Configuration.Settings.<GetSettingsFilesFullPath>d__42.MoveNext()
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
at NuGet.Configuration.Settings.LoadSettings(String root, String configFileName, IMachineWideSettings machineWideSettings, Boolean loadUserWideSettings, Boolean useTestingGlobalPath, SettingsLoadingContext settingsLoadingContext)
at NuGet.Build.Tasks.RestoreSettingsUtils.ReadSettings(String solutionDirectory, String restoreDirectory, String restoreConfigFile, Lazy`1 machineWideSettings, SettingsLoadingContext settingsLoadContext)
at NuGet.Build.Tasks.GetRestoreSettingsTask.Execute()
We need to give better, actionable error messages to customers.