Adam's Lair Forum

game development and casual madness
It is currently 2020/02/25, 04:54

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: 2016/01/09, 23:06 
Junior Member
Junior Member

Joined: 2016/01/09, 22:52
Posts: 35
Role: Hobbyist
Hello everyone! I just got started using Duality yesterday, so far I am very impressed and excited to continue using it.

I have encountered a problem where the Dualitor will not save a scene if an exception occurs in one of my ICmpInitializable components. For example if I forget to remove the NotImplementedException from an automatically implemented OnInit and try to run the scene in sandbox, the contents of the scene will disappear. The same thing happens when stopping a scene if there is an exception in an OnShutdown. Below is a the contents of logfile_editor after one of these exceptions occur.

Code:
[Core] Msg: Using 'DefaultPluginLoader' to load plugins.
[Core] Msg: Scanning for core plugins...
[Core] Msg:   Plugins\Compatibility.core.dll...
[Core] Msg:     Assembly loaded: Compatibility.core
[Core] Msg:     Assembly loaded: System.Linq.Expressions
[Core] Msg:   Plugins\DefaultOpenTKBackend.core.dll...
[Core] Msg:     Assembly loaded: DefaultOpenTKBackend.core
[Core] Msg:     Assembly loaded: OpenTK
[Core] Msg:   Plugins\DotNetFrameworkBackend.core.dll...
[Core] Msg:     Assembly loaded: DotNetFrameworkBackend.core
[Core] Msg:   Plugins\GamePlugin.core.dll...
[Core] Msg:     Assembly loaded: GamePlugin.core
[Core] Msg: Loading auxiliary libraries...
[Core] Msg: Initializing ISystemBackend...
[Core] Msg:   .Net Framework...
[Core] Msg:     Operating System: Microsoft Windows NT 6.2.9200.0 (Windows 8)
                64 Bit Process: True
                CLR Version: 4.0.30319.42000
                Processor Count: 8
[Core] Msg: Assembly loaded: System.Xml.ReaderWriter
[Core] Msg: Assembly loaded: System.Text.Encoding
[Core] Msg: Assembly loaded: System.Text.RegularExpressions
[Core] Msg: Assembly loaded: System.Reflection.Extensions
[Core] Msg: Initializing IGraphicsBackend...
[Core] Msg:   OpenGL 2.1 (OpenTK)...
[Core] Msg:     Initializing OpenTK...
[Core] Msg:       Backend: PreferNative
                  EnableHighResolution: False
[Core] Msg: Initializing IAudioBackend...
[Core] Msg:   OpenAL (OpenTK)...
[Core] Msg:     OpenAL Drivers not found. Using 64 Bit software fallback.
[Core] Msg:     Available devices:
                Speakers (Realtek High Definition Audio) (Default),
                Speakers (Realtek High Definition Audio) (Default)
[Core] Msg:     Current device: OpenAL Soft
[Core] Msg:     OpenAL Version: 1.1 ALSOFT 1.15.1
                Vendor: OpenAL Community
                Renderer: OpenAL Soft
                Effects: True
[Core] Msg:     256 sources available
[Core] Msg: Initializing core plugins...
[Core] Msg:   Compatibility.core...
[Edit] Msg:     Analyzing Core Plugin: Compatibility.core
[Core] Msg:   DefaultOpenTKBackend.core...
[Edit] Msg:     Analyzing Core Plugin: DefaultOpenTKBackend.core
[Core] Msg:   DotNetFrameworkBackend.core...
[Edit] Msg:     Analyzing Core Plugin: DotNetFrameworkBackend.core
[Core] Msg:   GamePlugin.core...
[Edit] Msg:     Analyzing Core Plugin: GamePlugin.core
[Core] Msg: DualityApp initialized
            Debug Mode: False
            Command line arguments: null
