Flurl: 4.6.1 class library unit test "MissingMethodException"

To recreate:

  1. Create a new .NetStandard library with a method using Flurl (EDIT: Not necessary, skip to step 2).
  2. Create a class library targeting 4.6.1
  3. Create project.json with the following
{
  "dependencies": {
    "FluentAssertions": "4.17.0",
    "Flurl": "2.2.1",
    "Flurl.Http": "1.1.1",
    "NSubstitute": "1.10.0",
    "xunit": "2.1.0"
  },
  "frameworks": {
    "net461": {}
  },
  "runtimes": {
    "win": {}
  }
}
  1. Reload project
  2. Try to run the following
[Fact]
public void Test()
{
    using (var x = new HttpTest())
    {
        "G".GetJsonAsync();
    }
}

Exception :

System.MissingMethodException Method not found: ‘System.Threading.Tasks.Task`1<System.Object> Flurl.Http.HttpExtensions.GetJsonAsync(System.String, System.Threading.CancellationToken, System.Net.Http.HttpCompletionOption)’. at Tests.Class1.Test()

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 22 (5 by maintainers)

Most upvoted comments

I was able to work around this by targeting multiple frameworks in such a way that my powershell module loads the full-framework version of my library.