0
Fixed (Unreleased)

Bolt and Unity Ads higher than 3.2.0 does not let bolt initialize anymore

Kalrek 6 days ago updated by Lazlo Bonin (Lead Developer) yesterday at 12:56 p.m. 1

I cannot get bolt and a higher Unity Ads version than 3.2.0 to work

Reproduce: install Bolt | update Unity Ads Plugin via the Package Manager to 3.3.0 (minimum version for publication/update at apple store) or higher in the Editor

After that the following error is thrown when for example trying open the bolt setup wizard

MissingMethodException: void UnityEngine.UnityAPICompatibilityVersionAttribute..ctor(string,string[])
System.MonoCustomAttrs.IsDefined (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inherit) (at :0)
System.Reflection.Assembly.IsDefined (System.Type attributeType, System.Boolean inherit) (at :0)
System.Attribute.IsDefined (System.Reflection.Assembly element, System.Type attributeType, System.Boolean inherit) (at :0)
System.Attribute.IsDefined (System.Reflection.Assembly element, System.Type attributeType) (at :0)
Ludiq.Codebase.IsEditorAssembly (System.Reflection.Assembly assembly) (at C:/Users/lazlo/Projects/Bolt1/Package/Ludiq.Core/Editor/Reflection/Codebase.cs:307)
Ludiq.Codebase.IsEditorDependentAssembly (System.Reflection.Assembly assembly) (at C:/Users/lazlo/Projects/Bolt1/Package/Ludiq.Core/Editor/Reflection/Codebase.cs:325)
Ludiq.Codebase.IsRuntimeAssembly (System.Reflection.Assembly assembly) (at C:/Users/lazlo/Projects/Bolt1/Package/Ludiq.Core/Editor/Reflection/Codebase.cs:320)
Ludiq.Codebase..cctor () (at C:/Users/lazlo/Projects/Bolt1/Package/Ludiq.Core/Editor/Reflection/Codebase.cs:37)
Rethrow as TypeInitializationException: The type initializer for 'Ludiq.Codebase' threw an exception.
Ludiq.PluginContainer.Initialize () (at C:/Users/lazlo/Projects/Bolt1/Package/Ludiq.Core/Editor/Plugins/PluginContainer.cs:74)
Ludiq.PluginContainer..cctor () (at C:/Users/lazlo/Projects/Bolt1/Package/Ludiq.Core/Editor/Plugins/PluginContainer.cs:17)
Rethrow as TypeInitializationException: The type initializer for 'Ludiq.PluginContainer' threw an exception.
Ludiq.UpdateWizard..cctor () (at C:/Users/lazlo/Projects/Bolt1/Package/Ludiq.Core/Editor/Windows/UpdateWizard/UpdateWizard.cs:77)
Rethrow as TypeInitializationException: The type initializer for 'Ludiq.UpdateWizard' threw an exception.
Ludiq.LudiqProduct.HookUpdateWizard () (at C:/Users/lazlo/Projects/Bolt1/Package/Ludiq.Core/Editor/Product/LudiqProduct.cs:68)

Bolt Version:
1.4.10
Unity Version:
2018.4.13f1 | 2018.4.15f1
Platform(s):
Android
Scripting Backend:
IL2CPP
.NET Version (API Compatibility Level):
.NET Standard 2.0
Fixed (Unreleased)

Hi Kalrek,

Thanks for the report. 

It seems like the 3.x version of the Unity Ads package has a corrupt assembly somehow. Often, this is due to obfuscation. It's probably a good idea to report this error to Unity.

However, in the mean time, I've made a fix in Bolt that will let us recover from the error and just show a warning about the assembly that failed to load. 

You might be unable to use some Unity Ads nodes in Bolt as a result of this however. I recommend reporting the issue to Unity. Here is the full warning:

Failed to analyze assembly 'UnityEditor.Advertisements, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null':
System.MissingMethodException: void UnityEngine.UnityAPICompatibilityVersionAttribute..ctor(string,string[])
  at (wrapper managed-to-native) System.MonoCustomAttrs.IsDefinedInternal(System.Reflection.ICustomAttributeProvider,System.Type)
  at System.MonoCustomAttrs.IsDefined (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inherit) [0x00027] in <e1319b7195c343e79b385cd3aa43f5dc>:0 
  at System.Reflection.Assembly.IsDefined (System.Type attributeType, System.Boolean inherit) [0x00000] in <e1319b7195c343e79b385cd3aa43f5dc>:0 
  at System.Attribute.IsDefined (System.Reflection.Assembly element, System.Type attributeType, System.Boolean inherit) [0x0005c] in <e1319b7195c343e79b385cd3aa43f5dc>:0 
  at System.Attribute.IsDefined (System.Reflection.Assembly element, System.Type attributeType) [0x00000] in <e1319b7195c343e79b385cd3aa43f5dc>:0 
  at Ludiq.Codebase.IsEditorAssembly (System.Reflection.Assembly assembly) [0x00001] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Editor\Reflection\Codebase.cs:319 
  at Ludiq.Codebase.IsEditorDependentAssembly (System.Reflection.Assembly assembly) [0x00001] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Editor\Reflection\Codebase.cs:337 
  at Ludiq.Codebase.IsRuntimeAssembly (System.Reflection.Assembly assembly) [0x00001] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Editor\Reflection\Codebase.cs:332 
  at Ludiq.Codebase..cctor () [0x000bc] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Editor\Reflection\Codebase.cs:44 
UnityEngine.Debug:LogWarning(Object)
Ludiq.Codebase:.cctor() (at C:/Users/lazlo/Projects/Bolt1/Package/Ludiq.Core/Editor/Reflection/Codebase.cs:109)
Ludiq.PluginContainer:Initialize() (at C:/Users/lazlo/Projects/Bolt1/Package/Ludiq.Core/Editor/Plugins/PluginContainer.cs:74)
Ludiq.PluginContainer:.cctor() (at C:/Users/lazlo/Projects/Bolt1/Package/Ludiq.Core/Editor/Plugins/PluginContainer.cs:17)
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes() (at C:/buildslave/unity/build/Editor/Mono/EditorAssemblies.cs:168)
</e1319b7195c343e79b385cd3aa43f5dc></e1319b7195c343e79b385cd3aa43f5dc></e1319b7195c343e79b385cd3aa43f5dc></e1319b7195c343e79b385cd3aa43f5dc>