[Edit] Msg: Scanning for editor plugins...
[Edit] Msg:   Loading 'Plugins\CamView.editor.dll'...
[Core] Msg:     Assembly loaded: CamView.editor
[Edit] Msg:   Loading 'Plugins\DefaultOpenTKBackend.editor.dll'...
[Core] Msg:     Assembly loaded: DefaultOpenTKBackend.editor
[Edit] Msg:   Loading 'Plugins\EditorBase.editor.dll'...
[Core] Msg:     Assembly loaded: EditorBase.editor
[Core] Msg:     Assembly loaded: PopupControl
[Edit] Msg:   Loading 'Plugins\GamePlugin.editor.dll'...
[Core] Msg:     Assembly loaded: GamePlugin.editor
[Edit] Msg:   Loading 'Plugins\HelpAdvisor.editor.dll'...
[Core] Msg:     Assembly loaded: HelpAdvisor.editor
[Edit] Msg:   Loading 'Plugins\LogView.editor.dll'...
[Core] Msg:     Assembly loaded: LogView.editor
[Edit] Msg:   Loading 'Plugins\ObjectInspector.editor.dll'...
[Core] Msg:     Assembly loaded: ObjectInspector.editor
[Edit] Msg:   Loading 'Plugins\PackageManagerFrontend.editor.dll'...
[Core] Msg:     Assembly loaded: PackageManagerFrontend.editor
[Core] Msg:     Assembly loaded: Aga.Controls
[Edit] Msg:   Loading 'Plugins\ProjectView.editor.dll'...
[Core] Msg:     Assembly loaded: ProjectView.editor
[Edit] Msg:   Loading 'Plugins\SceneView.editor.dll'...
[Core] Msg:     Assembly loaded: SceneView.editor
[Core] Msg: Initializing IEditorGraphicsBackend...
[Core] Msg:   GLControl (OpenTK)...
[Core] Msg: Assembly loaded: OpenTK.GLControl
[Core] Msg: Initializing default content...
[Core] Msg:   Assembly loaded: System.Runtime.InteropServices
[Core] Msg:   Assembly loaded: System.Collections.Concurrent
[Core] Msg:   Assembly loaded: System.Threading.Tasks.Parallel
[Core] Msg:   Assembly loaded: NVorbis
[Core] Msg:   ...done!
[Edit] Msg: Loading user data...
[Edit] Msg:   Loading DockPanel data...
[Edit] Msg:     Deserializing layout: 'Duality.Editor.Plugins.ProjectView.ProjectFolderView'
[Edit] Msg:     Deserializing layout: 'Duality.Editor.Plugins.SceneView.SceneView'
[Edit] Msg:     Deserializing layout: 'Duality.Editor.Plugins.ObjectInspector.ObjectInspector'
[Edit] Msg:     Deserializing layout: 'Duality.Editor.Plugins.HelpAdvisor.HelpAdvisor'
[Edit] Msg:     Deserializing layout: 'Duality.Editor.Plugins.LogView.LogView'
[Edit] Msg:     Deserializing layout: 'Duality.Editor.Plugins.CamView.CamView'
[Edit] Msg:   Loading editor user data...
[Edit] Msg: Initializing editor plugins...
[Edit] Msg:   CamView...
[Edit] Msg:   DefaultOpenTKEditorBackend...
[Edit] Msg:   EditorBase...
[Edit] Msg:   Magic_GameEditorPlugin...
[Edit] Msg:   HelpAdvisor...
[Edit] Msg:   LogView...
[Edit] Msg:   ObjectInspector...
[Edit] Msg:   PackageManagerFrontend...
[Edit] Msg:   ProjectView...
[Edit] Msg:   SceneView...
[Core] Msg: Assembly loaded: FarseerDuality
[Core] Msg: Loading Resource 'Data\Scene (2).Scene.res'
[Core] ERR: OnSaving() of Scene "Data\Scene (2)" failed: NotImplementedException: The method or operation is not implemented.
            CallStack:
               at Magic_Game.PlayerController.OnShutdown(ShutdownContext context) in C:\Users\Declan Easton\Documents\Development\GameDev\Duality\Magic-Game\Source\Code\CorePlugin\PlayerController.cs:line 55
               at Duality.GameObject.IterateComponents[T](Action`1 forEach, Predicate`1 where) in c:\projects\duality\Duality\GameObject.cs:line 678
               at Duality.GameObject.OnSaving(Boolean deep) in c:\projects\duality\Duality\GameObject.cs:line 933
               at Duality.Resources.Scene.OnSaving(String saveAsPath) in c:\projects\duality\Duality\Resources\Scene.cs:line 938
               at Duality.Resource.CheckedOnSaving(String saveAsPath) in c:\projects\duality\Duality\Resource.cs:line 213
