Error: object reference not set to an instance of an object

I've looked at every thread regarding this error, but this error message looks like it's used for lots of different cases and I couldn't find anyone who created this error the same way I did.

This error will start happening when I open multiple files in the same editor window by highlighting the files I want to edit > right click > open for translation.

Then I will edit the files like normal and then click the save button. 

When I close out of the editor window and then double-click a single file to edit, that's when the error shows up. Here are the error details:

<SDLErrorDetails time="10/31/2017 10:25:21 PM">
<ErrorMessage>Object reference not set to an instance of an object.</ErrorMessage>
<Exception>
<Type>System.NullReferenceException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</Type>
<HelpLink />
<Source>Sdl.FileTypeSupport.Bilingual.SdlXliff</Source>
<HResult>-2147467261</HResult>
<StackTrace><![CDATA[ at Sdl.FileTypeSupport.Bilingual.SdlXliff.XliffFileReader.ParseCommentMetadataElement(XmlElement cmtMetadataElement)
at Sdl.FileTypeSupport.Bilingual.SdlXliff.XliffFileReader.ParseDocInfoElement(XmlElement docInfoElement)
at Sdl.FileTypeSupport.Bilingual.SdlXliff.XliffFileReader.OnDocInfo(XmlElement docInfo)
at Sdl.FileTypeSupport.Bilingual.SdlXliff.SdlXliffFeeder.<ContinueScanning>b__0(ISdlXliffStreamContentHandler handler)
at System.Collections.Generic.List`1.ForEach(Action`1 action)
at Sdl.FileTypeSupport.Bilingual.SdlXliff.SdlXliffFeeder.ContinueScanning()
at Sdl.FileTypeSupport.Bilingual.SdlXliff.XliffFileReader.ContinueParsing()
at Sdl.FileTypeSupport.Bilingual.SdlXliff.XliffFileReader.ParseNext()
at Sdl.FileTypeSupport.Framework.Integration.FileExtractor.ParseNext()
at Sdl.FileTypeSupport.Framework.Integration.MultiFileConverter.ParseNext()
at Sdl.FileTypeSupport.Framework.Integration.MultiFileConverter.Parse()
at Sdl.TranslationStudio.Editor.TranslationEditor.TranslatableDocument.Load(IJobExecutionContext context)
at Sdl.Desktop.Platform.Services.JobRequest.Execute(IJobExecutionContext context)
at Sdl.Desktop.Platform.Implementation.Services.Job.<_worker_DoWork>b__3()
at Sdl.Desktop.Platform.Implementation.Services.Log.Resources(Object message, Action action)
at Sdl.Desktop.Platform.Implementation.Services.Job._worker_DoWork(Object sender, DoWorkEventArgs e)
at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)]]></StackTrace>

Parents
  • Hello Andy,

    Do your files in Studio come from XLIFF files? I mean, do your SDLXLIFF file names end in ".xlf.sdlxliff"?

    If that is the case, perhaps this thread could help: community.sdl.com/.../10456

    Try the following:
    1. Save your bilingual files in a different folder as backups (just in case, you know).
    2. If your project came from a package generated by someone else, get the original unedited SDLXLIFF files from said package. If you created the project from source files, create a second project from them.
    3. Open one of those unedited files in a text editor (Notepad++, for instance) and then, do the same with one of your edited files.
    4. Check if there are differences between the headers of both files.
    5. If they are actually different, replace the header of your edited file with that of the unedited file. Save.
    6. Go to your project in Studio and try to open the file whose header you have just modified.

    If it opens, problem would be solved.

    Yet, before doing anything else, go to "Project Settings > File Types > XLIFF > Settings" and check if the checkbox "Do not store segmentation info in translated file" checkbox (or something similar, my UI is in Spanish and I don't remember the exact wording) is unchecked (second checkbox). If it is, check it.

    Repeat the previous 6 steps with all your files in project. With this, the "Object reference..." error should not happen again.

    Hope I could be of some help!

Reply
  • Hello Andy,

    Do your files in Studio come from XLIFF files? I mean, do your SDLXLIFF file names end in ".xlf.sdlxliff"?

    If that is the case, perhaps this thread could help: community.sdl.com/.../10456

    Try the following:
    1. Save your bilingual files in a different folder as backups (just in case, you know).
    2. If your project came from a package generated by someone else, get the original unedited SDLXLIFF files from said package. If you created the project from source files, create a second project from them.
    3. Open one of those unedited files in a text editor (Notepad++, for instance) and then, do the same with one of your edited files.
    4. Check if there are differences between the headers of both files.
    5. If they are actually different, replace the header of your edited file with that of the unedited file. Save.
    6. Go to your project in Studio and try to open the file whose header you have just modified.

    If it opens, problem would be solved.

    Yet, before doing anything else, go to "Project Settings > File Types > XLIFF > Settings" and check if the checkbox "Do not store segmentation info in translated file" checkbox (or something similar, my UI is in Spanish and I don't remember the exact wording) is unchecked (second checkbox). If it is, check it.

    Repeat the previous 6 steps with all your files in project. With this, the "Object reference..." error should not happen again.

    Hope I could be of some help!

Children
  • Hey thanks for suggestion! I just went and tried all that. I had to run the header code through a difference checker - this is the result (www.diffchecker.com/Y6Z4COuo) - says both are identical so doesn't look like that was a problem.

    Yeah when I get these batch of files from the client they come in a zip file with about 30 separate SDLXLIFF files.

    I also checked that box in the settings you mentioned.

    Still getting the error when I just created a new project, imported 3 SDLXLIFF files and tried editing it, saving it, then opening one file and got the same error.

    The reason why I like to open all files (which are typically 20-30 per batch) is that I run search and replace about 40 times at the beginning of my post editing. Just simple things like changing " cm" to "cm" - basically just removing the leading space before a measurement unit which is what the client wants. I have a list of about 40 things which is pretty tedious to get through because it makes it about 1200 times I have to run search and replace for each batch I get. :o

    If there was another way to run search and replace on all files at once then I wouldn't even need to open all files into one editor window. But I have a feeling there is no option for that.
  • Mmmm. If you open those files in N++, just after the header there should be a large block of black text. Check if they have the same content in both the edited and the unedited files, just in case. If they do differ, try copying this text from the unedited file and replace the corresponding part of the edited file with it.

    See in this screensthot an example of what I mean:

    It sounds weird, but something similar has happened to me a couple of times and that fixed the issue.

    I find that opening all files in a virtual view is always interesting if project has several files (for propagation of reps, as well as for global replacements). Yet, about that kind of replacements you want to do, perhaps it would help you to go to Project Settings > Language Pais > [the specific language pair of your project] > Translation Memory and Automated Translation > Auto-substitution > Measurements and check the Never use a space between the number and the unit. This way, QuickInsert would propose you the figure format without space (clicking Ctrl+Alt+Down in the relevant segments, just like to insert tags).

    For searches and replaces without opening the files, you can try installing the SDLXLIFF Toolkit app (http://appstore.sdl.com/language/app/sdlxliff-toolkit/296/). It works like a charm and saves you the time of opening the files.

    Hope you can solve your problem with this project. The "object reference..." can be very frustrating if you do not have a clue about what is going wrong.

    Best,