I am going to guess that it is because of a bad character that is it is trying to write as XML (nfo file). It probably happens in the process after it is written to the database.
You might try remuxing the mkv and see if that fixes the issue. I have used the XmlWriter in C# before, and I thought the main purpose of it was so that it handles encoding special characters for you. I haven't however, come across that character before, so I'm not sure what the expectations are, from a C# XmlWriter perspective.
Edit: Xml 1.0 does have a limited range of special characters and that is definately not a valid character in the range. Remuxing might fix the issue, assuming it doesn't put the invalid character in again. The long term fix would probably be to sanitize the text before it is passed to WriteElementString.
System.ArgumentException: '', hexadecimal value 0x01, is an invalid character.
at System.Xml.XmlUtf8RawTextWriter.InvalidXmlChar(Int32 ch, Byte* pDst, Boolean entitize)
at System.Xml.XmlUtf8RawTextWriter.WriteElementTextBlock(Char* pSrc, Char* pSrcEnd)
at System.Xml.XmlUtf8RawTextWriter.WriteString(String text)
at System.Xml.XmlWellFormedWriter.WriteString(String text)
at System.Xml.XmlWriter.WriteElementString(String localName, String ns, String value)
at MediaBrowser.XbmcMetadata.Savers.BaseNfoSaver.AddMediaInfo[T](T item, XmlWriter writer)
at MediaBrowser.XbmcMetadata.Savers.BaseNfoSaver.Save(IHasMetadata item, Stream stream, String xmlPath)
at MediaBrowser.XbmcMetadata.Savers.BaseNfoSaver.Save(IHasMetadata item, CancellationToken cancellationToken)
at MediaBrowser.Providers.Manager.ProviderManager.SaveMetadata(IHasMetadata item, ItemUpdateType updateType, IEnumerable`1 savers)
Edited by rhodges, 19 July 2017 - 09:03 AM.