XML Parser Error Message gives wrong row and character

162 Views Asked by At

I receive an error with incoming XML going through my WebAPI into the parser. I expect an error due to passing in a parameter as a wrong data type, but the row and character numbers are wrong in this error message: There is an error in XML document (2, 11).

I tried searching for wrong numbers in the XML Parser error message. All talk about what to do with the message but couldn't find any about getting wrong numbers.

I would expect it to be this: There is an error in XML document (27, 20).

What causes the default .Net Framework 4.7.2 XmlSerializer to give the wrong numbers?

This makes the user look into row 2 and they don't understand why that line is the problem.

0

There are 0 best solutions below