Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for asynchronous IO in ASP.NET Core #67

Open
NxSoftware opened this issue Jun 23, 2020 · 2 comments
Open

Support for asynchronous IO in ASP.NET Core #67

NxSoftware opened this issue Jun 23, 2020 · 2 comments

Comments

@NxSoftware
Copy link

First of all, great work on this library!

We're using it in an ASP.NET Core 3.x web application to parse the plist data in the request body, unfortunately as of 3.0 by default the server is configured to disallow synchronous IO operations.

This results in an InvalidOperationException from within the HttpRequestStream when attempting to copy it's contents to a MemoryStream.

System.InvalidOperationException: Synchronous operations are disallowed. Call ReadAsync or set AllowSynchronousIO to true instead.
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpRequestStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   at Microsoft.AspNetCore.WebUtilities.FileBufferingReadStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.Stream.CopyTo(Stream destination, Int32 bufferSize)
   at System.IO.Stream.CopyTo(Stream destination)
   at Claunia.PropertyList.PropertyListParser.ReadAll(Stream fs)
   at Claunia.PropertyList.PropertyListParser.Parse(Stream fs)

We are currently working around this by allowing synchronous IO but it seems that the preferred approach is to update the code & libraries to use async stream operations.

I realise this is likely a non-trivial change in the plist-cil code but curious to hear your thoughts about this.

@claunia
Copy link
Owner

claunia commented Jun 23, 2020

Hi,

I think it would fit to create a ParseAsync() method.

If you want to do it yourself and submit a patch it is most welcome, if not I will need some time to check it.

@NxSoftware
Copy link
Author

Cool, I'll try and get round to having a look at this some time this week or next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants