NancyFx / Nancy

Lightweight, low-ceremony, framework for building HTTP based services on .Net and Mono
http://nancyfx.org
MIT License
7.15k stars 1.47k forks source link

Nancy is not ready for dotnet core 2.1, only for 2.0 #2921

Open andersonom opened 5 years ago

andersonom commented 5 years ago

Prerequisites

Description

Nancy is not working for dotnet core 2.1, only for 2.0.

Steps to Reproduce

System.StackOverflowException HResult=0x800703E9 Source= StackTrace:

### System Configuration - Nancy version: 2.0.0-clinteastwood - Nancy host - [ ] Nancy.Hosting.Aspnet - [ ] Nancy.Hosting.Self - [X] Nancy.Owin - [ ] Other: - Environment (Operating system, version and so on): Windows 10 - .NET Framework version: dotnet core 2.1 - Additional information: The same project worked when reverted dotnet core 2.1 to 2.0
wjdavis5 commented 5 years ago

+1

provegard commented 5 years ago

I just tested Nancy (pre1911) with Core 2.1 and it works just fine. I changed a few things compared to the code you posted:

Get("/Home/{param}", async (args, ct) =>
{
    var result = await myService.GetMyModel((string) args.param, ct);
    return Response.AsJson(result);
});

In your code, the Task object is serialized to JSON, which is not what we want.

Also, I just did this to have the service managed entirely by TinyIoC:

container.Register<IMyService, MyService>();

Of course, if your service is external to Nancy it makes sense to inject it into the bootstrapper, otherwise the above is fine.

tim-arheit commented 5 years ago

It actually work in a Core 2.2 project. Just converted the project I've been working on from 2.0 to 2.2 and Nancy didn't have any issues. As a bonus, I'm noticing significantly lower CPU load after moving to 2.2 on a simple load test.

That said, it would be nice to officially get things updated (net 472, core 2.2 and all packages). I just ran through it and some updated packages have breaking changes.