- Home /
IL2CPP throws null exception when compiling .dll plugin for WebGL
Currently, the program I'm working on doesn't have issues when compiling for Windows. When I attempt to compile for WebGL, I get the following error.
stdout:
IL2CPP error for type 'X4vckRISblwYfhcLu1.yMs8kGHnxK8u8PsnAJ' in assembly 'C:\Users\username\Documents\GitHub\Unity_Projects\ProjectName\Temp\StagingArea\Data\Managed\Core.dll'
Additional information: Exception has been thrown by the target of an invocation.
il2cpp.exe didn't catch exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Mono.Cecil.GenericInstanceType..ctor(TypeReference type)
at Unity.IL2CPP.GenericSharing.GenericSharingAnalysis.GetSharedType(TypeReference type)
at Unity.IL2CPP.GenericsCollection.GenericContextAwareVisitor.ProcessGenericType(GenericInstanceType type, InflatedCollectionCollector generics, GenericInstanceMethod contextMethod)
at Unity.IL2CPP.GenericsCollection.GenericContextFreeVisitor.ProcessCustomAttributeTypeReferenceRecursive(TypeReference typeReference)
at Unity.IL2CPP.GenericsCollection.GenericContextFreeVisitor.ProcessCustomAttributeArgument(CustomAttributeArgument customAttributeArgument)
at Unity.IL2CPP.GenericsCollection.GenericContextFreeVisitor.ProcessCustomAttributeArgument(CustomAttributeArgument customAttributeArgument)
at Unity.IL2CPP.GenericsCollection.GenericContextFreeVisitor.Visit(CustomAttributeArgument customAttributeArgument, Context context)
at Unity.Cecil.Visitor.Visitor.Visit(CustomAttribute customAttribute, Context context)
at Unity.Cecil.Visitor.Visitor.Visit(FieldDefinition fieldDefinition, Context context)
at Unity.Cecil.Visitor.Visitor.Visit(TypeDefinition typeDefinition, Context context)
at Unity.Cecil.Visitor.Visitor.Visit(ModuleDefinition moduleDefinition, Context context)
at Unity.Cecil.Visitor.Visitor.Visit(AssemblyDefinition assemblyDefinition, Context context)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Unity.Cecil.Visitor.Visitor.Visit[T](T node, Context context)
at Unity.IL2CPP.GenericsCollection.GenericsCollector.CollectPerAssembly(AssemblyDefinition assembly)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at Unity.IL2CPP.GenericsCollection.GenericsCollector.MergeCollections(IEnumerable`1 collections)
at Unity.IL2CPP.AssemblyConverter.Apply()
at Unity.IL2CPP.AssemblyConverter.ConvertAssemblies(IEnumerable`1 assemblyDirectories, IEnumerable`1 explicitAssemblies, NPath outputDir, NPath dataFolder, NPath symbolsFolder, NPath executableAssembiesFolder, NPath monoLibFolder, NPath monoEtcFolder, NPath[] searchDirectories, String entryAssemblyName, NPath[] extraTypesFiles)
at il2cpp.Program.DoRun(String[] args)
at il2cpp.Program.Run(String[] args)
at il2cpp.Program.Main(String[] args)
stderr:
Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Mono.Cecil.GenericInstanceType..ctor(TypeReference type)
at Unity.IL2CPP.GenericSharing.GenericSharingAnalysis.GetSharedType(TypeReference type)
at Unity.IL2CPP.GenericsCollection.GenericContextAwareVisitor.ProcessGenericType(GenericInstanceType type, InflatedCollectionCollector generics, GenericInstanceMethod contextMethod)
at Unity.IL2CPP.GenericsCollection.GenericContextFreeVisitor.ProcessCustomAttributeTypeReferenceRecursive(TypeReference typeReference)
at Unity.IL2CPP.GenericsCollection.GenericContextFreeVisitor.ProcessCustomAttributeArgument(CustomAttributeArgument customAttributeArgument)
at Unity.IL2CPP.GenericsCollection.GenericContextFreeVisitor.ProcessCustomAttributeArgument(CustomAttributeArgument customAttributeArgument)
at Unity.IL2CPP.GenericsCollection.GenericContextFreeVisitor.Visit(CustomAttributeArgument customAttributeArgument, Context context)
at Unity.Cecil.Visitor.Visitor.Visit(CustomAttribute customAttribute, Context context)
at Unity.Cecil.Visitor.Visitor.Visit(FieldDefinition fieldDefinition, Context context)
at Unity.Cecil.Visitor.Visitor.Visit(TypeDefinition typeDefinition, Context context)
at Unity.Cecil.Visitor.Visitor.Visit(ModuleDefinition moduleDefinition, Context context)
at Unity.Cecil.Visitor.Visitor.Visit(AssemblyDefinition assemblyDefinition, Context context)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Unity.Cecil.Visitor.Visitor.Visit[T](T node, Context context)
at Unity.IL2CPP.GenericsCollection.GenericsCollector.CollectPerAssembly(AssemblyDefinition assembly)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at Unity.IL2CPP.GenericsCollection.GenericsCollector.MergeCollections(IEnumerable`1 collections)
at Unity.IL2CPP.AssemblyConverter.Apply()
at Unity.IL2CPP.AssemblyConverter.ConvertAssemblies(IEnumerable`1 assemblyDirectories, IEnumerable`1 explicitAssemblies, NPath outputDir, NPath dataFolder, NPath symbolsFolder, NPath executableAssembiesFolder, NPath monoLibFolder, NPath monoEtcFolder, NPath[] searchDirectories, String entryAssemblyName, NPath[] extraTypesFiles)
at il2cpp.Program.DoRun(String[] args)
at il2cpp.Program.Run(String[] args)
at il2cpp.Program.Main(String[] args)
It appears to be caused by IL2CPP attempting to compile the .dll plugin. Why would it cause a null exception when compiling for WebGL but not when compiling for Windows? Has anyone had an issue similar to this?
This looks like either a bug in IL2CPP, or the Core.dll assembly has some invalid IL code. Can you submit a bug report so that we can investigate more?
Is there a way to manually submit a bug like an email address to send it to? The Unity Bug Reporter keeps ti$$anonymous$$g out, probably due my proxy server.
I don't believe that is possible, sorry. $$anonymous$$aybe try submitting the bug report without a project. You should get an email when the bug report is submitted. Just reply to that email with the project attached, and we will see it.
Your answer
![](https://koobas.hobune.stream/wayback/20220612201543im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Failed Running UnityLinker.exe 1 Answer
change Scripting Backend from default to IL2CPP 3 Answers
Can one use a .NET library in a WebGL build? 1 Answer
WebGL will not build, gets stuck at IL2CPP or asm.js, even with fresh Unity install and empty scene. 3 Answers
Unable to build code for WEBGL platform, il2cpp.exe error 1 Answer