Skip to content

Product feed (XML) response cutoff due to InvalidOperationException #775

@BenWhite27

Description

@BenWhite27

Which component is this issue related to?

Other / Not sure

Which Umbraco Commerce version are you using? (Please write the exact version, example: 10.1.0)

Umbraco.Commerce.ProductFeeds v16.1.1

Bug summary

The google feed xml is cutoff near the beginning. So far, I've only been able to replicate this in Umbraco.Cloud but have an This happens when hosting in IIS either locally on in Umbraco Cloud, an exception gets logged which seems to indicate an issue around streams and async flushing.

System.InvalidOperationException: Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead.
   at Microsoft.AspNetCore.Server.IIS.Core.HttpResponseStream.Write(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.Stream.Write(ReadOnlySpan`1 buffer)
   at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
   at System.IO.StreamWriter.Write(Char[] buffer, Int32 index, Int32 count)
   at System.Xml.XmlEncodedRawTextWriter.FlushBuffer()
   at System.Xml.XmlEncodedRawTextWriter.RawText(Char* pSrcBegin, Char* pSrcEnd)
   at System.Xml.XmlWellFormedWriter.WriteStartElement(String prefix, String localName, String ns)
   at System.Xml.XmlElement.WriteStartElement(XmlWriter w)
   at System.Xml.XmlElement.WriteElementTo(XmlWriter writer, XmlElement el)
   at System.Xml.XmlDocument.WriteContentTo(XmlWriter xw)
   at Umbraco.Commerce.ProductFeeds.Web.Apis.Publics.XmlActionResult.ExecuteResultAsync(ActionContext context)
   at Umbraco.Commerce.ProductFeeds.Web.Apis.Publics.XmlActionResult.ExecuteResultAsync(ActionContext context)
   at Umbraco.Commerce.ProductFeeds.Web.Apis.Publics.XmlActionResult.ExecuteResultAsync(ActionContext context)

The response on the feed looks like this

<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">
<channel>
<title>Google Merchant Center - UK</title>
<item>
<g:id>TS-R147880</g:id>
<g:title>RF Receiver and Cabinet Switch for Venset TS A or B Models</g:title>
<g:availability>in_stock</g:availability>
<g:image_link>https://[domain]/media/dfxdicpm/venset_r147880_l1.png</g:image_link>
<g:brand>Venset</g:brand>
<g:shipping_label>Standard</g:shipping_label>
<g:description>Genuine RF receiver and cabinet switch for the Venset TV Lift Range, compatible with the A and B models</g:description>
<g:google_product_category>7261</g:google_product_category>
<g:link>https://[domain]/products/accessories/rf-receiver-and-cabinet-switch-for-venset-ts-a-or-b-models/</g:link>
<g:price>48.00 GBP</g:price>
</item>
<item>
<g:id>TS-SB001</g:id>
<g:title>Swivel Head for Venset TV Lift Range (up to 4

I'll take a further look at the error and read up on this AllowSynchronousIO option over the weekend. But it seems like v16 of product feeds calls WriteAsync() now and perhaps the XmlWriter doesn't support Async?

Specifics

No response

Steps to reproduce

TBC, likely Just create a product feed in an Umbraco Cloud environment.

Expected result / actual result

No response

Dependencies

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions