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

mpc fix, generate collect class name in nested enum. #843

Merged
merged 1 commit into from
Mar 18, 2020
Merged

Conversation

neuecc
Copy link
Member

@neuecc neuecc commented Mar 17, 2020

Currently mpc generate duplicate class name in nested enum.

public class Foo1
{
    public Bar Id { get; set; }

    public enum Bar
    {
        A
    }
}


public class Foo2
{
    public Bar Id { get; set; }

    public enum Bar
    {
        A
    }
}

// generate

class BarFormatter : IMessagePackFormatter<Foo1.Bar>
class BarFormatter : IMessagePackFormatter<Foo2.Bar>

I've modified generated type name from type.Name to type.ToDisplayString(ShortTypeNameFormat).Replace(".", "_").
It will generate

class Foo1_BarFormatter : IMessagePackFormatter<Foo1.Bar>
class Foo2_BarFormatter : IMessagePackFormatter<Foo2.Bar>

so solved.

Also csproj collector load duplicate version metadata such as MessagePack.dll, Version 2.0.90 and MessagePack.dll, Version 2.0.80.
It will fail GetTypeByMetadataName("MessagePack.MessagePackObjectAttribute").
This PR includes there fix to distinc by file name.

@neuecc neuecc requested a review from AArnott March 17, 2020 11:59
@neuecc neuecc merged commit bba872d into master Mar 18, 2020
@neuecc neuecc deleted the mpc-fix branch March 18, 2020 00:46
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

Successfully merging this pull request may close these issues.

None yet

2 participants