jaquadro/NBTExplorer

XmlException while closing NBTExplorer running on mono (Ubuntu Linux)

juozaspo opened this issue · 3 comments

Overview

NBTExplorer throws the following error twice on closing the window; happens every time I launch the program. The full error log is below the message posted.

--------------------------
NBTExplorer failed to run
---------------------------
NBTExplorer encountered the following exception while trying to run: XmlException
Message: Unexpected XML declaration. The XML declaration must be the first node in the document, and no white space characters are allowed to appear before it. Line 11, position 9.

Additional error detail has been written to:
/home/juozas/.config/NBTExplorer/error.log

---------------------------
OK   
---------------------------

Launcher Setup

Command line: mono NBTExplorer.exe /home/juozas/.minecraft/saves/
Working directory: /home/juozas/NBTExplorer/

Full error report

NBTExplorer Error Report
2016-04-23 09:05:46
-------
NBTExplorer encountered the following exception while trying to run: XmlException
Message: Unexpected XML declaration. The XML declaration must be the first node in the document, and no white space characters are allowed to appear before it. Line 11, position 9.

-------
  at System.Xml.XmlTextReaderImpl.Throw (System.Exception e) <0x41023ad0 + 0x000a3> in <filename unknown>:0 
  at System.Xml.XmlTextReaderImpl.Throw (System.String res, System.String arg) <0x410235c0 + 0x000ab> in <filename unknown>:0 
  at System.Xml.XmlTextReaderImpl.ParsePI (System.Text.StringBuilder piInDtdStringBuilder) <0x41023000 + 0x0013b> in <filename unknown>:0 
  at System.Xml.XmlTextReaderImpl.ParsePI () <0x40ffef20 + 0x0000f> in <filename unknown>:0 
  at System.Xml.XmlTextReaderImpl.ParseElementContent () <0x40f55a30 + 0x000bb> in <filename unknown>:0 
  at System.Xml.XmlTextReaderImpl.Read () <0x40f502f0 + 0x00057> in <filename unknown>:0 
  at System.Xml.XmlTextReader.Read () <0x40f502d0 + 0x0001a> in <filename unknown>:0 
  at System.Xml.XmlWriter.WriteNode (System.Xml.XmlReader reader, Boolean defattr) <0x40f5db30 + 0x0034c> in <filename unknown>:0 
  at System.Xml.XmlReader.ReadOuterXml () <0x40f5ccc0 + 0x0015a> in <filename unknown>:0 
  at System.Configuration.SectionInfo.ReadData (System.Configuration.Configuration config, System.Xml.XmlReader reader, Boolean overrideAllowed) <0x40f5c7d0 + 0x00283> in <filename unknown>:0 
  at System.Configuration.SectionGroupInfo.ReadContent (System.Xml.XmlReader reader, System.Configuration.Configuration config, Boolean overrideAllowed, Boolean root) <0x40f5c010 + 0x0031c> in <filename unknown>:0 
  at System.Configuration.SectionGroupInfo.ReadData (System.Configuration.Configuration config, System.Xml.XmlReader reader, Boolean overrideAllowed) <0x40f60d60 + 0x0005f> in <filename unknown>:0 
  at System.Configuration.SectionGroupInfo.ReadContent (System.Xml.XmlReader reader, System.Configuration.Configuration config, Boolean overrideAllowed, Boolean root) <0x40f5c010 + 0x0031c> in <filename unknown>:0 
  at System.Configuration.SectionGroupInfo.ReadRootData (System.Xml.XmlReader reader, System.Configuration.Configuration config, Boolean overrideAllowed) <0x40f5bfb0 + 0x00043> in <filename unknown>:0 
  at System.Configuration.Configuration.ReadConfigFile (System.Xml.XmlReader reader, System.String fileName) <0x40f4ff10 + 0x00223> in <filename unknown>:0 
  at System.Configuration.Configuration.Load () <0x40f4a750 + 0x0010b> in <filename unknown>:0 
  at System.Configuration.Configuration.Init (IConfigSystem system, System.String configPath, System.Configuration.Configuration parent) <0x40f4a020 + 0x00227> in <filename unknown>:0 
  at System.Configuration.Configuration..ctor (System.Configuration.InternalConfigurationSystem system, System.String locationSubPath) <0x40f49600 + 0x00173> in <filename unknown>:0 
  at System.Configuration.InternalConfigurationFactory.Create (System.Type typeConfigHost, System.Object[] hostInitConfigurationParams) <0x40f48a80 + 0x0006f> in <filename unknown>:0 
  at System.Configuration.ConfigurationManager.OpenMappedExeConfiguration (System.Configuration.ExeConfigurationFileMap fileMap, ConfigurationUserLevel userLevel) <0x410228a0 + 0x000b4> in <filename unknown>:0 
  at System.Configuration.CustomizableFileSettingsProvider.LoadProperties (System.Configuration.ExeConfigurationFileMap exeMap, System.Configuration.SettingsPropertyCollection collection, ConfigurationUserLevel level, System.String sectionGroupName, Boolean allowOverwrite, System.String groupName) <0x41022380 + 0x0007b> in <filename unknown>:0 
  at System.Configuration.CustomizableFileSettingsProvider.GetPropertyValues (System.Configuration.SettingsContext context, System.Configuration.SettingsPropertyCollection collection) <0x41020280 + 0x00193> in <filename unknown>:0 
  at System.Configuration.LocalFileSettingsProvider.GetPropertyValues (System.Configuration.SettingsContext context, System.Configuration.SettingsPropertyCollection properties) <0x41020240 + 0x0002e> in <filename unknown>:0 
  at System.Configuration.ApplicationSettingsBase.CacheValuesByProvider (System.Configuration.SettingsProvider provider) <0x4101fbe0 + 0x0029c> in <filename unknown>:0 
  at System.Configuration.ApplicationSettingsBase.GetPropertyValue (System.String propertyName) <0x4101f8d0 + 0x00083> in <filename unknown>:0 
  at System.Configuration.ApplicationSettingsBase.get_Item (System.String propertyName) <0x4101f820 + 0x00053> in <filename unknown>:0 
  at NBTExplorer.Properties.Settings.get_RecentFiles () <0x4105aba0 + 0x0001a> in <filename unknown>:0 
  at NBTExplorer.Windows.MainForm.MainForm_Closing (System.Object sender, System.ComponentModel.CancelEventArgs e) <0x4105ab10 + 0x0002f> in <filename unknown>:0 
  at System.Windows.Forms.Form.OnFormClosing (System.Windows.Forms.FormClosingEventArgs e) <0x4105aa80 + 0x00065> in <filename unknown>:0 
  at System.Windows.Forms.Form.FireClosingEvents (CloseReason reason, Boolean cancel) <0x4105a930 + 0x0009d> in <filename unknown>:0 
  at System.Windows.Forms.Form.RaiseCloseEvents (Boolean last_check, Boolean cancel) <0x4105a780 + 0x00087> in <filename unknown>:0 
  at System.Windows.Forms.Form.WmClose (System.Windows.Forms.Message& m) <0x410593a0 + 0x00187> in <filename unknown>:0 
  at System.Windows.Forms.Form.WndProc (System.Windows.Forms.Message& m) <0x41027520 + 0x00147> in <filename unknown>:0 
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) <0x40f91490 + 0x00024> in <filename unknown>:0 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) <0x40f91450 + 0x00036> in <filename unknown>:0 
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) <0x40f8fd90 + 0x0031c> in <filename unknown>:0 
-------

NBTExplorer Error Report
2016-04-23 09:05:52
-------
NBTExplorer encountered the following exception while trying to run: XmlException
Message: Unexpected XML declaration. The XML declaration must be the first node in the document, and no white space characters are allowed to appear before it. Line 11, position 9.

-------
  at System.Xml.XmlTextReaderImpl.Throw (System.Exception e) <0x41023ad0 + 0x000a3> in <filename unknown>:0 
  at System.Xml.XmlTextReaderImpl.Throw (System.String res, System.String arg) <0x410235c0 + 0x000ab> in <filename unknown>:0 
  at System.Xml.XmlTextReaderImpl.ParsePI (System.Text.StringBuilder piInDtdStringBuilder) <0x41023000 + 0x0013b> in <filename unknown>:0 
  at System.Xml.XmlTextReaderImpl.ParsePI () <0x40ffef20 + 0x0000f> in <filename unknown>:0 
  at System.Xml.XmlTextReaderImpl.ParseElementContent () <0x40f55a30 + 0x000bb> in <filename unknown>:0 
  at System.Xml.XmlTextReaderImpl.Read () <0x40f502f0 + 0x00057> in <filename unknown>:0 
  at System.Xml.XmlTextReader.Read () <0x40f502d0 + 0x0001a> in <filename unknown>:0 
  at System.Xml.XmlWriter.WriteNode (System.Xml.XmlReader reader, Boolean defattr) <0x40f5db30 + 0x0034c> in <filename unknown>:0 
  at System.Xml.XmlReader.ReadOuterXml () <0x40f5ccc0 + 0x0015a> in <filename unknown>:0 
  at System.Configuration.SectionInfo.ReadData (System.Configuration.Configuration config, System.Xml.XmlReader reader, Boolean overrideAllowed) <0x40f5c7d0 + 0x00283> in <filename unknown>:0 
  at System.Configuration.SectionGroupInfo.ReadContent (System.Xml.XmlReader reader, System.Configuration.Configuration config, Boolean overrideAllowed, Boolean root) <0x40f5c010 + 0x0031c> in <filename unknown>:0 
  at System.Configuration.SectionGroupInfo.ReadData (System.Configuration.Configuration config, System.Xml.XmlReader reader, Boolean overrideAllowed) <0x40f60d60 + 0x0005f> in <filename unknown>:0 
  at System.Configuration.SectionGroupInfo.ReadContent (System.Xml.XmlReader reader, System.Configuration.Configuration config, Boolean overrideAllowed, Boolean root) <0x40f5c010 + 0x0031c> in <filename unknown>:0 
  at System.Configuration.SectionGroupInfo.ReadRootData (System.Xml.XmlReader reader, System.Configuration.Configuration config, Boolean overrideAllowed) <0x40f5bfb0 + 0x00043> in <filename unknown>:0 
  at System.Configuration.Configuration.ReadConfigFile (System.Xml.XmlReader reader, System.String fileName) <0x40f4ff10 + 0x00223> in <filename unknown>:0 
  at System.Configuration.Configuration.Load () <0x40f4a750 + 0x0010b> in <filename unknown>:0 
  at System.Configuration.Configuration.Init (IConfigSystem system, System.String configPath, System.Configuration.Configuration parent) <0x40f4a020 + 0x00227> in <filename unknown>:0 
  at System.Configuration.Configuration..ctor (System.Configuration.InternalConfigurationSystem system, System.String locationSubPath) <0x40f49600 + 0x00173> in <filename unknown>:0 
  at System.Configuration.InternalConfigurationFactory.Create (System.Type typeConfigHost, System.Object[] hostInitConfigurationParams) <0x40f48a80 + 0x0006f> in <filename unknown>:0 
  at System.Configuration.ConfigurationManager.OpenMappedExeConfiguration (System.Configuration.ExeConfigurationFileMap fileMap, ConfigurationUserLevel userLevel) <0x410228a0 + 0x000b4> in <filename unknown>:0 
  at System.Configuration.CustomizableFileSettingsProvider.LoadProperties (System.Configuration.ExeConfigurationFileMap exeMap, System.Configuration.SettingsPropertyCollection collection, ConfigurationUserLevel level, System.String sectionGroupName, Boolean allowOverwrite, System.String groupName) <0x41022380 + 0x0007b> in <filename unknown>:0 
  at System.Configuration.CustomizableFileSettingsProvider.GetPropertyValues (System.Configuration.SettingsContext context, System.Configuration.SettingsPropertyCollection collection) <0x41020280 + 0x00193> in <filename unknown>:0 
  at System.Configuration.LocalFileSettingsProvider.GetPropertyValues (System.Configuration.SettingsContext context, System.Configuration.SettingsPropertyCollection properties) <0x41020240 + 0x0002e> in <filename unknown>:0 
  at System.Configuration.ApplicationSettingsBase.CacheValuesByProvider (System.Configuration.SettingsProvider provider) <0x4101fbe0 + 0x0029c> in <filename unknown>:0 
  at System.Configuration.ApplicationSettingsBase.GetPropertyValue (System.String propertyName) <0x4101f8d0 + 0x00083> in <filename unknown>:0 
  at System.Configuration.ApplicationSettingsBase.get_Item (System.String propertyName) <0x4101f820 + 0x00053> in <filename unknown>:0 
  at NBTExplorer.Properties.Settings.get_RecentFiles () <0x4105aba0 + 0x0001a> in <filename unknown>:0 
  at NBTExplorer.Windows.MainForm.MainForm_Closing (System.Object sender, System.ComponentModel.CancelEventArgs e) <0x4105ab10 + 0x0002f> in <filename unknown>:0 
  at System.Windows.Forms.Form.OnFormClosing (System.Windows.Forms.FormClosingEventArgs e) <0x4105aa80 + 0x00065> in <filename unknown>:0 
  at System.Windows.Forms.Form.FireClosingEvents (CloseReason reason, Boolean cancel) <0x4105a930 + 0x0009d> in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Form:FireClosingEvents (System.Windows.Forms.CloseReason,bool)
  at System.Windows.Forms.Application.Exit (System.ComponentModel.CancelEventArgs e) <0x41073b70 + 0x001b7> in <filename unknown>:0 
  at System.Windows.Forms.Application.Exit () <0x41073b30 + 0x00027> in <filename unknown>:0 
  at NBTExplorer.Program.ProcessException (System.Exception ex) <0x4105ae20 + 0x004f7> in <filename unknown>:0 
  at NBTExplorer.Program.AppThreadFailureHandler (System.Object sender, System.Threading.ThreadExceptionEventArgs e) <0x4105adf0 + 0x00017> in <filename unknown>:0 
  at System.Windows.Forms.Application.OnThreadException (System.Exception t) <0x4105ac20 + 0x000ce> in <filename unknown>:0 
  at System.Windows.Forms.NativeWindow.OnThreadException (System.Exception e) <0x4105ac00 + 0x00013> in <filename unknown>:0 
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) <0x40f8fd90 + 0x00b51> in <filename unknown>:0 
  at System.Windows.Forms.XplatUIX11.DispatchMessage (System.Windows.Forms.MSG& msg) <0x4103bc70 + 0x0001f> in <filename unknown>:0 
  at System.Windows.Forms.XplatUI.DispatchMessage (System.Windows.Forms.MSG& msg) <0x4103bc40 + 0x0001f> in <filename unknown>:0 
  at System.Windows.Forms.Application.RunLoop (Boolean Modal, System.Windows.Forms.ApplicationContext context) <0x410244b0 + 0x00d03> in <filename unknown>:0 
  at System.Windows.Forms.Application.Run (System.Windows.Forms.ApplicationContext context) <0x41024400 + 0x00057> in <filename unknown>:0 
  at System.Windows.Forms.Application.Run (System.Windows.Forms.Form mainForm) <0x410240f0 + 0x00033> in <filename unknown>:0 
  at NBTExplorer.Program.Main (System.String[] args) <0x40f3fda0 + 0x0010b> in <filename unknown>:0 
