ajsmith595
Topic Author
Posts: 8
Joined: 18 Nov 2017, 16:23

Unity - Calling Thread (7600) doesn't have access to this object (6864) - Is this a bug?

09 Dec 2017, 03:07

After changing some of my XAML code and importing the new XAML file into Unity, I got the following error message:
NoesisException: Calling thread (7600) doesn't have access to this object (6864)
Noesis.Error.Check () (at Assets/NoesisGUI/Plugins/API/Core/NoesisError.cs:21)
Noesis.View.Noesis_View_Create_ (HandleRef content) (at Assets/NoesisGUI/Plugins/API/Core/NoesisView.cs:298)
Noesis.View..ctor (Noesis.FrameworkElement content) (at Assets/NoesisGUI/Plugins/API/Core/NoesisView.cs:282)
Noesis.GUI.CreateView (Noesis.FrameworkElement content) (at Assets/NoesisGUI/Plugins/API/Core/NoesisGUI.cs:140)
NoesisXamlEditor.CreatePreviewGUIView () (at Assets/NoesisGUI/Plugins/Editor/NoesisXamlEditor.cs:53)
UnityEngine.Debug:LogException(Exception)
NoesisXamlEditor:CreatePreviewGUIView() (at Assets/NoesisGUI/Plugins/Editor/NoesisXamlEditor.cs:60)
NoesisXamlEditor:OnPreviewGUI(Rect, GUIStyle) (at Assets/NoesisGUI/Plugins/Editor/NoesisXamlEditor.cs:171)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

I have tried reimporting the asset, deleting it, copying it back in, etc. I have seen elsewhere that this may be a bug. Is this correct? If not, how would you suggest I go about fixing this?
 
User avatar
jsantos
Site Admin
Posts: 3905
Joined: 20 Jan 2012, 17:18
Contact:

Re: Unity - Calling Thread (7600) doesn't have access to this object (6864) - Is this a bug?

11 Dec 2017, 12:26

You are not using explicit threads, right? I would say this is a bug. Do you have a deterministic way to reproduce that exception error? If possible we would like to have a look at your project.
 
ajsmith595
Topic Author
Posts: 8
Joined: 18 Nov 2017, 16:23

Re: Unity - Calling Thread (7600) doesn't have access to this object (6864) - Is this a bug?

11 Dec 2017, 17:43

If wanted, I can post the code for the XAML handling ONLY. All other scripts reference this, therefore the error should be here. However, this only happened after I reimported a different xaml file, and the error was there as it was imported, rather than at runtime, so nothing to do with this script would even be called or analysed. Therefore, I can deduce that it is probably a bug. However, if you would like the code handling the Noesis elements then I can do that.
 
User avatar
jsantos
Site Admin
Posts: 3905
Joined: 20 Jan 2012, 17:18
Contact:

Re: Unity - Calling Thread (7600) doesn't have access to this object (6864) - Is this a bug?

11 Dec 2017, 17:50

Do you have a way to deterministically reproduce this?
 
ajsmith595
Topic Author
Posts: 8
Joined: 18 Nov 2017, 16:23

Re: Unity - Calling Thread (7600) doesn't have access to this object (6864) - Is this a bug?

11 Dec 2017, 22:43

[PROJECT LINK DELETED]
This is the project I am using minus most of the scripts that do not relate to the error whatsoever. "XAMLStuff.cs" is the thing all the other scripts reference.
Remember, I get the Calling Thread ([number]) doesn't have access to this object ([othernumber]) error when I start Unity and just click on the xaml file to look at its properties in the inspector.
 
User avatar
jsantos
Site Admin
Posts: 3905
Joined: 20 Jan 2012, 17:18
Contact:

Re: Unity - Calling Thread (7600) doesn't have access to this object (6864) - Is this a bug?

11 Dec 2017, 23:32

Sorry, I deleted your project to avoid sharing publicly. Could you please file a report in the bugtracker?
Let's follow there in private.
 
ajsmith595
Topic Author
Posts: 8
Joined: 18 Nov 2017, 16:23

Re: Unity - Calling Thread (7600) doesn't have access to this object (6864) - Is this a bug?

12 Dec 2017, 00:46

I have now posted a report in the bug tracker.
 
User avatar
sfernandez
Site Admin
Posts: 2984
Joined: 22 Dec 2011, 19:20

Re: Unity - Calling Thread (7600) doesn't have access to this object (6864) - Is this a bug?

12 Dec 2017, 18:45

I found the source of the problem.

You have a static TextBlock field that is assigned during Unity's Preload thread. You can see that Unity itslef is complaining about some classes being accessed outside Main Thread:
Assertion failed: Assertion failed on expression: 'Thread::CurrentThreadIsMainThread()'
Assertion failed: GetGfxDevice() should only be called from main thread
This assignment starts Noesis initialization process in that Preload thread, and that is not supported.

You shouldn't define constructors for MonoBehaviors as explained in Unity forums:
MonoBehaviours can't have Constructors.
The reason for this is that in Editor, to fill up the Inspector they get created/destroyed on a separate editor thread. This causes Unity threading issues primarily, but will also cause more strange issues because you can't reference singletons or some static variables, as the object is being created completely out of the game flow.

Who is online

Users browsing this forum: Bing [Bot] and 1 guest