[Edit] ERR: An error occurred: NotImplementedException: The method or operation is not implemented.
            CallStack:
               at Magic_Game.PlayerController.OnShutdown(ShutdownContext context) in C:\Users\Declan Easton\Documents\Development\GameDev\Duality\Magic-Game\Source\Code\CorePlugin\PlayerController.cs:line 55
               at Duality.GameObject.IterateComponents[T](Action`1 forEach, Predicate`1 where) in c:\projects\duality\Duality\GameObject.cs:line 678
               at Duality.Resources.Scene.<OnLeaving>b__0() in c:\projects\duality\Duality\Resources\Scene.cs:line 195
               at Duality.DualityApp.EditorGuard(Action action) in c:\projects\duality\Duality\DualityApp.cs:line 1245
[Core] Msg: Loading Resource 'Data\Scene (2).Scene.res'
[Core] Msg: Assembly loaded: System.IO.Compression
[Core] Msg: Assembly loaded: Windows7.DesktopIntegration
[Edit] Msg: Saving data...
[Edit] Msg: Reloading core plugins...
[Edit] Msg:   Plugins\GamePlugin.core.dll...
[Core] Msg:     Assembly loaded: GamePlugin.core
[Edit] Msg: Initializing reloaded core plugins...
[Edit] Msg:   GamePlugin.core...
[Edit] Msg:     Analyzing Core Plugin: GamePlugin.core
[Edit] Msg: Restoring data...
[Edit] ERR: An error occurred: NullReferenceException: Object reference not set to an instance of an object.
            CallStack:
               at Magic_Game.MonitorGroundContact.OnInit(InitContext context) in C:\Users\Declan Easton\Documents\Development\GameDev\Duality\Magic-Game\Source\Code\CorePlugin\MonitorGroundContact.cs:line 69
               at Duality.Resources.Scene.OnComponentAdded(ComponentEventArgs args) in c:\projects\duality\Duality\Resources\Scene.cs:line 255
               at Duality.Resources.Scene.objectManager_ComponentAdded(Object sender, ComponentEventArgs e) in c:\projects\duality\Duality\Resources\Scene.cs:line 927
               at Duality.GameObjectManager.OnComponentAdded(Object sender, ComponentEventArgs e) in c:\projects\duality\Duality\Utility\GameObjectManager.cs:line 217
               at Duality.GameObject.OnComponentAdded(Component cmp) in c:\projects\duality\Duality\GameObject.cs:line 970
               at Duality.GameObject.AddComponent[T](T newComp) in c:\projects\duality\Duality\GameObject.cs:line 584
               at Duality.Editor.UndoRedoActions.CreateComponentAction.Do() in c:\projects\duality\DualityEditor\UndoRedoActions\CreateComponentAction.cs:line 68
               at Duality.Editor.Plugins.SceneView.SceneView.CreateComponent(TreeNodeAdv baseNode, Type cmpType)
               at Duality.Editor.Plugins.SceneView.SceneView.newToolStripMenuItem_ItemClicked(Object sender, EventArgs e)
               at AdamsLair.WinForms.ItemModels.MenuModelItem.RaisePerformAction() in c:\Stuff\svn\Projects\AdamsLair.WinForms\WinForms\ItemModels\MenuModelItem.cs:line 317
               at AdamsLair.WinForms.ItemViews.MenuStripMenuView.viewMenuItem_Click(Object sender, EventArgs e) in c:\Stuff\svn\Projects\AdamsLair.WinForms\WinForms\ItemViews\MenuStripMenuView.cs:line 304
               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.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.ToolStrip.WndProc(Message& m)
               at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
               at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
[Edit] ERR: An error occurred: ArgumentNullException: Value cannot be null.
            Parameter name: shape
            CallStack:
               at Duality.Components.Physics.RigidBody.RemoveShape(ShapeInfo shape) in c:\projects\duality\Duality\Components\Physics\RigidBody.cs:line 404
               at Magic_Game.MonitorGroundContact.OnShutdown(ShutdownContext context) in C:\Users\Declan Easton\Documents\Development\GameDev\Duality\Magic-Game\Source\Code\CorePlugin\MonitorGroundContact.cs:line 88
               at Duality.GameObject.IterateComponents[T](Action`1 forEach, Predicate`1 where) in c:\projects\duality\Duality\GameObject.cs:line 678
               at Duality.Resources.Scene.OnGameObjectRemoved(GameObjectEventArgs args) in c:\projects\duality\Duality\Resources\Scene.cs:line 249
               at Duality.Resources.Scene.objectManager_GameObjectRemoved(Object sender, GameObjectEventArgs e) in c:\projects\duality\Duality\Resources\Scene.cs:line 919
               at Duality.GameObjectManager.OnObjectRemoved(GameObject obj) in c:\projects\duality\Duality\Utility\GameObjectManager.cs:line 208
               at Duality.GameObjectManager.RemoveObjectDeep(GameObject obj) in c:\projects\duality\Duality\Utility\GameObjectManager.cs:line 181
               at Duality.GameObjectManager.RemoveObject(IEnumerable`1 objEnum) in c:\projects\duality\Duality\Utility\GameObjectManager.cs:line 123
               at Duality.Editor.UndoRedoActions.DeleteGameObjectAction.Do() in c:\projects\duality\DualityEditor\UndoRedoActions\DeleteGameObjectAction.cs:line 44
               at Duality.Editor.Plugins.SceneView.SceneView.DeleteNodes(IEnumerable`1 nodes)
               at AdamsLair.WinForms.ItemModels.MenuModelItem.RaisePerformAction() in c:\Stuff\svn\Projects\AdamsLair.WinForms\WinForms\ItemModels\MenuModelItem.cs:line 318
               at AdamsLair.WinForms.ItemViews.MenuStripMenuView.viewMenuItem_Click(Object sender, EventArgs e) in c:\Stuff\svn\Projects\AdamsLair.WinForms\WinForms\ItemViews\MenuStripMenuView.cs:line 306
               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.ToolStripMenuItem.ProcessCmdKey(Message& m, Keys keyData)
               at System.Windows.Forms.ToolStripManager.ProcessShortcut(Message& m, Keys shortcut)
               at System.Windows.Forms.Form.ProcessCmdKey(Message& msg, Keys keyData)
               at System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)
               at System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)
               at System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)
               at System.Windows.Forms.ContainerControl.ProcessCmdKey(Message& msg, Keys keyData)
               at System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)
               at System.Windows.Forms.ContainerControl.ProcessCmdKey(Message& msg, Keys keyData)
               at System.Windows.Forms.Form.ProcessCmdKey(Message& msg, Keys keyData)
               at System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)
               at System.Windows.Forms.Control.PreProcessMessage(Message& msg)
               at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)
               at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)
[Core] Msg: Loading Resource 'Data\Scene (2).Scene.res'
[Core] Msg: Loading Resource 'Data\Scene.Scene.res'
[Edit] Msg: Saving data...
[Edit] Msg: Reloading core plugins...
[Edit] Msg:   Plugins\GamePlugin.core.dll...
[Core] Msg:     Assembly loaded: GamePlugin.core
[Edit] Msg: Initializing reloaded core plugins...
[Edit] Msg:   GamePlugin.core...
[Edit] Msg:     Analyzing Core Plugin: GamePlugin.core
[Edit] Msg: Restoring data...
[Core] Msg: Loading Resource 'Data\Scene (2).Scene.res'
[Core] Msg: Loading Resource 'Data\Scene (2).Scene.res'
[Core] Msg: Loading Resource 'Data\Scene (2).Scene.res'


Last edited by zakila on 2016/01/10, 01:56, edited 1 time in total.

Top
 Profile  
 
PostPosted: 2016/01/10, 01:50 
Forum Adept
Forum Adept

Joined: 2014/12/13, 00:11
Posts: 398
Location: Brazil
Role: Gamer
Welcome to the forums, hope you have a great time here!

First of all, I recommend either posting your logfile to pastebin or similar services, or formatting it with code tags. It is easier for us to look at your logs!

Now, I don't think that's a problem at all. When you use Visual Studio's action to implement the interfaces, it will just implement the method with a throw new NotImplementedException(); in the method's body, which is okay. If you want to get rid of it, just remove the call completely. Nothing "bad" will happen.

