{"action":"closed","issue":{"url":"https://api.github.com/repos/NancyFx/Nancy/issues/2693","repository_url":"https://api.github.com/repos/NancyFx/Nancy","labels_url":"https://api.github.com/repos/NancyFx/Nancy/issues/2693/labels{/name}","comments_url":"https://api.github.com/repos/NancyFx/Nancy/issues/2693/comments","events_url":"https://api.github.com/repos/NancyFx/Nancy/issues/2693/events","html_url":"https://github.com/NancyFx/Nancy/issues/2693","id":203712838,"number":2693,"title":"New routing syntax serializes Task objects after inferring wrong GET overload","user":{"login":"bwatts","id":1592341,"avatar_url":"https://avatars.githubusercontent.com/u/1592341?v=3","gravatar_id":"","url":"https://api.github.com/users/bwatts","html_url":"https://github.com/bwatts","followers_url":"https://api.github.com/users/bwatts/followers","following_url":"https://api.github.com/users/bwatts/following{/other_user}","gists_url":"https://api.github.com/users/bwatts/gists{/gist_id}","starred_url":"https://api.github.com/users/bwatts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bwatts/subscriptions","organizations_url":"https://api.github.com/users/bwatts/orgs","repos_url":"https://api.github.com/users/bwatts/repos","events_url":"https://api.github.com/users/bwatts/events{/privacy}","received_events_url":"https://api.github.com/users/bwatts/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-01-27T18:59:15Z","updated_at":"2017-01-27T20:35:01Z","closed_at":"2017-01-27T20:35:01Z","body":"### Prerequisites\r\n\r\n- [X] I have written a descriptive issue title\r\n- [X] I have verified that I am running the latest version of Nancy\r\n- [X] I have verified if the problem exist in both `DEBUG` and `RELEASE` mode\r\n- [X] I have searched [open](https://github.com/NancyFx/Nancy/issues) and [closed](https://github.com/NancyFx/Nancy/issues?q=is%3Aissue+is%3Aclosed) issues to ensure it has not already been reported\r\n\r\n### Description\r\nThe new routing syntax (awesome, btw) has one scenario I can't shake out. Some route declarations infer an `object` return instead of a `Task<object>` return, causing the whole `Task` to serialize.\r\n\r\n### Steps to Reproduce\r\n\r\n```csharp\r\nGet(\"/test/{bar}\", args => Foo(args.bar));\r\n\r\n...\r\n\r\nprivate Task<object> Foo(int bar)\r\n{\r\n\r\n}\r\n```\r\n\r\n**Expected:** lambda resolves to `GET` overload taking `Func<dynamic, Task<object>>`\r\n\r\n**Actual:** lambda resolves to `GET` overload taking `Func<dynamic, object>`\r\n\r\nI should not that this does not happen if there are no arguments. I suspect it has to do with the way `dynamic` affects the lambda expression:\r\n\r\n```csharp\r\nGet(\"/test/{bar}\", args => Foo());\r\n\r\n...\r\n\r\nprivate Task<object> Foo()\r\n{\r\n\r\n}\r\n```\r\n\r\nThe above resolves as expected to the `GET` overload taking `Func<dynamic, Task<object>>`.\r\n\r\n### System Configuration\r\n\r\n- Nancy version: 2.0.0-barneyrubble\r\n- Nancy host\r\n  - [ ] ASP.NET\r\n  - [ ] OWIN\r\n  - [X] Self-Hosted\r\n  - [ ] Other:\r\n- Other Nancy packages and versions: None\r\n- Environment (Operating system, version and so on): Windows 7\r\n- .NET Framework version: 4.6.1\r\n- Additional information:\r\n"}}
{"actor":{"display_login":"bwatts"}}