zarunbal/LogExpert

"Root element is missing" on appliation start

Closed this issue · 5 comments

Bug

Upon opening, get the following in dialogue box:

Root element is missing.

XmlException
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.Load(String filename)
at LogExpert.Classes.Persister.Persister.LoadOptionsOnly(String fileName)
at LogExpert.Controls.LogTabWindow.LogTabWindow.FindFilenameForSettings(String fileName)
at LogExpert.Controls.LogTabWindow.LogTabWindow.AddFileTab(String givenFileName, Boolean isTempFile, String title, Boolean forcePersistenceLoading, ILogLineColumnizer preProcessColumnizer, Boolean doNotAddToDockPanel)
at LogExpert.Controls.LogTabWindow.LogTabWindow.OnLogTabWindowLoad(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

without the xml this will be difficult to analyse, normally it means, that either you did not select a XML Filter or the xml file does not have a corresponding route element

How do I find the xml it's complaining about?

it's the last log file you opened with logexpert

Sorry, I'm not following. I thought this was an XML file issue, not a log file issue.

This error message box also appears now every time I start LogExpert, and prior to its initial appearance, all the logs that were open in the last session would reopen in the new one. Now no logs open after I click the close button on this message, and I have to open them all manually, either using the "Last used" list, or the open button on the ribbon. If I try to use File > Open, LogExpert crashes with no error from what I can tell.

When the above error shows at the start of every program start-up, the following is all that appears in ...\AddData\Roamin\LogExpert\logs\logexpert.log:

2023-12-14 10:11:23.2324|INFO|Program|
============================================================================
LogExpert 1.9.0 started.
============================================================================
2023-12-14 10:11:24.1547|FATAL|Program|System.Threading.ThreadExceptionEventArgs
2023-12-14 10:11:24.1547|FATAL|Program|System.Threading.ThreadExceptionEventArgs

When I click close, no other log messages appear in the LogExpert log. I can open log files as indicated above, and they show appropriately.

Where else can I look to determine how to fix this?

Thanks in advance for your help! It's a great tool, and with the columizer and associated regex's so much better than BareTail!

shawn

....AAAAAAAAAAAAAnd i figured it out.

In case anyone else comes across a similar situation, the cause was one of the files in C:\Users\<username>\Documents\LogExpert . These are all configuration files that are XML files (the ones with the LXP extension), one per log file you have viewed in LogExpert. In my case, one of them was evidently corrupted, and had a zero length (it was an empty file). Removing this file completely restored LogExpert back to its normal, no-error behaviour (including normal File > Open).

Perhaps in the next iteration of the program, the offending file could be clearly identified, perhaps with the option to remove it, say by catching the exception. That way the program could continue on normally in the event of a corrupted configuration file.