After you have removed these calls from your methods, you can then revert your scene to a backup that was hopefully made before you ran the scene with the NIE components.

_________________
I only know the basics of C#. I have no advanced knowledge.


Top
 Profile  
 
PostPosted: 2016/01/10, 02:15 
Novice Member
Novice Member

Joined: 2016/01/04, 05:33
Posts: 14
Role: Hobbyist
Is it deleting the GameObjects in your previously saved scene and saving that? Or is it just not saving your changes?

If it is the first one, that is a problem. But, just because nothing appears in the sandbox doesn't mean it's gone. Reopen the scene in the editor and see what's there.

If it's the second one, it seems like appropriate behavior. I wouldn't want Duality to overwrite a previously working scene with a scene that throws exceptions.


Top
 Profile  
 
PostPosted: 2016/01/10, 02:19 
Junior Member
Junior Member

Joined: 2016/01/09, 22:52
Posts: 35
Role: Hobbyist
It is deleting the GameObject's in the scene. When I re-open the scene there is nothing there.


Top
 Profile  
 
PostPosted: 2016/01/10, 04:05 
Novice Member
Novice Member

Joined: 2016/01/04, 05:33
Posts: 14
Role: Hobbyist
I posted this to the GitHub issue tracker:
https://github.com/AdamsLair/duality/issues/263

If you have any other information please post it. I'll look into this myself tonight if I get the chance.

I'm sorry for any progress you lost on your game, for now here are some precautions:
1) never leave a NotImplementedException in your code, especially in OnShutdown.
2) Save the scene before running the sandbox and check the log window. If there is an error, do not run the sandbox. While just saving the scene will not cause this bug - do not rely on this. If the scene does not have any changes to it, the save operation doesn't seem to execute and so the error will not be logged, so you might run the sandbox thinking it was safe.

***Edit
Also, note that backups are made by Duality automatically. Check the backup folder in your project directory.


Top
 Profile  
 
PostPosted: 2016/01/10, 11:12 
Junior Member
Junior Member

Joined: 2016/01/09, 22:52
Posts: 35
Role: Hobbyist
Thank you jdean!


Top
 Profile  
 
PostPosted: 2016/01/10, 11:37 
Forum Adept
Forum Adept

Joined: 2015/07/08, 16:41
Posts: 414
Role: Gamer
I've had this occur to me before, too. I never really got around to creating an issue for it, since I had backups, but it does become annoying, and has the potential to cause some real damage like you said, jdean300.

I don't think it's only caused by the throw new NotImplementedException(); but rather any exception that goes uncaught, because it happened to me in a project of mine some time ago (which had completely different code in there).

Also, a warm welcome to the forum, zakila.


Top
 Profile  
 
PostPosted: 2016/01/10, 11:59 
Novice Member
Novice Member

Joined: 2016/01/04, 05:33
Posts: 14
Role: Hobbyist
From the tests I ran, which certainly weren't all inclusive, it's whenever there is an uncaught exception during the saving process. Uncaught exceptions during initialization/updating were handled gracefully by the editor. The example I posted on the issue tracker was just a minimal example meant to be a test case for verifying if a fix removes the bug. Thankfully Duality make backups, so I think that in most cases the damage shouldn't be too severe, but I think there should be a much graceful failure than what happens currently. I had this happen before as well but didn't really know why it occurred, Zakila's post gave me something to investigate.

I'm looking through the source code right now. Once I find the issue I have a feeling the fix will be rather simple. But you never know with bugs.... I had a missing semi-colon in a c++ program that took two weeks to track down..... I quit programming for a few months after suffering through that lol


Top
 Profile  
 
PostPosted: 2016/01/10, 12:05 
Site Admin
Site Admin
User avatar

Joined: 2013/05/11, 22:30
Posts: 2073
Location: Germany
Role: Professional
Thanks everyone, I think you pretty much wrapped up the whole bug report and investigation here ^^ The fix shouldn't be too big of an issue, will look into this as soon as I can. I've commented on and tagged the issue jdean300 created.

_________________
Blog | GitHub | Twitter (@Adams_Lair)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group