0
Fixed

TypeInitializationException (obfuscated assembly?)

Youngmin Kim 5 months ago updated by Andrei Kopysov 2 weeks ago 8 1 duplicate

I purchased to use the bolts.

However, there is an error during installation of an existing project.

The problem does not occur when installing to a new project.
The error is caused by:I purchased to use the bolts.

However, there is an error during installation of an existing project.

The problem does not occur when installing to a new project.
The error is caused by:

System.TypeInitializationException: The type initializer for 'Ludiq.Codebase' threw an exception. ---> 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 <567df3e0919241ba98db88bec4c6696f>:0 
  at System.Reflection.Assembly.IsDefined (System.Type attributeType, System.Boolean inherit) [0x00000] in <567df3e0919241ba98db88bec4c6696f>:0 
  at System.Attribute.IsDefined (System.Reflection.Assembly element, System.Type attributeType, System.Boolean inherit) [0x0005c] in <567df3e0919241ba98db88bec4c6696f>:0 
  at System.Attribute.IsDefined (System.Reflection.Assembly element, System.Type attributeType) [0x00000] in <567df3e0919241ba98db88bec4c6696f>:0 
  at Ludiq.Codebase.IsEditorAssembly (System.Reflection.Assembly assembly) [0x00000] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Editor\Reflection\Codebase.cs:307 
  at Ludiq.Codebase.IsEditorDependentAssembly (System.Reflection.Assembly assembly) [0x00000] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Editor\Reflection\Codebase.cs:325 
  at Ludiq.Codebase.IsRuntimeAssembly (System.Reflection.Assembly assembly) [0x00000] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Editor\Reflection\Codebase.cs:320 
  at Ludiq.Codebase..cctor () [0x000a4] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Editor\Reflection\Codebase.cs:37 
   --- End of inner exception stack trace ---
  at Ludiq.PluginContainer.Initialize () [0x00011] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Editor\Plugins\PluginContainer.cs:74 
  at Ludiq.PluginContainer..cctor () [0x0000a] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Editor\Plugins\PluginContainer.cs:17 
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes(Type[]) (at /Users/builduser/buildslave/unity/build/Editor/Mono/EditorAssemblies.cs:112)

MissingMethodException: void UnityEngine.UnityAPICompatibilityVersionAttribute..ctor(string,string[]) System.MonoCustomAttrs.IsDefined (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inherit) (at <567df3e0919241ba98db88bec4c6696f>:0) System.Reflection.Assembly.IsDefined (System.Type attributeType, System.Boolean inherit) (at <567df3e0919241ba98db88bec4c6696f>:0) System.Attribute.IsDefined (System.Reflection.Assembly element, System.Type attributeType, System.Boolean inherit) (at <567df3e0919241ba98db88bec4c6696f>:0) System.Attribute.IsDefined (System.Reflection.Assembly element, System.Type attributeType) (at <567df3e0919241ba98db88bec4c6696f>: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.EditorApplicationUtility.OnHierarchyChange () (at C:/Users/lazlo/Projects/Bolt1/Package/Ludiq.Core/Editor/Utilities/EditorApplicationUtility.cs:152) UnityEditor.EditorApplication.Internal_CallHierarchyHasChanged () (at /Users/builduser/buildslave/unity/build/Editor/Mono/EditorApplication.cs:330

Bolt Version:
1.4.10
Unity Version:
2019.2.17f1 Personal
Platform(s):
macOS Editor
Scripting Backend:
IL2CPP
.NET Version (API Compatibility Level):
.NET 4.x

Duplicates 1

Hello Youngmin Kim,

I'm sorry you're experiencing this issue and I apologize for the late reply on this. You should hear back on this from the lead developer soon.

Best,

Hasan from Ludiq

Working on Fix

Hi Youngmin,

Thanks for the report. This reminds me of a Peek bug I saw recently related to obfuscated assemblies in your project (you probably use a third-party plugin that the developer has obfuscated). The fix was to improve the error recovery for assemblies that fail to parse. I'll make sure to port it to Bolt in the next version.

Fixed (Unreleased)

Hi Youngmin,

This will be fixed in the next version. A warning will be shown about the assembly that failed to load, but Bolt will keep working.

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>
Escalated

Hm I couldn't find the commit for this when preparing the changelog for B2A7, I'll have to make sure the fix actually was applied.

Fixed (Unreleased)

Ah, so this was indeed fixed for the 1.4 branch. I'm also porting it to the 2.0 branch.

I have a warning about "UnityEditor.Advertisements" with latest Bolt and Unity 2019.3.13f

Are there any way to skip that assembly and to have no warning? I don't like useless warnings because later I can miss something important in the console because of that.