-------

Looks like a settings file isn't being read/written correctly. Have a look in that /home/juozas/.config/NBTExplorer/ directory for an xml file, or a .config file (on Windows it's user.config)

All i see is an error log in that directory, sorry. But user.config is in a different directory as the output from commands below shows.

juozas@Linux:~$ find -type d -iname "*nbtexplorer*" 2>/dev/null
./.local/share/NBTExplorer.exe_Url_e9a75dc9627caa70d6ce076cc2ec9d708a7f49e1
./.config/NBTExplorer
./NBTExplorer
juozas@Linux:~$ ls .local/share/NBTExplorer.exe_Url_e9a75dc9627caa70d6ce076cc2ec9d708a7f49e1
user.config
juozas@Linux:~$ ls .config/NBTExplorer
error.log
juozas@Linux:~$ ls NBTExplorer
NBTExplorer.exe  NBTExplorer.exe.config  NBTExplorer.png  NBTModel.dll  NBTUtil.exe  NBTUtil.exe.config  Substrate.dll
juozas@Linux:~$ cat .local/share/NBTExplorer.exe_Url_e9a75dc9627caa70d6ce076cc2ec9d708a7f49e1/user.config 
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <section name="NBTExplorer.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </sectionGroup>
  </configSections>
  <userSettings><NBTExplorer.Properties.Settings>
  <setting name="RecentFiles" serializeAs="Xml">
    <value>
      <?xml version="1.0" encoding="utf-16"?>
