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

ArgumentNullException when parsing project file #76

Closed
Jericho opened this issue Jun 2, 2018 · 5 comments
Closed

ArgumentNullException when parsing project file #76

Jericho opened this issue Jun 2, 2018 · 5 comments
Assignees
Milestone

Comments

@Jericho
Copy link
Member

Jericho commented Jun 2, 2018

I am trying to parse the content of this project file but I am getting an ArgumentNullException.

The exception is:

Value cannot be null.
Parameter name: path

The stack trace is:

   at Cake.Core.IO.Path..ctor(String path)
   at Cake.Incubator.XDocumentExtensions.<>c__DisplayClass9_0.<GetProjectReferences>b__0(XElement x)
   at System.Linq.Enumerable.SelectEnumerableIterator`2.ToArray()
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Cake.Incubator.XDocumentExtensions.GetProjectReferences(XDocument document, DirectoryPath rootPath)
   at Cake.Incubator.ProjectParserExtensions.ParseVS2017ProjectFile(XDocument document, IFile projectFile, String config, String platform)
   at Cake.Incubator.ProjectParserExtensions.ParseProjectFile(IFile projectFile, String configuration, String platform)
   at Cake.AddinDiscoverer.AddinDiscoverer.GetProjectReferencesAsync(AddinMetadata addin, String projectPath) in E:\_build\Cake.AddinDiscoverer\Source\Cake.AddinDiscoverer\AddinDiscoverer.cs:line 1308
   at Cake.AddinDiscoverer.AddinDiscoverer.<FindReferencesAsync>b__31_0(AddinMetadata addin) in E:\_build\Cake.AddinDiscoverer\Source\Cake.AddinDiscoverer\AddinDiscoverer.cs:line 684

I am currently investigating what could be causing this exception but I an opening this issue in case somebody can help me figure this out.

@Jericho
Copy link
Member Author

Jericho commented Jun 2, 2018

By process of elimination, I was able to figure out that the exception is caused by this section of the .csproj:

<ItemDefinitionGroup>
  <PackageReference>
    <PrivateAssets>all</PrivateAssets>
  </PackageReference>
  <ProjectReference>
    <PrivateAssets>all</PrivateAssets>
  </ProjectReference>
</ItemDefinitionGroup>

@Jericho
Copy link
Member Author

Jericho commented Jun 2, 2018

I have opened an issue with the Cake.XmlDocMarkdown project to fix their csproj file, but it would probably be a good idea to ensure the project parser in Cake.Incubator is capable of handling this content.

@wwwlicious
Copy link
Contributor

Seeing as the empty references are meaningless, I'm not going to handle this as the project files could just be updated to remove the empty tags

@Jericho
Copy link
Member Author

Jericho commented Aug 11, 2018

I was also under the impression these references were meaningless but turns out that’s not the case. If you look at the issue I previously linked, you’ll see an explanation from the Cake.XmlMarkdown author.

At the very least, I would think that a more descriptive error message would make it easier to identify this situation.

@wwwlicious
Copy link
Contributor

Ah, didn't know there was a catch all...another day, another piece of MSBuild trivia!

I'll try and cater for this global fallback in the next release. In the meantime the worksaround appears to be explicit for each reference.

@wwwlicious wwwlicious reopened this Aug 11, 2018
@wwwlicious wwwlicious added this to the 3.0.1 milestone Aug 11, 2018
@wwwlicious wwwlicious self-assigned this Dec 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants