I have a smart client application communicating with its server via WCF. Data is created on the client and then sent over the service to be persisted. The server and client use the same domain classes via a shared dll and I'm using the handy "Add Service Reference" functionality in Visual Studio that wraps SvcUtil.exe and generates the client and proxy classes.
I get the following error when trying to call the service:
System.Xml.XmlException occurred
Message=Name cannot begin with the '<' character, hexadecimal value 0x3C.
Source=System.Xml
LineNumber=0
LinePosition=1
StackTrace:
at System.Xml.XmlConvert.VerifyNCName(String name, ExceptionType exceptionType)
InnerException:
This is particularly troublesome because the service will work for weeks at a time without this error occurring and then suddenly and without warning it will appear again. I haven't been able to figure out what causes it at all. When it does happen, I will do a deep dive into researching how to fix it and usually don't come up with anything more than people who have experienced the same error while actually trying to serialize things to xml programmatically. I am using nothing but the generated client and proxies to try and send this data.
I have looked into the generated proxies in the Service References\AwesomeService folder of my solution and see nothing that looks out of the ordinary. The only occurrences of angle brackets in the generated files are:
- xml tags in the *.svcinfo, Reference.svcmap, AwesomeService.disco, AwesomeService.wsdl and *.xsd files
- arguments to generic collections in the Reference.cs file
The code I'm using to call the service is such:
using (var client = new AwesomeServiceClient())
{
client.SaveAwesomeness(instanceOfAwesomeness);
}
This is the stack beggining with the first frame above the calling code listed