Skip to content

Trying to save data with a \u0002 crashes LCM #328

@hahn-kev

Description

@hahn-kev

I've got a simple reproduction in my own code. Basically it looks like this:

UndoableUnitOfWorkHelper.Do("create entry", "undo", api.Cache.ServiceLocator.ActionHandler,
    () =>
    {
        var entry = api.Cache.ServiceLocator.GetInstance<ILexEntryFactory>()
            .Create(Guid.NewGuid(),
            api.Cache.ServiceLocator
                .GetInstance<ILangProjectRepository>().Singleton.LexDbOA);
        entry.LexemeFormOA = api.Cache.CreateLexemeForm();
        entry.LexemeFormOA.Form.set_String(0, "te\u0002st");
    });

stack trace:

System.ArgumentException
'�', hexadecimal value 0x02, 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 SIL.LCModel.DomainImpl.MultiUnicodeAccessor.ToXml(XmlWriter writer, ILgWritingSystemFactory wsf, Int32 ws, ITsString alternative)
   at SIL.LCModel.DomainImpl.MultiAccessor.ToXMLString(XmlWriter writer)
   at SIL.LCModel.DomainImpl.ReadWriteServices.WriteMultiFoo(XmlWriter writer, String elementName, MultiAccessor multiProperty)
   at SIL.LCModel.DomainImpl.MoForm.ToXMLStringInternal(XmlWriter writer)
   at SIL.LCModel.DomainImpl.MoStemAllomorph.ToXMLStringInternal(XmlWriter writer)
   at SIL.LCModel.DomainImpl.CmObject.SIL.LCModel.ICmObjectInternal.ToXmlBytes()
   at SIL.LCModel.DomainImpl.CmObject.SIL.LCModel.ICmObjectInternal.ToXmlString()
   at SIL.LCModel.Infrastructure.Impl.LcmStateChangeObjectCreation.SetAfterXML()
   at SIL.LCModel.Infrastructure.Impl.UndoableUnitOfWork.SetAfterXml()
   at SIL.LCModel.Infrastructure.Impl.UndoStack.EndUndoTaskCommon(Boolean updateDateModified)
   at SIL.LCModel.Infrastructure.Impl.UndoStack.EndUndoTask()
   at SIL.LCModel.Infrastructure.UndoableUnitOfWorkHelper.EndUndoTask()
   at SIL.LCModel.Infrastructure.UnitOfWorkHelper.Dispose(Boolean disposing)
   at SIL.LCModel.Infrastructure.UnitOfWorkHelper.Dispose()
   at SIL.LCModel.Infrastructure.UndoableUnitOfWorkHelper.Do(String undoText, String redoText, IActionHandler actionHandler, Action task)
   at SIL.LCModel.Infrastructure.UndoableUnitOfWorkHelper.Do(String undoText, String redoText, IActionHandler actionHandler, Action task)
   at SIL.LCModel.Infrastructure.UndoableUnitOfWorkHelper.DoUsingNewOrCurrentUOW(String undoText, String redoText, IActionHandler actionHandler, Action task)
   at FwDataMiniLcmBridge.Api.FwDataMiniLcmApi.CreateEntry(Entry entry) in C:\dev\LexBox\backend\FwLite\FwDataMiniLcmBridge\Api\FwDataMiniLcmApi.cs:line 797

taking a look at LCM I'm not sure where a test for this should even go. Suggestions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions