Skip to content

MessagePackGenerater (mpc.exe) generate invalid generic type formatter name, when use string key #1112

@gsino

Description

@gsino

environments:

  • Version used: 2.2.60
  • Runtime: .NET Core

Bug description

Generated formatter declaration is invalid, for generic type that marked as string key.

it is tringKeyFormatterTemplate.tt bug.
https://github.com/neuecc/MessagePack-CSharp/blob/d61346e6ba810c5019a6f3a01cbe3055ca15c7e3/src/MessagePack.GeneratorCore/Generator/StringKey/StringKeyFormatterTemplate.tt#L40

Isn't the correct code objInfo.GenericTypeParameters.Select(x => x.Name)?

Repro steps

Define generic type with [MessagePackObject(true)].

[MessagePackObject(true)]
public InventoryChangedValue<T>
{
    public T Value { get; set; }
}

And execute generate.

Expected behavior

public sealed class InventoryChangedValueFormatter<T> : global::MessagePack.Formatters.IMessagePackFormatter<global::MyNameSpace.InventoryChangedValue<T>>

Actual behavior

public sealed class InventoryChangedValueFormatter<MessagePackCompiler.CodeAnalysis.GenericTypeParameterInfo> : global::MessagePack.Formatters.IMessagePackFormatter<global::MyNameSpace.InventoryChangedValue<T>>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions