Skip to content

XmlSerializer.Deserialize causing Kestrel failure in .NET Core 3.0 Preview 5 #12711

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

Closed
ghost opened this issue May 17, 2019 · 3 comments
Closed

Comments

@ghost
Copy link

ghost commented May 17, 2019

I have been using the XmlSerializer for years, and I am using it in a project that I upgraded to .NET Core 3.0 Preview 5 today. After the upgrade, I receive the following exception when I try to XmlSerialize.Deserialize (Stream) the Request stream in a custom middleware component:

Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead

Prior to the upgrade, everything was working fine, so there is definitely something broken in in this serializer. If I update the Kestrel options as follows, it works fine:

.UseKestrel((context, options) =>
{
	// Temporary? The XmlSerializer is only performing synchronous operations.
	options.AllowSynchronousIO = true;
})
@kevingosse
Copy link
Contributor

kevingosse commented May 17, 2019

What has changed isn't the XmlSerializer but Kestrel. The default value of AllowSynchronousIO was true, it has been changed to false in 3.0: dotnet/aspnetcore@93a24b0
XmlSerializer has never supported async operations.

@ghost
Copy link
Author

ghost commented May 17, 2019

So is changing it to true the recommended action? Or should we be doing something different?

Reference aspnet/AspNetCore#7644

@jkotas
Copy link
Member

jkotas commented May 18, 2019

Answered in dotnet/aspnetcore#7644 (comment)

@jkotas jkotas closed this as completed May 18, 2019
@msftgits msftgits transferred this issue from dotnet/coreclr Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants