fsprojects / fsprojects/Paket

paket install breaks the build

Open
#2,960 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug msbuild proj sdk: dotnet/sdk
Dominant language
F#
Stars
2.1k
Forks
528
Avg merge
1d 12m
Merged PRs (30d)
54

Description

Description

after adding a new dotnet core fsproj to my project and running a paket install the build for all dotnet core projects fails. The error message I'm getting is:

error MSB4184: The expression ""System.String[]".GetValue(4)" cannot be evaluated. Index was outside the bounds of the array. [/Users/kdummann/source/rubecula/frontend/frontend/birdvoices.fsproj]

I see a single file change in the .paket/Paket.Restore.targets files which seems to cause it:

--- a/.paket/Paket.Restore.targets
+++ b/.paket/Paket.Restore.targets
@@ -114,9 +114,11 @@
       <PaketReferencesFileLinesInfo Include="@(PaketReferencesFileLines)" >
         <PackageName>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[0])</PackageName>
         <PackageVersion>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[1])</PackageVersion>
+        <AllPrivateAssets>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[4])</AllPrivateAssets>
       </PaketReferencesFileLinesInfo>
       <PackageReference Include="%(PaketReferencesFileLinesInfo.PackageName)">
         <Version>%(PaketReferencesFileLinesInfo.PackageVersion)</Version>
+        <PrivateAssets Condition="%(PaketReferencesFileLinesInfo.AllPrivateAssets) == 'true'">All</PrivateAssets>
       </PackageReference>
     </ItemGroup>

Reverting this changes make the build work again for all existing projects.

Paket version 5.128.6
DotNet SDK Version: 2.0.0 (I know it is outdated but I can't update at the moment because there a problems with other packages when I do that.)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect the generated .paket/Paket.Restore.targets file and reproduce the failure with Paket 5.128.6 and .NET SDK 2.0.0 after adding a dotnet core fsproj. Compare the generated PaketReferencesFileLines handling with the reported change, then verify that all existing dotnet core projects build without the MSBuild array-bounds error.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.