fsprojects / Paket

A dependency manager for .NET with support for NuGet packages and Git repositories.
https://fsprojects.github.io/Paket/
MIT License
2.02k stars 523 forks source link

Load script generated causes stack overflow exception #3502

Open halcwb opened 5 years ago

halcwb commented 5 years ago

Description

When I load a references script generated by paket, I get an stack overflow exception

Repro steps

Please provide the steps required to reproduce the problem

  1. Make a new project using the Saturn template

  2. Install references and run the generate-load-scripts --framework net462 command

Try to load the Saturn.fsx script file in the .paket/load/net462 folder. This causes a Stack overflow error, probably due to a recursive load sequence.

smoothdeveloper commented 5 years ago

I can see it reproducing, there may be ways to mitigate the problem in the generated scripts somehow, but it should probably be reported (with a minimal case) & tracked in the visualfsharp repository.

A first approach at narrowing the issue down would be to comment as many lines of that Saturn.fsx till the last configuration which makes it crash.

matthid commented 5 years ago

probably due to a recursive load sequence.

Afaik NuGet and "normally built" assemblies can not have recursive references, so if this happens it is a paket bug, correct?

smoothdeveloper commented 5 years ago

@matthid I suspect more things like load scripts a & b both loading c, doing that several levels.

matthid commented 5 years ago

If we load the same stuff multiple times that would be a bug in our implementation as well wouldn't it? But I can see how that can happen with our script per package/group logic, thanks.

smoothdeveloper commented 5 years ago

it seems the load scripts which use absolute paths are causing the issue, if I generate scripts without the groups, the .fsx look different and I'm able to load.

the minimum set of load files to get the crash:

test.fsx

#load ".paket/load/net462/Server/Giraffe.fsx" 
#load ".paket/load/net462/Server/Microsoft.AspNetCore.fsx" 

paket.dependencies

group Server
    storage: none
    source https://api.nuget.org/v3/index.json

    nuget FSharp.Core
    nuget Saturn
    nuget Fable.Remoting.Giraffe

if you put the same dependencies without nesting in a group, regenerate, adjust the load script path to remove Server, loading them does work.