<ArrayOfString xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /></value>
  </setting>
  <setting name="RecentDirectories" serializeAs="Xml">
    <value>
      <?xml version="1.0" encoding="utf-16"?>
<ArrayOfString xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" /></value>
  </setting>
</NBTExplorer.Properties.Settings></userSettings>
</configuration>juozas@Linux:~$ cat Darbastalis/NBTExplorer.desktop 
[Desktop Entry]
Version=1.0
Type=Application
Name=NBTExplorer
Comment=NBT Editor for Minecraft
Exec=mono NBTExplorer.exe /home/juozas/.minecraft/saves/
Icon=/home/juozas/NBTExplorer/NBTExplorer.png
Path=/home/juozas/NBTExplorer/
Terminal=false
StartupNotify=false
juozas@Linux:~$ 

Also i don't know if it can find files with dot in first letter of file name, it does not load my minecraft saves directory by default unless I specify it in command line or use symlink.

Edit: if i delete .local/share/NBTExplorer.exe_Url_e9a75dc9627caa70d6ce076cc2ec9d708a7f49e1 directory from my home folder and start nbt explorer, it closes ok. Next time on closing - errors.

Edit*2: There're some extra declarations in config file, where should be none as shown in errors.

I have the same problem with last Win 10 version.

https://hastebin.com/efowuliren.php