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

NuGet.exe swallows details of exception when parsing solution file #4411

Closed
alexangas opened this issue Jan 27, 2017 · 0 comments · Fixed by NuGet/NuGet.Client#1150
Closed

Comments

@alexangas
Copy link

Details about Problem

NuGet product used: NuGet.exe

NuGet version: current "dev" branch

dotnet.exe --version (if appropriate): N/A

VS version (if appropriate): N/A (VS14)

OS version (i.e. win10 v1607 (14393.321)): N/A (Windows 8.1)

Worked before? If so, with which NuGet version: No

Detailed repro steps so we can see the same problem

  1. Prepare .sln file that has an issue that will cause a parsing error

  2. Run nuget.exe restore xyz.sln

Expected results

Command line output containing details of parsing error:

Error parsing solution file at c:\Test\xyz.sln: Exception has been thrown by the target of an invocation. Error parsing the nested project section in solution file. A project with the GUID "{B24F8C45-D9B0-4EAC-9B5B-AFC11EC532A4}" is listed as being nested under project "{D2CBE02E-6AA7-4343-9A01-891F971A17F5}", but does not exist in the solution. c:\Test\xyz.sln

Actual results

Command line output with very little information:

Error parsing solution file at c:\Test\xyz.sln: Exception has been thrown by the target of an invocation.

...

Suggested solution

Change line 337 of MsBuildUtility.cs to include InnerException.Message. For example:

var message = string.Format(
	CultureInfo.CurrentCulture,
	LocalizedResourceManager.GetString("Error_SolutionFileParseError"),
	solutionFile,
	ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : ""));

Happy to provide a pull request.

Sample Project

If necessary, I can provide one via a secure channel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants