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

Mono.ArgumentNullOrEmptyException resolving a member from FSharp.Core.dll #459

Closed
KirillOsenkov opened this issue Nov 3, 2017 · 2 comments

Comments

@KirillOsenkov
Copy link

KirillOsenkov commented Nov 3, 2017

Reference Mono.Cecil for .NET 4.0 and use this repro code:

using System;
using Mono.Cecil;

namespace CecilRepro
{
    class Program
    {
        static void Main(string[] args)
        {
            var filePath = @"C:\temp\FSharp.Core.dll";
            var assembly = AssemblyDefinition.ReadAssembly(filePath);

            foreach (var memberReference in assembly.MainModule.GetMemberReferences())
            {
                if (memberReference.FullName != "!1 !1[0...,0...]::Get(System.Int32,System.Int32)")
                {
                    continue;
                }

                try
                {
                    var resolved = memberReference.Resolve();
                    if (resolved == null)
                    {
                        Console.WriteLine("Resolved == null");
                    }
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine(ex.ToString());
                }
            }
        }
    }
}

Use this code to open https://www.dropbox.com/s/0gu1p4q5ojs60ic/FSharp.Core.dll?dl=0

Expected: shouldn't crash?

Actual:
Mono.ArgumentNullOrEmptyException occurred
Message=Argument null or empty
Parameter name: name
at Mono.Cecil.Mixin.CheckName(String name) in C:\cecil\Mono.Cecil\ModuleDefinition.cs:line 1187

 	Mono.Cecil.Mixin.CheckName Line 1187	C#	Symbols loaded.
 	Mono.Cecil.ModuleDefinition.GetType Line 680	C#	Symbols loaded.
 	Mono.Cecil.MetadataResolver.GetTypeDefinition Line 150	C#	Symbols loaded.
 	Mono.Cecil.MetadataResolver.GetType Line 124	C#	Symbols loaded.
 	Mono.Cecil.MetadataResolver.Resolve Line 105	C#	Symbols loaded.
 	Mono.Cecil.ModuleDefinition.Resolve Line 736	C#	Symbols loaded.
 	Mono.Cecil.TypeReference.Resolve Line 280	C#	Symbols loaded.
 	Mono.Cecil.MetadataResolver.GetTypeDefinition Line 152	C#	Symbols loaded.
 	Mono.Cecil.MetadataResolver.GetType Line 124	C#	Symbols loaded.
 	Mono.Cecil.MetadataResolver.Resolve Line 105	C#	Symbols loaded.
 	Mono.Cecil.MetadataResolver.Resolve Line 210	C#	Symbols loaded.
 	Mono.Cecil.ModuleDefinition.Resolve Line 731	C#	Symbols loaded.
 	Mono.Cecil.MethodReference.Resolve Line 178	C#	Symbols loaded.
 	Mono.Cecil.MethodReference.ResolveDefinition Line 169	C#	Symbols loaded.
 	Mono.Cecil.MemberReference.Resolve Line 97	C#	Symbols loaded.
>	CecilRepro.Program.Main Line 22	C#	Symbols loaded.
jbevain added a commit that referenced this issue Nov 3, 2017
@jbevain
Copy link
Owner

jbevain commented Nov 3, 2017

Thanks for reporting this!

@jbevain jbevain closed this as completed Nov 3, 2017
@KirillOsenkov
Copy link
Author

WOW you're fast!

jonpryor added a commit to jonpryor/java.interop that referenced this issue Dec 14, 2017
Preparation for d15-6 branching.

Context: jbevain/cecil#425
Context: jbevain/cecil#459
Context: jbevain/cecil#461
Context: jbevain/cecil#462
jonpryor added a commit to dotnet/java-interop that referenced this issue Dec 14, 2017
Preparation for d15-6 branching.

Context: jbevain/cecil#425
Context: jbevain/cecil#459
Context: jbevain/cecil#461
Context: jbevain/cecil#462
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants