Cysharp / MemoryPack

Zero encoding extreme performance binary serializer for C# and Unity.
MIT License
3.01k stars 182 forks source link

1.20.2 breaks enum property initialization when enum is declared in another project #257

Closed afilatov-st closed 4 months ago

afilatov-st commented 4 months ago

Hi, I have 2 projects A and B, A refers to B. B declares a enum:

namespace MemoryPack.Tests.Aux.Models;

public enum ExternalEnum
{
    A,
    B
}

A is using it:

namespace MemoryPack.Tests.Models
{
    [MemoryPackable]
    public partial class WithEnum
    {
        public ExternalEnum MyProperty { get; set; } = ExternalEnum.A;
    }
}

compilation of such projects fail with error

  The name 'ExternalEnum' does not exist in the current context

I created https://github.com/Cysharp/MemoryPack/pull/258 for illustration.

hadashiA commented 4 months ago

Sorry, there was a problem with the enum, fixed in #260