0
Unity Bug

GetBool is not allowed to be called during serialization, call it from OnEnable instead.

Real World 3 years ago updated by Lazlo Bonin (Lead Developer) 3 years ago 4 1 duplicate

Getting this error from my build machine when building for Android. Anything I can/should do here?

build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.049] GetBool is not allowed to be called during serialization, call it from OnEnable instead. Called from ScriptableObject 'FlowMacro'.
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.050] See "Script Serialization" page in the Unity Manual for further details.
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.050] UnityEditor.EditorPrefs:GetBool(String, Boolean)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.050] SyntaxTree.VisualStudio.Unity.Bridge.Configuration.GlobalConfiguration:get_SendConsoleToVisualStudio()
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.050] SyntaxTree.VisualStudio.Unity.Bridge.Configuration.ActiveConfiguration:get_SendConsoleToVisualStudio()
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.050] SyntaxTree.VisualStudio.Unity.Bridge.VisualStudioIntegration:OnLog(String, String, LogType)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.051] UnityEngine.Application:CallLogCallback(String, String, LogType, Boolean) (at C:\buildslave\unity\build\artifacts\generated\common\runtime\ApplicationBindings.gen.cs:564)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.051] UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.051] UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.052] UnityEngine.Logger:Log(LogType, Object)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.052] UnityEngine.Debug:LogWarning(Object)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.052] Bolt.Unit:RemoveInvalidDefaultValues(Boolean)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.052] Bolt.Unit:Define()
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.052] Bolt.Unit:Initialize()
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.052] Ludiq.GraphElementCollection`1:InsertItem(Int32, IUnit)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.052] System.Collections.ObjectModel.Collection`1:Add(IUnit) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.ObjectModel/Collection.cs:72)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.052] Ludiq.VariantCollection`2:Add(IGraphElement) (at C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Collections\VariantCollection.cs:45)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.053] Ludiq.MergedKeyedCollection`2:Add(IGraphElement) (at C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Collections\MergedKeyedCollection.cs:141)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.053] Ludiq.Graph:OnAfterDependenciesDeserialized()
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.054] Ludiq.Serialization:CheckIfDependenciesMet(ISerializationDepender) (at C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Serialization\Serialization.cs:227)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.055] Ludiq.Serialization:AwaitDependencies(ISerializationDepender) (at C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Serialization\Serialization.cs:196)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.055] Ludiq.Graph:OnAfterDeserialize()
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.055] Ludiq.FullSerializer.fsSerializationCallbackReceiverProcessor:OnAfterDeserialize(Type, Object) (at C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsISerializationCallbacks.cs:126)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.056] Ludiq.FullSerializer.fsSerializer:Invoke_OnAfterDeserialize(List`1, Type, Object) (at C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:1152)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.056] Ludiq.FullSerializer.fsSerializer:TryDeserialize(fsData, Type, Type, Object&) (at C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:637)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.057] Ludiq.FullSerializer.fsReflectedConverter:TryDeserialize(fsData, Object&, Type) (at C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\Converters\fsReflectedConverter.cs:97)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.057] Ludiq.FullSerializer.fsSerializer:InternalDeserialize_5_Converter(Type, fsData, Type, Object&) (at C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:861)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.058] Ludiq.FullSerializer.fsSerializer:InternalDeserialize_4_Cycles(Type, fsData, Type, Object&) (at C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:851)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.058] Ludiq.FullSerializer.fsSerializer:InternalDeserialize_3_Inheritance(Type, fsData, Type, Object&, List`1&) (at C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:826)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.058] Ludiq.FullSerializer.fsSerializer:InternalDeserialize_2_Version(Type, fsData, Type, Object&, List`1&) (at C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:730)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.059] Ludiq.FullSerializer.fsSerializer:InternalDeserialize_1_CycleReference(Type, fsData, Type, Object&, List`1&) (at C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:675)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.060] Ludiq.FullSerializer.fsSerializer:TryDeserialize(fsData, Type, Type, Object&) (at C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:628)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.060] Ludiq.Serialization:DeserializeJson(fsSerializer, String, Object&, Boolean) (at C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Serialization\Serialization.cs:158)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.061] Ludiq.Serialization:DeserializeInto(SerializationData, Object&, Boolean) (at C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Serialization\Serialization.cs:113)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.061] Ludiq.LudiqScriptableObject:UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize() (at C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Runtime\Unity\LudiqScriptableObject.cs:48)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.062] UnityEditor.AssetDatabase:LoadMainAssetAtPath(String)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.062] System.Linq.<CreateSelectIterator>c__Iterator10`2:MoveNext()
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.062] System.Linq.<CreateOfTypeIterator>c__IteratorC`1:MoveNext()
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.062] System.Linq.<CreateSelectManyIterator>c__Iterator12`2:MoveNext()
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.062] Ludiq.<FindAllProjectStubs>d__2:MoveNext() (at C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Editor\Platforms\AotPreBuilder.cs:95)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.063] System.Linq.<CreateDistinctIterator>c__Iterator3`1:MoveNext()
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.063] System.Linq.<CreateSelectIterator>c__Iterator10`2:MoveNext()
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.063] System.Collections.Generic.List`1:AddEnumerable(IEnumerable`1) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:128)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.063] System.Collections.Generic.List`1:.ctor(IEnumerable`1) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:65)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.064] System.Linq.Enumerable:ToArray(IEnumerable`1)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.064] System.Linq.QuickSort`1:.ctor(IEnumerable`1, SortContext`1)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.064] System.Linq.<Sort>c__Iterator21:MoveNext()
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.064] Ludiq.AotPreBuilder:GenerateStubScript(String, IEnumerable`1) (at C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Editor\Platforms\AotPreBuilder.cs:181)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.064] Ludiq.AotPreBuilder:GenerateStubScript(String) (at C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Editor\Platforms\AotPreBuilder.cs:66)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.064] Ludiq.AotPreBuilder:PreCloudBuild() (at C:\Users\Lazlo\Projects\Ludiq\Ludiq.Core\Editor\Platforms\AotPreBuilder.cs:244)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.065] <Execute>c__Iterator0:MoveNext() (at Assets\FuzzyCI\Custom\Editor\Scripts\UTBoltAOTBuild.cs:19)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.065] AncientLightStudios.uTomate.<ExecutePath>c__Iterator1:MoveNext() (at Assets\FuzzyCI\Common\uTomate\Editor\AutomationPlan\UTAutomationPlan.cs:139)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.065] AncientLightStudios.uTomate.<ExecutePath>c__Iterator1:MoveNext() (at Assets\FuzzyCI\Common\uTomate\Editor\AutomationPlan\UTAutomationPlan.cs:139)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.066] AncientLightStudios.uTomate.UTomateRunner:ContinueRunning() (at Assets\FuzzyCI\Common\uTomate\Editor\UTomateRunner.cs:185)
build	03-Jan-2018 11:57:48	[2018-01-03 11:57:56.066] UnityEditor.EditorApplication:Internal_CallUpdateFunctions() (at C:\buildslave\unity\build\Editor\Mono\EditorApplication.cs:127)
Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):

