Adam's Lair Forum

game development and casual madness
It is currently 2020/02/25, 05:26

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Problem With Cloning
PostPosted: 2016/01/10, 11:54 
Junior Member
Junior Member

Joined: 2016/01/09, 22:52
Posts: 35
Role: Hobbyist
Hello everyone,

I have encountered a problem in the editor, it seems to be related to the cloning system. When I try to add components that have members from a library I am using, https://github.com/sebastienros/jint, or try to add components requiring those components, the editor does not add the component(s). If I restart the editor the component(s) will be added. Below is the logfile_editor after this occurs.

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:   Assembly loaded: Duality
[Core] Msg:   Assembly loaded: DualityPrimitives
[Core] Msg:   Assembly loaded: FarseerDuality
[Core] Msg:   Assembly loaded: Jint
[Core] Msg:   Assembly loaded: NVorbis
[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...
[Core] Msg:     Assembly loaded: FarseerDuality
[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: System.IO.Compression
[Edit] ERR: An error occurred: ArgumentException: GenericArguments[0], 'System.Nullable`1[Jint.Native.JsValue]', on 'Duality.Cloning.CloneType+ValueAssignmentFunc`1[T]' violates the constraint of type 'T'.
            CallStack:
               at System.RuntimeType.ValidateGenericArguments(MemberInfo definition, RuntimeType[] genericArguments, Exception e)
               at System.RuntimeType.MakeGenericType(Type[] instantiation)
               at Duality.Cloning.CloneType.CompileValueAssignmentFunc() in c:\projects\duality\Duality\Cloning\CloneType.cs:line 306
               at Duality.Cloning.CloneType.Init() in c:\projects\duality\Duality\Cloning\CloneType.cs:line 250
               at Duality.Cloning.CloneProvider.GetCloneType(Type type) in c:\projects\duality\Duality\Cloning\CloneProvider.cs:line 789
               at Duality.Cloning.CloneType.Init() in c:\projects\duality\Duality\Cloning\CloneType.cs:line 219
               at Duality.Cloning.CloneProvider.GetCloneType(Type type) in c:\projects\duality\Duality\Cloning\CloneProvider.cs:line 789
               at Duality.Cloning.CloneType.Init() in c:\projects\duality\Duality\Cloning\CloneType.cs:line 219
               at Duality.Cloning.CloneProvider.GetCloneType(Type type) in c:\projects\duality\Duality\Cloning\CloneProvider.cs:line 789
               at Duality.Cloning.CloneType.Init() in c:\projects\duality\Duality\Cloning\CloneType.cs:line 219
               at Duality.Cloning.CloneProvider.GetCloneType(Type type) in c:\projects\duality\Duality\Cloning\CloneProvider.cs:line 789
               at Duality.Cloning.CloneType.Init() in c:\projects\duality\Duality\Cloning\CloneType.cs:line 219
               at Duality.Cloning.CloneProvider.GetCloneType(Type type) in c:\projects\duality\Duality\Cloning\CloneProvider.cs:line 789
               at Duality.Cloning.CloneType.Init() in c:\projects\duality\Duality\Cloning\CloneType.cs:line 219
               at Duality.Cloning.CloneProvider.GetCloneType(Type type) in c:\projects\duality\Duality\Cloning\CloneProvider.cs:line 789
               at Duality.Cloning.CloneProvider.PrepareObjectCloneGraph(Object source, Object target, CloneType typeData, CloneBehavior behavior) in c:\projects\duality\Duality\Cloning\CloneProvider.cs:line 254
               at Duality.Cloning.CloneProvider.PrepareCloneGraph() in c:\projects\duality\Duality\Cloning\CloneProvider.cs:line 219
               at Duality.Cloning.CloneProvider.BeginCloneOperation(Object source, Object target) in c:\projects\duality\Duality\Cloning\CloneProvider.cs:line 151
               at Duality.Cloning.CloneProvider.CloneObject[T](T source, Boolean preserveCache) in c:\projects\duality\Duality\Cloning\CloneProvider.cs:line 115
               at Duality.Editor.UndoRedoActions.CreateComponentAction.Do() in c:\projects\duality\DualityEditor\UndoRedoActions\CreateComponentAction.cs:line 64
               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 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.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] Msg: Saving user data...
[Core] Msg: Shutting down GLControl (OpenTK)...
[Core] Msg: Shutting down OpenGL 2.1 (OpenTK)...
[Core] Msg: Shutting down OpenAL (OpenTK)...
[Core] Msg: Shutting down .Net Framework...
[Core] Msg: DualityApp terminated


If I launch the scene everything works fine but I get this in my logfile.

Code:
[Core] Msg: Running DualityLauncher with flags: Debugging
[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:     Assembly loaded: Anonymously Hosted DynamicMethods Assembly
[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:   Assembly loaded: Duality
[Core] Msg:   Assembly loaded: DualityPrimitives
[Core] Msg:   Assembly loaded: FarseerDuality
[Core] Msg:   Assembly loaded: Jint
[Core] Msg:   Assembly loaded: NVorbis
[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.Threading
[Core] Msg: Assembly loaded: System.Xml.ReaderWriter
[Core] Msg: Assembly loaded: System.Xml
[Core] Msg: Assembly loaded: System.Xml.XDocument
[Core] Msg: Assembly loaded: System.Xml.Linq
[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: True
[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...
[Core] Msg:   DefaultOpenTKBackend.core...
[Core] Msg:     Assembly loaded: System.Drawing
[Core] Msg:   DotNetFrameworkBackend.core...
[Core] Msg:   GamePlugin.core...
[Core] Msg:     Assembly loaded: FarseerDuality
[Core] Msg: DualityApp initialized
            Debug Mode: True
            Command line arguments:
[Core] Msg: Opening Window...
[Core] Msg:   Window Specification:
              Buffers: 2
              Samples: 8
              ColorFormat: 32 (8888)
              AccumulatorFormat: 64 (16161616)
              Depth: 24
              Stencil: 8
              VSync: Off
              SwapInterval: 0
[Core] Msg:   OpenGL Version: 4.3.0 - Build 10.18.15.4256
              Vendor: Intel
              Renderer: Intel(R) HD Graphics 4600
              Shading Language Version: 4.30 - Build 10.18.15.4256
[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!
[Core] Msg: Loading Resource 'Data\Scene.Scene.res'
[Core] ERR:   Failed to create object of Type ClrFunctionInstance: NullReferenceException: Object reference not set to an instance of an object.
              CallStack:
                 at Jint.Runtime.Interop.ClrFunctionInstance..ctor(Engine engine, Func`3 func, Int32 length)
                 at lambda_method(Closure )
                 at Duality.ObjectCreator.CheckActivator(CreateMethod activator, Exception& error) in c:\projects\duality\Duality\Utility\ObjectCreator.cs:line 178
[Core] ERR:   Failed to create object of Type EvalFunctionInstance: NullReferenceException: Object reference not set to an instance of an object.
              CallStack:
                 at Jint.Native.Function.EvalFunctionInstance..ctor(Engine engine, String[] parameters, LexicalEnvironment scope, Boolean strict)
                 at lambda_method(Closure )
                 at Duality.ObjectCreator.CheckActivator(CreateMethod activator, Exception& error) in c:\projects\duality\Duality\Utility\ObjectCreator.cs:line 178
[Core] ERR:   Failed to create object of Type CultureInfo: ArgumentNullException: String reference not set to an instance of a String.
              Parameter name: cultureName
              CallStack:
                 at System.Globalization.CultureInfo..ctor(String cultureName, String textAndCompareCultureName)
                 at lambda_method(Closure )
                 at Duality.ObjectCreator.CheckActivator(CreateMethod activator, Exception& error) in c:\projects\duality\Duality\Utility\ObjectCreator.cs:line 178
[Core] ERR:   Failed to create object of Type CompareInfo: NullReferenceException: Object reference not set to an instance of an object.
              CallStack:
                 at System.Globalization.CompareInfo..ctor(CultureInfo culture)
                 at lambda_method(Closure )
                 at Duality.ObjectCreator.CheckActivator(CreateMethod activator, Exception& error) in c:\projects\duality\Duality\Utility\ObjectCreator.cs:line 178
[Core] ERR:   Failed to create object of Type TextInfo: NullReferenceException: Object reference not set to an instance of an object.
              CallStack:
                 at System.Globalization.TextInfo..ctor(CultureData cultureData)
                 at lambda_method(Closure )
                 at Duality.ObjectCreator.CheckActivator(CreateMethod activator, Exception& error) in c:\projects\duality\Duality\Utility\ObjectCreator.cs:line 178
[Core] ERR:   Failed to create object of Type ScriptFunctionInstance: NullReferenceException: Object reference not set to an instance of an object.
              CallStack:
                 at Jint.Native.Function.ScriptFunctionInstance..ctor(Engine engine, IFunctionDeclaration functionDeclaration, LexicalEnvironment scope, Boolean strict)
                 at lambda_method(Closure )
                 at Duality.ObjectCreator.CheckActivator(CreateMethod activator, Exception& error) in c:\projects\duality\Duality\Utility\ObjectCreator.cs:line 178
[Core] Msg:   Loading Resource 'Data\GameObject.Prefab.res'
[Core] Msg:   Loading Resource 'Data\Ground.Prefab.res'
[Core] Msg: Shutting down OpenGL 2.1 (OpenTK)...
[Core] Msg: Shutting down OpenAL (OpenTK)...
[Core] Wrn: Found leaked event bindings to invalid Assembly 'GamePlugin.core' from DualityApp.Keyboard. This is a common problem when registering global events from within a CorePlugin without properly unregistering them later. Please make sure that all events are unregistered in CorePlugin::OnDisposePlugin().
[Core] Msg: Shutting down .Net Framework...
[Core] Msg: DualityApp terminated


Top
 Profile  
 
 Post subject: Re: Problem With Cloning
PostPosted: 2016/01/10, 12:25 
Site Admin
Site Admin
User avatar

Joined: 2013/05/11, 22:30
Posts: 2073
Location: Germany
Role: Professional
Looking at your logfile, it seems the system is failing due to a nullable value type being used. Unfortunately, both serialization and cloning do not support nullable value types at this point.

This means you shouldn't use things like int?, float?, YourStruct? or similar in your code, but in this case it appears to be library code that is causing the issue. Of course you can't do anything about what the library does and doesn't do - but you can tell Duality not to touch these external classes.

Say, you have a field in your Component that points to a library class called ThirdPartyClass like this:
Code:
private ThirdPartyClass someInstance = // ...;

You can make sure that Duality doesn't serialize or clone it by adding a DontSerialize attribute to it:
Code:
[DontSerialize]
private ThirdPartyClass someInstance = // ...;


Does this help?

_________________
Blog | GitHub | Twitter (@Adams_Lair)


Top
 Profile  
 
 Post subject: Re: Problem With Cloning
PostPosted: 2016/01/10, 22:38 
Junior Member
Junior Member

Joined: 2016/01/09, 22:52
Posts: 35
Role: Hobbyist
Yes that helped a lot, thank you! I saw that you changed the problem with exceptions causing scenes to be cleared, thanks for that as well!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 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