Skip to content

Paket pack fails when project container Compile Update entries #3752

Closed

Description

@thinkbeforecoding

Description

In C# NetSdk projects, all *.cs files are included by default, but it is possible to change files properties by using the Update attribute instead of Include. When present in a csproj file, paket pack with symbols fails when trying to package source

Repro steps

  1. Create a NetSdk project

  2. Add a property to a cs file:

<Compile Update="Progam.cs">
      <DependentUpon>OtherFile.cs</DependentUpon>
  </Compile>

  1. paket pack --symbols ./nugets/

Expected behavior

It should generate the nuget package

Actual behavior

It fails with a NullReferenceException:

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at <StartupCode$Paket-Core>[email protected](Tuple`2 tupledArg)
   at Microsoft.FSharp.Collections.Internal.IEnumerator.map@74.DoMoveNext(b& curr)
   at Microsoft.FSharp.Collections.Internal.IEnumerator.MapEnumerator`1.System-Collections-IEnumerator-MoveNext()
   at Microsoft.FSharp.Collections.Internal.IEnumerator.map@74.DoMoveNext(b& curr)
   at Microsoft.FSharp.Collections.Internal.IEnumerator.MapEnumerator`1.System-Collections-IEnumerator-MoveNext()
   at Microsoft.FSharp.Core.CompilerServices.RuntimeHelpers.takeOuter@274[T,TResult](ConcatEnumerator`2 x, Unit unitVar0)
   at Microsoft.FSharp.Collections.Internal.IEnumerator.map@74.DoMoveNext(b& curr)
   at Microsoft.FSharp.Collections.Internal.IEnumerator.MapEnumerator`1.System-Collections-IEnumerator-MoveNext()
   at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable`1 source)
   at Paket.PackageProcess.convertToSymbols(ProjectFile projectFile, Boolean includeReferencedProjects, PackProcessCache cache, TemplateFile templateFile) in D:\code\Paket\src\Paket.Core\Packaging\PackageProcess.fs:line 106
   at [email protected](IEnumerable`1& next) in D:\code\Paket\src\Paket.Core\Packaging\PackageProcess.fs:line 190
   at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl()
   at [email protected](IEnumerable`1& next) in D:\code\Paket\src\Paket.Core\Packaging\PackageProcess.fs:line 213
   at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl()
   at Microsoft.FSharp.Core.CompilerServices.RuntimeHelpers.takeInner@267[T,TResult](ConcatEnumerator`2 x, Unit unitVar0)
   at Microsoft.FSharp.Collections.Internal.IEnumerator.map@74.DoMoveNext(b& curr)
   at Microsoft.FSharp.Collections.Internal.IEnumerator.MapEnumerator`1.System-Collections-IEnumerator-MoveNext()
   at Microsoft.FSharp.Collections.Generator.Microsoft-FSharp-Collections-Generator-Generator-1-get_Apply@412-1.Invoke(Unit unitVar0)
   at Microsoft.FSharp.Collections.Generator.appG[a](Generator`1 g)
   at Microsoft.FSharp.Collections.Generator.EnumeratorWrappingLazyGenerator`1.System-Collections-IEnumerator-MoveNext()
   at Microsoft.FSharp.Collections.SeqModule.ToList[T](IEnumerable`1 source)
   at Paket.PackageProcess.Pack[a](String workingDir, DependenciesFile dependenciesFile, String packageOutputPath, FSharpOption`1 buildConfig, FSharpOption`1 buildPlatform, FSharpOption`1 version, IEnumerable`1 specificVersions, FSharpOption`1 releaseNotes, FSharpOption`1 templateFile, FSharpOption`1 excludedTemplates, Boolean lockDependencies, Boolean minimumFromLockFile, Boolean pinProjectReferences, FSharpOption`1 interprojectReferencesConstraint, Boolean symbols, Boolean includeReferencedProjects, FSharpOption`1 projectUrl) in D:\code\Paket\src\Paket.Core\Packaging\PackageProcess.fs:line 208
   at Paket.Dependencies.Pack[b](String outputPath, FSharpOption`1 buildConfig, FSharpOption`1 buildPlatform, FSharpOption`1 version, FSharpOption`1 specificVersions, FSharpOption`1 releaseNotes, FSharpOption`1 templateFile, FSharpOption`1 workingDir, FSharpOption`1 excludedTemplates, FSharpOption`1 lockDependencies, FSharpOption`1 minimumFromLockFile, FSharpOption`1 pinProjectReferences, FSharpOption`1 interprojectReferencesConstraint, FSharpOption`1 symbols, FSharpOption`1 includeReferencedProjects, FSharpOption`1 projectUrl) in D:\code\Paket\src\Paket.Core\PublicAPI.fs:line 743
   at [email protected](ParseResults`1 results) in D:\code\Paket\src\Paket\Program.fs:line 853
   at Paket.Program.processWithValidationEx$cont@42[a](Boolean silent, FSharpFunc`2 commandF, a result, Unit unitVar) in D:\code\Paket\src\Paket\Program.fs:line 43         at Paket.Program.processWithValidationEx[a](FSharpFunc`2 printUsage, Boolean silent, FSharpFunc`2 validateF, FSharpFunc`2 commandF, a result) in D:\code\Paket\src\Paket\Program.fs:line 35
   at Paket.Program.handleCommand(Boolean silent, Command command) in D:\code\Paket\src\Paket\Program.fs:line 853
   at Paket.Program.main() in D:\code\Paket\src\Paket\Program.fs:line 934
   at <StartupCode$paket>.$Paket.Program.main@() in D:\code\Paket\src\Paket\Program.fs:line 945

Known workarounds

Avoid using the --symbols flag

Activity

  1. forki commented on Dec 10, 2019

    @forki
    Member

    could you please upload a zip which repros this? thx

  2. thinkbeforecoding commented on Dec 12, 2019

    @thinkbeforecoding
    ContributorAuthor

    fix-update.zip

    Run the build.cmd or build.sh 👍

  3. added a commit that references this issue on Dec 12, 2019
    41c06b5
  4. forki commented on Dec 12, 2019

    @forki
    Member

    thanks for reporting. it's fixed on 5.x and 6.x channels

  5. thinkbeforecoding commented on Dec 14, 2019

    @thinkbeforecoding
    ContributorAuthor

    Thank you for fixing !!!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions