Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.ArgumentNullException when importing corlib reference #118

Closed
kenn1ld opened this issue Mar 11, 2024 · 4 comments
Closed

System.ArgumentNullException when importing corlib reference #118

kenn1ld opened this issue Mar 11, 2024 · 4 comments
Labels
bug Something isn't working generation Related to assembly generation
Milestone

Comments

@kenn1ld
Copy link

kenn1ld commented Mar 11, 2024

This is the command used:
il2cppinterop generate --input "C:\Users\default\master\dlls\DoThisWork\cpp2il_out" --output "C:\Users\default\master\dlls\DoThisWork\cpp2il_out\yes" --unity "C:\Program Files\Unity\Hub\Editor\2019.4.40f1\Editor\Data\Managed\UnityEngine" --game-assembly "C:\Program Files (x86)\Steam\steamapps\common\Game\GameAssembly.dll"

And yes, the game uses 2019.4.40f1

Here is the output:

warn: Il2CppInterop[0] Opt-In prefixing is obsolete and will be removed in a future version.
info: Il2CppInterop[0] Reading assemblies...
info: Il2CppInterop[0] Done in 00:00:00.0412540
info: Il2CppInterop[0] Reading unity assemblies...
info: Il2CppInterop[0] Done in 00:00:05.2000063
info: Il2CppInterop[0] Creating rewrite assemblies...
info: Il2CppInterop[0] Done in 00:00:00.0194276
info: Il2CppInterop[0] Computing renames...
info: Il2CppInterop[0] Done in 00:00:00.0364797
info: Il2CppInterop[0] Creating typedefs...
info: Il2CppInterop[0] Done in 00:00:00.0699615
info: Il2CppInterop[0] Computing struct blittability...
info: Il2CppInterop[0] Done in 00:00:00.0621876
info: Il2CppInterop[0] Filling typedefs...
info: Il2CppInterop[0] Done in 00:00:00.0594503
info: Il2CppInterop[0] Filling generic constraints...
info: Il2CppInterop[0] Done in 00:00:00.0051644
info: Il2CppInterop[0] Creating members...
info: Il2CppInterop[0] Done in 00:00:01.8102791
info: Il2CppInterop[0] Scanning method cross-references...
info: Il2CppInterop[0] Done in 00:00:01.2528805
info: Il2CppInterop[0] Finalizing method declarations...
info: Il2CppInterop[0] Done in 00:00:02.0265946
info: Il2CppInterop[0] 108 total potentially dead methods
info: Il2CppInterop[0] Filling method parameters...
info: Il2CppInterop[0] Done in 00:00:00.4719411
info: Il2CppInterop[0] Creating static constructors...
info: Il2CppInterop[0] Done in 00:00:00.7042942
info: Il2CppInterop[0] Creating value type fields...
info: Il2CppInterop[0] Done in 00:00:00.0667037
info: Il2CppInterop[0] Creating enums...
info: Il2CppInterop[0] Done in 00:00:00.0517157
info: Il2CppInterop[0] Creating IntPtr constructors...
info: Il2CppInterop[0] Done in 00:00:00.2494994
info: Il2CppInterop[0] Creating non-blittable struct constructors...
info: Il2CppInterop[0] Done in 00:00:00.0170153
info: Il2CppInterop[0] Creating generic method static constructors...
info: Il2CppInterop[0] Done in 00:00:00.0488670
info: Il2CppInterop[0] Creating field accessors...
info: Il2CppInterop[0] Done in 00:00:02.0000869
info: Il2CppInterop[0] Filling methods...
info: Il2CppInterop[0] Done in 00:00:03.2219574
info: Il2CppInterop[0] Generating implicit conversions...
info: Il2CppInterop[0] Done in 00:00:00.0308845
info: Il2CppInterop[0] Creating properties...
info: Il2CppInterop[0] Done in 00:00:00.1127225
info: Il2CppInterop[0] Unstripping types...
info: Il2CppInterop[0] Done in 00:00:00.0431329
info: Il2CppInterop[0] Unstripping fields...
info: Il2CppInterop[0] Restored 1063 fields
info: Il2CppInterop[0] Failed to restore 14 fields
info: Il2CppInterop[0] Done in 00:00:00.0428045
info: Il2CppInterop[0] Unstripping methods...
info: Il2CppInterop[0] Done in 00:00:00.0176294
Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.ArgumentNullException: Value cannot be null. (Parameter 'type')
   at Mono.Cecil.Mixin.CheckType(Object type)
   at Il2CppInterop.Generator.Utils.CorlibReferences.ImportCorlibReference(ModuleDefinition module, String namespace, String type) in /home/runner/work/Il2CppInterop/Il2CppInterop/Il2CppInterop.Generator/Utils/CorlibReferences.cs:line 20
   at Il2CppInterop.Generator.Passes.Pass80UnstripMethods.ResolveTypeInNewAssembliesRaw(RewriteGlobalContext context, TypeReference unityType, RuntimeAssemblyReferences imports) in /home/runner/work/Il2CppInterop/Il2CppInterop/Il2CppInterop.Generator/Passes/Pass80UnstripMethods.cs:line 210
   at Il2CppInterop.Generator.Passes.Pass80UnstripMethods.DoPass(RewriteGlobalContext context) in /home/runner/work/Il2CppInterop/Il2CppInterop/Il2CppInterop.Generator/Passes/Pass80UnstripMethods.cs:line 52
   at Il2CppInterop.Generator.Runners.InteropAssemblyGeneratorRunner.Run(GeneratorOptions options) in /home/runner/work/Il2CppInterop/Il2CppInterop/Il2CppInterop.Generator/Runners/InteropAssemblyGenerator.cs:line 173
   at Il2CppInterop.Generator.Il2CppInteropGenerator.Start() in /home/runner/work/Il2CppInterop/Il2CppInterop/Il2CppInterop.Generator/Il2CppInteropGenerator.cs:line 30
   at Il2CppInterop.Generator.Il2CppInteropGenerator.Run() in /home/runner/work/Il2CppInterop/Il2CppInterop/Il2CppInterop.Generator/Il2CppInteropGenerator.cs:line 47
   at Program.<>c.<<Main>$>b__0_0(GenerateCommandOptions opts) in /home/runner/work/Il2CppInterop/Il2CppInterop/Il2CppInterop.CLI/Program.cs:line 43
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at System.Delegate.DynamicInvoke(Object[] args)
   at System.CommandLine.NamingConventionBinder.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass18_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass13_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass20_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__19_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__6_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass9_0.<<UseExceptionHandler>b__0>d.MoveNext()
@chairclr
Copy link

Experiencing pretty much the exact same issue.

@ds5678
Copy link
Collaborator

ds5678 commented Jul 14, 2024

This might be fixed by #124

@ds5678 ds5678 changed the title ---> System.ArgumentNullException: Value cannot be null. (Parameter 'type') System.ArgumentNullException when importing corlib reference Jul 15, 2024
@ds5678 ds5678 added bug Something isn't working generation Related to assembly generation labels Jul 15, 2024
@ds5678
Copy link
Collaborator

ds5678 commented Sep 8, 2024

@kenn1ld @chairclr are you still experiencing the issue? #124 has been merged.

@ds5678 ds5678 added this to the 1.5.0 milestone Sep 9, 2024
@ds5678
Copy link
Collaborator

ds5678 commented Sep 9, 2024

If this has not been resolved, feel free to reopen it.

@ds5678 ds5678 closed this as completed Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working generation Related to assembly generation
Projects
None yet
Development

No branches or pull requests

3 participants