aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

RC1 - Exception thrown: 'Microsoft.AspNet.Server.Kestrel.Networking.UvException' in mscorlib.dll

Open matlus opened this issue 10 years ago • 9 comments

I have a simple ASP.NET 5 MVC 6 app where the controller's action simply returns a string using return Content(); So No views in play. I've got the bare minimum services configured. The controller action is async and it calls another method that is also async. Its implementation looks like this

   private async Task<string> GetData()
   {
       await Task.Delay(10);
       return "Some data";
   }

I run the app and in the browser I keep the F5 key pressed. I'll start to see these exceptions. in the Output window in VS.

I see this with both IIS Express as well as Kestrel. If I replace the Task.Delay() with Task.Yield() I don't see these exception. There are no exceptions in my application code itself. leaving the F5 key for 10 seconds and once again keeping it pressed (and repeating this process) generates large number of exceptions (exponential growth almost).

matlus avatar Dec 28 '15 17:12 matlus

Are you returning a Task<string> from the action? Your code shouldn't compile as is.

I'll start to see these exceptions

Do you have a stack trace for these exceptions?

pranavkm avatar Dec 28 '15 18:12 pranavkm

There is no stack trace. Essentially there is no exception in my application itself ( don't see the debugger break or don't see an Exception page).

Yea, Task doesn't really mean you have to return a Task (for methods modified with the async modifier :)). You need to return a T or await something that returns a Task. The "await" essentially unwraps the Task so you're left with a T.

So yes, it complies and works.

matlus avatar Dec 28 '15 18:12 matlus

Doesn't compile:

is an async method that returns 'Task', a return keyword must not be followed by an object expression. Did you intend to return 'Task'?

What do you see in the output window?

pranavkm avatar Dec 28 '15 18:12 pranavkm

I'm not sure what you mean. The project complies and runs. The project.json file has "frameworks": { "dnx451": { } },

This is the implementation of the method

        private async Task<string> GetData2()
        {
            await Task.Delay(10);
            return "Hash Code: ";
        }

matlus avatar Dec 28 '15 20:12 matlus

Are you certain the signature of your method isn't private async Task<string> GetData2()? What you have here shouldn't compile. A void Task cannot return a value.

pranavkm avatar Dec 28 '15 20:12 pranavkm

Yes it is. I guess the angle brackets are not being seen. Sorry I should have previewed and examine my posts correctly. I see now why you're wondering how my code is compiling. Just to be clear the method returns a Task of string.

matlus avatar Dec 28 '15 21:12 matlus

Does this still repro?

davidfowl avatar Jan 19 '16 08:01 davidfowl

I have just encountered the same issue, which apparently was caused by specifying the server url in the project.json and then trying to run from within VS.

Removing all parameters from the web command in the project.json for the affected web apps fixed the issue for me.

tgfl-tom avatar Feb 04 '16 07:02 tgfl-tom

This issue is being closed because it has not been updated in 3 months.

We apologize if this causes any inconvenience. We ask that if you are still encountering this issue, please log a new issue with updated information and we will investigate.

aspnet-hello avatar Dec 31 '17 06:12 aspnet-hello