Duplicates 1

Under Review

Hm, good catch. I think Bolt is trying to output an error log that requires something that can't be known during serialization. I'll investigate.

Unity Bug

Just looked at the error, and that is actually not a Bolt related error. It's a bug in Visual Studio tools for Unity (SyntaxTree.VisualStudio.Unity). It has also been reported here. I would suggest creating an official bug report either on the Unity forums or via the Unity error reporter.

+1

I have submitted an official bug report, but haven't been able to reproduce the issue.

My educated guess would be to update Visual Studio to 2017. It might be an issue of VSTU 2015 and below.

The error is isolated though:

It appears that SyntaxTree.VisualStudio.Unity.Bridge tries to call API methods even if Unity is currently in serialization. This causes the standard "is not allowed during serialization" error. 

The API method in question is UnityEditor.EditorPrefs.GetBool. Apparently, the Visual Studio integration tries to read its configuration to determine its logging behaviour after any Debug.Log*(). However, this will cause errors if the thread is serializing.

The offending property getter appears to be:

SyntaxTree.VisualStudio.Unity.Bridge.Configuration.GlobalConfiguration:get_SendConsoleToVisualStudio()

This seems like a design issue in Unity; because Debug.Log calls are allowed during serialization (and multithreading), the Visual Studio integration should not rely on blocked API calls to determine its behaviour.