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

Graph Build on FsToolkit.ErrorHandling reports projects with no Items. #109

Closed
baronfel opened this issue Apr 24, 2021 · 11 comments
Closed
Assignees
Labels

Comments

@baronfel
Copy link
Collaborator

baronfel commented Apr 24, 2021

Describe the bug

When opening FsToolkit.ErrorHandling at commit f09472a88a6f7032b1f6eaf7961454f91c992870 in Ionide 5.5.3 with "FSharp.enableMSBuildProjectGraph": true set, the projects cracked contain no items. The notifyWorkspace notifications from FSAC look like:

{
    "Kind": "project",
    "Data": {
        "Project": "/workspaces/FsToolkit.ErrorHandling/tools/FunctionMap/FunctionMap.fsproj",
        "Files": [],
        "Output": "/workspaces/FsToolkit.ErrorHandling/tools/FunctionMap/bin/Debug/net5.0/FunctionMap.dll",
        "ProjectReferences": [
            {
                "RelativePath": "../../src/FsToolkit.ErrorHandling/FsToolkit.ErrorHandling.fsproj",
                "ProjectFileName": "/workspaces/FsToolkit.ErrorHandling/src/FsToolkit.ErrorHandling/FsToolkit.ErrorHandling.fsproj"
            },
            {
                "RelativePath": "../../src/FsToolkit.ErrorHandling.TaskResult/FsToolkit.ErrorHandling.TaskResult.fsproj",
                "ProjectFileName": "/workspaces/FsToolkit.ErrorHandling/src/FsToolkit.ErrorHandling.TaskResult/FsToolkit.ErrorHandling.TaskResult.fsproj"
            },
            {
                "RelativePath": "../../src/FsToolkit.ErrorHandling.JobResult/FsToolkit.ErrorHandling.JobResult.fsproj",
                "ProjectFileName": "/workspaces/FsToolkit.ErrorHandling/src/FsToolkit.ErrorHandling.JobResult/FsToolkit.ErrorHandling.JobResult.fsproj"
            }
        ],
        "PackageReferences": [
            {
                "Name": "FSharp.Core",
                "Version": "5.0.0",
                "FullPath": "/root/.nuget/packages/fsharp.core/5.0.0/lib/netstandard2.0/FSharp.Core.dll"
            },
            {
                "Name": "Hopac",
                "Version": "0.3.23",
                "FullPath": "/root/.nuget/packages/hopac/0.3.23/lib/netstandard1.6/Hopac.Core.dll"
            },
            {
                "Name": "Hopac",
                "Version": "0.3.23",
                "FullPath": "/root/.nuget/packages/hopac/0.3.23/lib/netstandard1.6/Hopac.Platform.dll"
            },
            {
                "Name": "Hopac",
                "Version": "0.3.23",
                "FullPath": "/root/.nuget/packages/hopac/0.3.23/lib/netstandard1.6/Hopac.dll"
            },
            {
                "Name": "Ply",
                "Version": "0.3.1",
                "FullPath": "/root/.nuget/packages/ply/0.3.1/lib/netstandard2.0/Ply.dll"
            }
        ],
        "References": [],
        "OutputType": "exe",
        "Info": {
            "IsTestProject": false,
            "Configuration": "Debug",
            "IsPackable": false,
            "TargetFramework": "net5.0",
            "TargetFrameworkIdentifier": ".NETCoreApp",
            "TargetFrameworkVersion": "v5.0",
            "RestoreSuccess": true,
            "TargetFrameworks": [],
            "RunCmd": {
                "Command": "/workspaces/FsToolkit.ErrorHandling/tools/FunctionMap/bin/Debug/net5.0/FunctionMap",
                "Arguments": ""
            },
            "IsPublishable": true
        },
        "Items": [],
        "AdditionalInfo": {}
    }
}

for example.

Expected behaviour
Projects cracked should contain items.

The project does work/build with using dotnet build -graph on the command line, and checking the structured build log shows that the SourceFiles are in fact being passed to the CoreCompile/Fsc targets as expected.

@baronfel baronfel assigned baronfel and unassigned baronfel Apr 25, 2021
@TheAngryByrd TheAngryByrd self-assigned this Apr 25, 2021
@PaigeM89
Copy link

I was able to recreate this issue in one of my projects, where having MSBuild Project Graph turned on would cause the solution explorer to show all my projects as empty and no tooling would display (eg, no popups on hover or type hints). It should happen right now on latest main.

@TheAngryByrd
Copy link
Member

I looked into this a bit tonight and I'm kind of stumped. When running the build code:

let gbr = GraphBuildRequestData(projects, ProjectLoader.buildArgs, null, BuildRequestDataFlags.ReplaceExistingProjectInstance)
let bm = BuildManager.DefaultBuildManager
use sw = new StringWriter()
let loggers = ProjectLoader.createLoggers allKnownNames generateBinlog sw
bm.BeginBuild(new BuildParameters(Loggers = loggers))
let result = bm.BuildRequest gbr
bm.EndBuild()
, it produces a GraphBuildResult with the OverallResult of Failure and a null Exception. When digging into the ResultsByTarget, it shows that CoreCompile target is the one failing on all projects. However, I do not encounter this build failure when reverting to 5.0.103, only on 5.0.201. Without a good error message, I'm going to be stuck in the mud here. Maybe @cartermp has some deep lore that can point me in a good direction.

Currently the only work around I have is either turn off project graph, or use 5.0.103 in your global.json.

@cartermp
Copy link

Hmm, that sounds like there might be a bug in the SDK or MSBuild, offhandedly. We didn't change anything in the F# compiler AFAIK.

@TheAngryByrd
Copy link
Member

So I wasn't looking into the StringWriter where we were do get better logs and found:

Using \"Fsc\" task from assembly \"/usr/local/share/dotnet/sdk/5.0.202/FSharp/FSharp.Build.dll\".
Task \"Fsc\"
The specified task executable location \"/usr/local/share/dotnet/sdk/5.0.202/FSharp/fsc.exe\" is invalid.
Done executing task \"Fsc\" -- FAILED.
Done building target \"CoreCompile\" in project \"FsToolkit.ErrorHandling.fsproj\" -- FAILED.
Done building project \"FsToolkit.ErrorHandling.fsproj\" -- FAILED.

It looks like it's trying to use a windows executable on macos. Any pointers?

@Krzysztof-Cieslak
Copy link
Member

I thought we've already fixed it #100

@TheAngryByrd
Copy link
Member

Changed the target of the build from "CoreCompile" to "Build" to bring in SDK props

Doesn't look like it's "Build"

let buildArgs =
[| "ResolvePackageDependenciesDesignTime"
"_GenerateCompileDependencyCache"
"CoreCompile" |]
. Maybe got wiped in a rebase?

@TheAngryByrd
Copy link
Member

Switching CoreCompile to Build here still outputs the same error message.

@Krzysztof-Cieslak
Copy link
Member

@TheAngryByrd
Copy link
Member

Hmm I added this right before it builds but had no difference.

                match System.Environment.GetEnvironmentVariable "DOTNET_HOST_PATH" with
                | null
                | "" -> System.Environment.SetEnvironmentVariable("DOTNET_HOST_PATH", Ionide.ProjInfo.Paths.dotnetRoot)
                | _alreadySet -> ()

Maybe there's some deep property I gotta mangle in BuildParameters or GraphBuildRequestData?

@baronfel
Copy link
Collaborator Author

I recently bumped FSAC to 5.0.2xx and the graph build failures appeared in the test suite we have there too, so there's another touchstone at least.

@baronfel
Copy link
Collaborator Author

closed by #111

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

No branches or pull requests

5 participants