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

Nuspec <dependency/> without version gives null reference exception #273

Open
jbuedel opened this issue Jan 2, 2020 · 0 comments
Open

Comments

@jbuedel
Copy link

jbuedel commented Jan 2, 2020

We have a nuspec file that contains this:

<dependencies>
      <dependency id="dotnet4.7.1" />
      <dependency id="vfpoledb" version="1.0.0" />
      <dependency id="vcredist2017" />
    </dependencies>

The lack of version attributes seems to be causing a null ref exception.

~\Projects\AMS.Eclipse.Agent > dotnet migrate-2019 migrate
[11:06:17 INF] Reading package info from nuspec C:\Users\jbuedel\Projects\EclipsePro-Design\src\AMS.Eclipse.Agent\eclipse-agent.nuspec.
[11:06:17 ERR] Project C:\Users\jbuedel\Projects\EclipsePro-Design\src\AMS.Eclipse.Agent\AMS.Eclipse.Agent.csproj parsing has thrown an exception, skipping...
System.NullReferenceException: Object reference not set to an instance of an object.
   at void Project2015To2017.Transforms.NuGetPackageTransformation.ConstrainPackageReferences(IReadOnlyList<PackageReference> rawPackageReferences, PackageConfiguration packageConfig)+(XElement dependency) => { } in C:/projects/csprojtovs2017/Project2015To2017.Core/Transforms/NuGetPackageTransformation.cs:line 34
   at TResult[] System.Linq.Enumerable+SelectListIterator<TSource, TResult>.ToArray()
   at TSource[] System.Linq.Enumerable.ToArray<TSource>(IEnumerable<TSource> source)
   at void Project2015To2017.Transforms.NuGetPackageTransformation.ConstrainPackageReferences(IReadOnlyList<PackageReference> rawPackageReferences, PackageConfiguration packageConfig) in C:/projects/csprojtovs2017/Project2015To2017.Core/Transforms/NuGetPackageTransformation.cs:line 34
   at void Project2015To2017.Transforms.NuGetPackageTransformation.Transform(Project definition) in C:/projects/csprojtovs2017/Project2015To2017.Core/Transforms/NuGetPackageTransformation.cs:line 19
   at Project Project2015To2017.ProjectConverter.ProcessProjectFile(FileInfo file, Solution solution, ProjectReference reference) in C:/projects/csprojtovs2017/Project2015To2017.Core/ProjectConverter.cs:line 94
   at (IReadOnlyCollection<Project> projects, IReadOnlyCollection<Solution> solutions) Project2015To2017.MigrationFacility.ParseProjects(IEnumerable<string> items, ITransformationSet transformationSet, ConversionOptions conversionOptions)+ProcessSingleItem(FileInfo file, string extension) in C:/projects/csprojtovs2017/Project2015To2017/MigrationFacility.cs:line 160

While the specs [0] do say that a version attribute is required, this .nuspec is used to create a chocolatey package, and I guess chocolatey isn't so strict.

I get it if you don't care to support a non-standard file format. However it would be nice if the tool gave a better message as to the problem.

[0] https://docs.microsoft.com/en-us/nuget/reference/nuspec#dependencies-element

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

No branches or pull requests

1 participant