KeyNotFoundException was unhandled when I perform BetaWorld.Open()
JeHor opened this issue · 9 comments
I keep getting this exception (only with this world) when I perform the [BetaWorld world = BetaWorld.Open(path);]
I was able to open this world previously but now it always throws this exception. I am able to open other saves I have.
I have the full exception report and the world save zipped up if you'd like. I can also provide my source code.
Let me know what you need,
Jehor
[exception below]
System.Collections.Generic.KeyNotFoundException was unhandled
Message=The given key was not present in the dictionary.
Source=mscorlib
StackTrace:
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Substrate.Nbt.TagNodeCompound.get_Item(String key)
at Substrate.Item.LoadTree(TagNode tree)
at Substrate.ItemCollection.LoadTree(TagNode tree)
at Substrate.Player.LoadTree(TagNode tree)
at Substrate.Level.LoadTree(TagNode tree)
at Substrate.Level.LoadTreeSafe(TagNode tree)
at Substrate.BetaWorld.LoadLevel()
at Substrate.BetaWorld.OpenWorld(String path)
at Substrate.BetaWorld.Open(String path)
at MinecraftItemLocator.Form1.OpenWorld(String path) in C:\Users\jeremy\documents\visual studio 2010\Projects\MinecraftItemLocator\MinecraftItemLocator\Form1.cs:line 51
at MinecraftItemLocator.Form1.openToolStripMenuItem_Click(Object sender, EventArgs e) in C:\Users\jeremy\documents\visual studio 2010\Projects\MinecraftItemLocator\MinecraftItemLocator\Form1.cs:line 34
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at MinecraftItemLocator.Program.Main() in C:\Users\jeremy\documents\visual studio 2010\Projects\MinecraftItemLocator\MinecraftItemLocator\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Sorry, my email is jeremiah.hornick at gmail.com
It would appear that your player is corrupt. You could poke around and
see what the player NBT looks like in either NBTedit or NBTExplorer
(http://www.minecraftforum.net/topic/840677-nbtexplorer/), or you could
send me your level.dat for the world and I can look at it.
The player tree isn't being loaded through the "safe" mechanism (which I
guess counts as a bug because the level that owns it is being loaded
safe), which performs verification and would have told you what specific
required tag is missing or required value is invalid.
If you think the level.dat file was corrupted because you manipulated
your world with Substrate, I strongly encourage you to try and reproduce
the bug so that I can release a fix for it.
On 12/16/2011 9:13 PM, JeHor wrote:
I keep getting this exception (only with this world) when I perform the [BetaWorld world = BetaWorld.Open(path);]
I was able to open this world previously but now it always throws this exception. I am able to open other saves I have.
I have the full exception report and the world save zipped up if you'd like. I can also provide my source code.
Let me know what you need,
Jehor[exception below]
System.Collections.Generic.KeyNotFoundException was unhandled
Message=The given key was not present in the dictionary.
Source=mscorlib
StackTrace:
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Substrate.Nbt.TagNodeCompound.get_Item(String key)
at Substrate.Item.LoadTree(TagNode tree)
at Substrate.ItemCollection.LoadTree(TagNode tree)
at Substrate.Player.LoadTree(TagNode tree)
at Substrate.Level.LoadTree(TagNode tree)
at Substrate.Level.LoadTreeSafe(TagNode tree)
at Substrate.BetaWorld.LoadLevel()
at Substrate.BetaWorld.OpenWorld(String path)
at Substrate.BetaWorld.Open(String path)
at MinecraftItemLocator.Form1.OpenWorld(String path) in C:\Users\jeremy\documents\visual studio 2010\Projects\MinecraftItemLocator\MinecraftItemLocator\Form1.cs:line 51
at MinecraftItemLocator.Form1.openToolStripMenuItem_Click(Object sender, EventArgs e) in C:\Users\jeremy\documents\visual studio 2010\Projects\MinecraftItemLocator\MinecraftItemLocator\Form1.cs:line 34
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at MinecraftItemLocator.Program.Main() in C:\Users\jeremy\documents\visual studio 2010\Projects\MinecraftItemLocator\MinecraftItemLocator\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Reply to this email directly or view it on GitHub:
#1
Thanks for the reply.
I probably corrupted it. This was a single player game and I was trying to
find my player location using your GiveItem code as an example. I was
unable to find my player (I think named JeHor) using
PlayerManager.GetPlayer(). Using NBTExplorer it looks like single player
games may not have players like the example code.
I'll remove the issue from GitHub.
Thanks again,
JeHor
On Fri, Dec 16, 2011 at 11:24 PM, Justin Aquadro <
reply@reply.github.com
wrote:
It would appear that your player is corrupt. You could poke around and
see what the player NBT looks like in either NBTedit or NBTExplorer
(http://www.minecraftforum.net/topic/840677-nbtexplorer/), or you could
send me your level.dat for the world and I can look at it.The player tree isn't being loaded through the "safe" mechanism (which I
guess counts as a bug because the level that owns it is being loaded
safe), which performs verification and would have told you what specific
required tag is missing or required value is invalid.If you think the level.dat file was corrupted because you manipulated
your world with Substrate, I strongly encourage you to try and reproduce
the bug so that I can release a fix for it.On 12/16/2011 9:13 PM, JeHor wrote:
I keep getting this exception (only with this world) when I perform the
[BetaWorld world = BetaWorld.Open(path);]I was able to open this world previously but now it always throws this
exception. I am able to open other saves I have.I have the full exception report and the world save zipped up if you'd
like. I can also provide my source code.Let me know what you need,
Jehor[exception below]
System.Collections.Generic.KeyNotFoundException was unhandled
Message=The given key was not present in the dictionary.
Source=mscorlib
StackTrace:
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Substrate.Nbt.TagNodeCompound.get_Item(String key)
at Substrate.Item.LoadTree(TagNode tree)
at Substrate.ItemCollection.LoadTree(TagNode tree)
at Substrate.Player.LoadTree(TagNode tree)
at Substrate.Level.LoadTree(TagNode tree)
at Substrate.Level.LoadTreeSafe(TagNode tree)
at Substrate.BetaWorld.LoadLevel()
at Substrate.BetaWorld.OpenWorld(String path)
at Substrate.BetaWorld.Open(String path)
at MinecraftItemLocator.Form1.OpenWorld(String path) in
C:\Users\jeremy\documents\visual studio
2010\Projects\MinecraftItemLocator\MinecraftItemLocator\Form1.cs:line 51
at MinecraftItemLocator.Form1.openToolStripMenuItem_Click(Object
sender, EventArgs e) in C:\Users\jeremy\documents\visual studio
2010\Projects\MinecraftItemLocator\MinecraftItemLocator\Form1.cs:line 34
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key,
EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at
System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at
System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e,
ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e,
ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at
System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m,
MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr
hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at
System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr
dwComponentID, Int32 reason, Int32 pvLoopData)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at MinecraftItemLocator.Program.Main() in
C:\Users\jeremy\documents\visual studio
2010\Projects\MinecraftItemLocator\MinecraftItemLocator\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly,
String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)
at
Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object
state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state, Boolean
ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Reply to this email directly or view it on GitHub:
#1
Reply to this email directly or view it on GitHub:
#1 (comment)
Closed for now. Maybe I'll try to replicate it. Next time I'll back up my world first. :)
The single-player player data is stored in level.dat, under the Player
tag. You would access it directly with something like
world.Level.Player. The PlayerManager, on the other hand, is used to
load and save SMP players.
Messing around with the PlayerManager should not have corrupted anything
in level.dat, so I would be genuinely interested to see what that file
looks like.
On 12/17/2011 1:12 PM, JeHor wrote:
Closed for now. Maybe I'll try to replicate it. Next time I'll back up my world first. :)
Reply to this email directly or view it on GitHub:
#1 (comment)
Here's level.dat.
Also, thanks for explaining the difference. NBTExplorer is also very
helpful.
JeHor
On Sat, Dec 17, 2011 at 12:55 PM, Justin Aquadro <
reply@reply.github.com
wrote:
The single-player player data is stored in level.dat, under the Player
tag. You would access it directly with something like
world.Level.Player. The PlayerManager, on the other hand, is used to
load and save SMP players.Messing around with the PlayerManager should not have corrupted anything
in level.dat, so I would be genuinely interested to see what that file
looks like.On 12/17/2011 1:12 PM, JeHor wrote:
Closed for now. Maybe I'll try to replicate it. Next time I'll back up
my world first. :)
Reply to this email directly or view it on GitHub:
#1 (comment)
Reply to this email directly or view it on GitHub:
#1 (comment)
I don't believe your attachment came through. You can send it to me directly at jaquadro@gmail.com.
Thanks for the file. It turns out nothing is corrupt at all. One of the items in your player inventory had an enchantment on it, and there was a bug in item parsing for enchantments. I've pushed a fix to the repository, it will be included in the next release.
Awesome. Good job finding it.
Sent from my iPod
On 2011-12-17, at 9:25 PM, Justin Aquadroreply@reply.github.com wrote:
Thanks for the file. It turns out nothing is corrupt at all. One of the items in your player inventory had an enchantment on it, and there was a bug in item parsing for enchantments. I've pushed a fix to the repository, it will be included in the next release.
Reply to this email directly or view it on GitHub:
#1 (comment)