gkngkc / UnityStandaloneFileBrowser

A native file browser for unity standalone platforms
MIT License
2.08k stars 327 forks source link

IL1005 error on System.Windows.Forms.dll #145

Open BeboKhouja opened 4 weeks ago

BeboKhouja commented 4 weeks ago

I was building my Unity game for IL2CPP on Windows, when I got this error:

Mono.Linker.LinkerFatalErrorException: ILLink: error IL1005: System.Windows.Forms.XplatUIX11.SetDisplay(IntPtr): Error processing method

On the editor, it works fine.

Full log:

Build completed with a result of 'Failed' in 15 seconds (15419 ms) Building Library\Bee\artifacts\WinPlayerBuildProgram\ManagedStripped failed with output: C:\Program Files\Unity\Hub\Editor\2022.3.46f1\Editor\Data\il2cpp\build\deploy\UnityLinker.exe @Library\Bee\artifacts\rsp\4096928808207462379.rsp Fatal error in Unity CIL Linker Mono.Linker.LinkerFatalErrorException: ILLink: error IL1005: System.Windows.Forms.XplatUIX11.SetDisplay(IntPtr): Error processing method 'System.Windows.Forms.XplatUIX11.SetDisplay(IntPtr)' in assembly 'System.Windows.Forms.dll' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' at Unity.IL2CPP.Common.MissingMethodStubber.GetTypeModule(TypeReference type, IEnumerable`1 assemblies) at Unity.Linker.Steps.AddUnresolvedStubsStep.MarkAssemblyOfType(UnityLinkContext context, TypeReference type) at Unity.Linker.Steps.Marking.UnresolvedStubMarking.HandleUnresolvedType(TypeReference reference) at Unity.Linker.Steps.UnityMarkStep.HandleUnresolvedType(TypeReference reference) at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, IMemberDefinition sourceLocationMember) at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body) at Unity.Linker.Steps.UnityMarkStep.MarkMethodBody(MethodBody body) at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method, DependencyInfo& reason) at Unity.Linker.Steps.UnityMarkStep.ProcessMethod(MethodDefinition method, DependencyInfo& reason) at Mono.Linker.Steps.MarkStep.ProcessQueue() --- End of inner exception stack trace --- at Mono.Linker.Steps.MarkStep.ProcessQueue() at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue() at Mono.Linker.Steps.MarkStep.Process() at Unity.Linker.Steps.UnityMarkStep.Process(LinkContext context) at Unity.Linker.UnityPipeline.ProcessStep(LinkContext context, IStep step) at Mono.Linker.Pipeline.Process(LinkContext context) at Unity.Linker.UnityDriver.UnityRun(UnityLinkContext context, UnityPipeline p, LinkRequest linkerOptions, TinyProfiler2 tinyProfiler, ILogger customLogger) at Unity.Linker.UnityDriver.RunDriverWithoutErrorHandling(TinyProfiler2 tinyProfiler, ILogger customLogger) at Unity.Linker.UnityDriver.RunDriverWithoutErrorHandling() at Unity.Linker.UnityDriver.RunDriver() UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

I made sure everything was imported.

rainfallgames commented 3 weeks ago

I just fixed this in my project today.

I had to copy Mono.Posix and Mono.WebBrowser in to the plugins folder.

As an example, here's Mono.Posix: C:\Program Files\Unity\Hub\Editor\2022.3.49f1\Editor\Data\MonoBleedingEdge\lib\mono\gac\Mono.Posix\4.0.0.0__0738eb9f132ed756