Skip to content

Latest package version is compiled with .NET Core-based String.split overload making it incompatible with .NET Framework and .NET Standard 2.0 #172

Open
@cartermp

Description

@cartermp

Howdy @haf and friends, we got this report: dotnet/fsharp#10658

We investigated the issue thinking there may have been a bug in F# Interactive and #r "nuget:..." directives, since the user was reporting a runtime error with the following code:

#r "nuget: Hopac"
#r "nuget: Http.fs"

open Hopac
open HttpFs.Client

let url = "https://www.microsoft.com"

let response =
    Request.createUrl Get url
    |> Request.responseAsString
    |> run

The issue manifests in Visual Studio FSI since it runs as a .NET Framework 4.7.2 process right now. At runtime, it appears that Http.fs is compiled against the following String.Split overload: https://docs.microsoft.com/en-us/dotnet/api/system.string.split?view=net-5.0#System_String_Split_System_Char_System_StringSplitOptions_

However, this overload is not available in .NET Framework or .NET Standard 2.0.

We were able to verify that despite being packaged for .NET Standard 2.0 and .NET Framework, the latest version of Http.fs on NuGet is actually compiled with this String.Split overload.

This is likely due to building the library against a .NET Core 3.0+ or .NET 5 SDK that includes these overloads, since the code in question uses type inference.

However, this shouldn't happen as far as I can tell because the project already specifies that it builds against .NET Standard 2.0 and .NET Framework 4.7.2. So right now it's unclear if the issue lies in something related to packaging or if there is some weird quirk in the compiler that was used to package it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions