Washi1337/AsmResolver

`Assembly.FullName` is not including `Culture=...` part

Closed this issue · 1 comments

DiFFoZ commented

AsmResolver Version

5.3.0

.NET Version

.NET Framework 4.6.1

Operating System

Windows

Describe the Bug

From migrating from dnlib to AsmResolver I noticed that Assembly.FullName is not including Culture= part.

How To Reproduce

Read .dll file as bytes and try the sample code below:

public static void TestFullName(byte[] assemblyData)
{
    string? dnLibFullName;
    {
        using var module = ModuleDefMD.Load(assemblyData, new ModuleContext());
        dnLibFullName = module.Assembly.FullName;
    }

    string? asmResolverFullName;
    {
        var module = ModuleDefinition.FromBytes(assemblyData);
        asmResolverFullName = module.Assembly!.FullName;
    }

    string? assemblyNameFullName;
    {
        var assembly = Assembly.Load(assemblyData);
        assemblyNameFullName = assembly.GetName().FullName;
    }

    // "System.Security.Principal.Windows, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Console.WriteLine(dnLibFullName);
    // "System.Security.Principal.Windows, Version=4.1.3.0, PublicKeyToken=b03f5f7f11d50a3a"
    Console.WriteLine(asmResolverFullName);
    // "System.Security.Principal.Windows, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Console.WriteLine(assemblyNameFullName);

    if (dnLibFullName != asmResolverFullName)
    {
        throw new Exception("Full name is not equals!");
    }
}

Expected Behavior

The sample code doesn't throw the exception

Actual Behavior

The sample code throws the exception

Additional Context

No response

Thanks for the catch. This is implemented in 9155d46, and will be present in 5.4.0.