0
Fixed

[Exception] UnityException: get_enabled can only be called from the main thread.

Ex-Crow 1 year ago updated by Lazlo Bonin (Lead Developer) 1 year ago 2

Regularly appears after generating scripts.




[Exception] UnityException: get_enabled can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
VersionControlUtility.Unlock() Assets/Ludiq/Ludiq.Core/Editor/Utilities/VersionControlUtility.cs:45
43: sb.AppendLine($"This may cause version control issues. Please report the following debug information:");
44: sb.AppendLine($"File Exists: {File.Exists(path)}");
-->45: sb.AppendLine($"Provider.enabled: {Provider.enabled}");
46: sb.AppendLine($"Provider.isActive: {Provider.isActive}");
47: sb.AppendLine($"Provider.hasCheckoutSupport: {Provider.hasCheckoutSupport}");

GenerationWorkflow.GenerateLinker() Assets/Ludiq/Bolt.Core/Editor/Generation/Generation.cs:162
160: PathUtility.CreateDirectoryIfNeeded(LudiqCore.Paths.transientGenerated);
-->162: VersionControlUtility.Unlock(path);
164: if (File.Exists(path))

GenerationWorkflow+<>c__DisplayClass2_0.b__0() Assets/Ludiq/Bolt.Core/Editor/Generation/Generation.cs:75
74: var linkerPath = Path.Combine(LudiqCore.Paths.transientGenerated, "link.xml");
-->75: GenerateLinker(linkerPath);
77: generation.CompleteStep();

Task.Run() Assets/Ludiq/Ludiq.Core/Editor/Tasks/Task.cs:65
63: public void Run()
64: {
-->65: work(this);
66: }

WindowTaskRunner.RunSynchronous() Assets/Ludiq/Ludiq.Core/Editor/Tasks/Runners/WindowTaskRunner.cs:62
60: try
61: {
-->62: task.Run();
63: }
64: catch (ThreadAbortException) { }

Debug.LogException()

WindowTaskRunner.RunSynchronous() Assets/Ludiq/Ludiq.Core/Editor/Tasks/Runners/WindowTaskRunner.cs:69
67: catch (Exception ex)
68: {
-->69: Debug.LogException(ex);
70: }
71: finally

Ludiq.<>c__DisplayClass10_0.b__0() Assets/Ludiq/Ludiq.Core/Editor/Tasks/Runners/WindowTaskRunner.cs:34
32: }
-->34: new Thread(() => RunSynchronous(task)).Start();
36: window.ShowModal();

ThreadHelper.ThreadStart()


LOG get_enabled.txt

Bolt Version:
2.0.0a6
Unity Version:
2019.2.15
Platform(s):
PC
Scripting Backend:
Mono
.NET Version (API Compatibility Level):
.NET 4.x
Bolt 2
Fixed (Unreleased)

Hi TowerCrow,

Thanks for the report, this will be fixed in the next version.