runtime: With Blazor WebAssembly, XML validation errors are not reported correctly ONLY when deployed
This issue has been moved from a ticket on Developer Community.
[severity:I’m unable to use this version] The following code works fine on localhost, but produces limited error messages when deployed to an Azure Static Web App through GitHub.
string ValidationResult="All good";
protected override async Task OnInitializedAsync()
{
string path = "sample-data/Books.xml";
byte[] byteArrayS = await _client. GetByteArrayAsync(path);
Console.WriteLine($"{path}: {byteArrayS.Length}");
MemoryStream streamS = new MemoryStream(byteArrayS);
XmlReader xmlReader = XmlReader.Create(streamS);
XmlDocument document = new XmlDocument();
//document. Validate();
try
{
document. Load(xmlReader);
}
catch (Exception e)
{
Console.WriteLine($"Validation Error: {e.Message} on line ");
ValidationResult = e.Message;
}
}
When loading the badly formed XML file books.html (attached), the line document. Load(xmlReader); fires an error. The problem is that while on localhost this error has a meaningful message, such as:
'<' is an unexpected token. The expected token is '>'. Line 6, position 5.
The deployed version produces a meaningless error message:
Xml_MessageWithErrorPosition, Xml_UnexpectedTokenEx, 6, 5
Am I doing something wrong? Is this a bug?
I have created a public repo at https://github.com/GilShalit/XMLValidation
Original Comments
Feedback Bot on 3/3/2021, 11:00 PM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
Original Solutions
(no solutions)
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 19 (13 by maintainers)
@joperezr is currently working on annotating System.Xml to make it linker safe.