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

Assembly.FullName is not including Culture=... part #458

Closed
DiFFoZ opened this issue Jun 23, 2023 · 1 comment
Closed

Assembly.FullName is not including Culture=... part #458

DiFFoZ opened this issue Jun 23, 2023 · 1 comment
Labels
bug dotnet Issues related to AsmResolver.DotNet
Milestone

Comments

@DiFFoZ
Copy link

DiFFoZ commented Jun 23, 2023

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

@DiFFoZ DiFFoZ added the bug label Jun 23, 2023
@Washi1337 Washi1337 added the dotnet Issues related to AsmResolver.DotNet label Jun 24, 2023
@Washi1337 Washi1337 added this to the 5.4.0 milestone Jun 24, 2023
@Washi1337
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug dotnet Issues related to AsmResolver.DotNet
Projects
None yet
Development

No branches or pull requests

2 participants