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
<Compile Update="Progam.cs">
<DependentUpon>OtherFile.cs</DependentUpon>
</Compile>
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at <StartupCode$Paket-Core>.$ProjectFile.getCompileItem@2019.Invoke(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 Paket.PackageProcess.optWithSymbols@188-1.GenerateNext(IEnumerable`1& next) in D:\code\Paket\src\Paket.Core\Packaging\PackageProcess.fs:line 190
at Microsoft.FSharp.Core.CompilerServices.GeneratedSequenceBase`1.MoveNextImpl()
at Paket.PackageProcess.allTemplates@213-3.GenerateNext(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 Paket.Program.handleCommand@853-23.Invoke(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
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
Create a NetSdk project
Add a property to a cs file:
Expected behavior
It should generate the nuget package
Actual behavior
It fails with a NullReferenceException:
Known workarounds
Avoid using the --symbols flag