2
\$\begingroup\$

I'm using unity 5.2.2, and cannot build my project to WebGL. I have 3 DLLs in my project, all of which are built using .Net 3.5 and below. (System.Drawing.dll, Newtonsoft.Json, and a custom version of Libnoise-unity)

Here is the error I'm getting:

Failed running C:\Program Files\Unity\Editor\Data\Tools/UnusedByteCodeStripper2/UnusedBytecodeStripper2.exe -out "D:\Documents\UnityProjects\WarWorldInfinity\Temp\StagingArea\Data\Managed\tempStrip" -l none -c link -x "C:\Program Files\Unity\Editor\Data\Tools\native_link.xml" -f "C:\Program Files\Unity\Editor\Data\il2cpp\LinkerDescriptors" -x "D:\Documents\UnityProjects\WarWorldInfinity/Temp/StagingArea/Data/methods_pointedto_by_uievents.xml" -d "D:\Documents\UnityProjects\WarWorldInfinity\Temp\StagingArea\Data\Managed" -a "D:\Documents\UnityProjects\WarWorldInfinity\Temp\StagingArea\Data\Managed\Assembly-CSharp.dll" -a "D:\Documents\UnityProjects\WarWorldInfinity\Temp\StagingArea\Data\Managed\UnityEngine.UI.dll"

stdout: Fatal error in Mono CIL Linker System.NullReferenceException: Object reference not set to an instance of an object at UnusedBytecodeStripper2.ResolveFromPreserveAttribute.IsPreserveAttribute (Mono.Cecil.TypeReference arg) [0x00000] in :0 at UnusedBytecodeStripper2.ResolveFromPreserveAttribute.m_0 (Mono.Cecil.CustomAttribute c) [0x00000] in :0 at System.Linq.Enumerable.Any[CustomAttribute] (IEnumerable1 source, System.Func2 predicate) [0x00000] in :0 at UnusedBytecodeStripper2.ResolveFromPreserveAttribute.HasPreserveAttribute (ICustomAttributeProvider type) [0x00000] in :0 at System.Linq.Enumerable+c_Iterator1E1[Mono.Cecil.PropertyDefinition].MoveNext () [0x00000] in :0 at UnusedBytecodeStripper2.ResolveStep.MarkProperties (Mono.Linker.LinkContext context, IEnumerable1 properties) [0x00000] in :0 at UnusedBytecodeStripper2.ResolveFromPreserveAttribute.ProcessType (Mono.Cecil.TypeDefinition type, Mono.Linker.LinkContext context, Boolean assemblyHasPreserveAttribute) [0x00000] in :0 at UnusedBytecodeStripper2.ResolveFromPreserveAttribute.Process (Mono.Linker.LinkContext context) [0x00000] in :0 at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x00000] in :0 at Mono.Linker.Driver.Run () [0x00000] in :0 at Mono.Linker.Driver.RunDriver (Mono.Linker.Driver driver) [0x00000] in :0 stderr:

UnityEngine.Debug:LogError(Object) UnityEditorInternal.Runner:RunManagedProgram(String, String, String, CompilerOutputParserBase) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:66) UnityEditorInternal.AssemblyStripper:RunAssemblyLinker(IEnumerable1, String&, String&, String, String) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:192) UnityEditorInternal.AssemblyStripper:StripAssembliesTo(String, String, String&, String&, String, String, IEnumerable1) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:185) UnityEditorInternal.AssemblyStripper:Strip(String, String, String&, String&, String, String, IEnumerable1) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:136) UnityEditorInternal.AssemblyStripper:Strip(String[], String[], String, String, String&, String&, String, String, IEnumerable1) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:121) UnityEditorInternal.IL2CPPBuilder:RunAssemblyStripper(IEnumerable, String, String[], String[], String) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:444) UnityEditorInternal.IL2CPPBuilder:StripAssemblies(IEnumerable1, String) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:417) UnityEditorInternal.IL2CPPBuilder:Run() (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:291) UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, IIl2CppPlatformProvider, Action1, RuntimeClassRegistry) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:218) UnityEditor.PostprocessBuildPlayer:Postprocess(BuildTarget, String, String, String, Int32, Int32, String, String, BuildOptions, RuntimeClassRegistry)

\$\endgroup\$
  • \$\begingroup\$ You have some errors in your code. Need to fix them before attempting to generate build. \$\endgroup\$ – SanSolo Nov 4 '15 at 17:07
1
\$\begingroup\$

More than likely you are trying to build with a featureset that is not yet compatible with WebGL builds.

For example, if you try to add a Networking component and build to WebGL, you will get that same error about UnusedByteCodeStripper2.

\$\endgroup\$
  • 1
    \$\begingroup\$ Thanks, Unity. That is an amazingly useful way to signal to a developer what their mistake is. </sarcasm> \$\endgroup\$ – Sean Middleditch Nov 4 '15 at 17:39
  • \$\begingroup\$ Heh, well to Unity's defense the WebGL build is still not ready for prime time. You should expect problems at this point in time. \$\endgroup\$ – jgallant Nov 4 '15 at 17:43
  • \$\begingroup\$ Well I'm using the System.Net UDP classes. \$\endgroup\$ – Jon Rurka Nov 4 '15 at 23:46
0
\$\begingroup\$

It was the System.Drawing reference in Libnoise that was causing it to fail.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.