You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using System;using System.Threading;using MemoryPack;
Console.WriteLine(MemoryPackSerializer.Serialize(new Test()).Length);publicabstractclassTestBase{publicintNumber= Interlocked.Increment(ref LastNumber);privatestaticintLastNumber;}[MemoryPackable]publicpartialclassTest:TestBase{}
However, it fails in 1.20.0 - 1.20.4 with the following errors:
CS0122: 'TestBase.LastNumber' is inaccessible due to its protection level
MemoryPack.Generator\MemoryPack.Generator.MemoryPackGenerator\Test.MemoryPackFormatter.g.cs 117
CS0103: The name 'Interlocked' does not exist in the current context
MemoryPack.Generator\MemoryPack.Generator.MemoryPackGenerator\Test.MemoryPackFormatter.g.cs 117
The first error can be removed by making LastNumber public, and the second error can be removed by enabling global usings.
The errors only occur when inheriting from a class (abstract or not).
The text was updated successfully, but these errors were encountered:
Joy-less
changed the title
Regression with abstract classes
Regression with base classes
Mar 21, 2024
Since 1.20.0, I was trying to detect the default value from the source code, but it didn't take into account the case of using the static method you presented.
We decided to revert this feature.
I believe the compile error has been eliminated in 1.20.5.
The following code works in MemoryPack 1.10.0:
However, it fails in 1.20.0 - 1.20.4 with the following errors:
The first error can be removed by making
LastNumber
public, and the second error can be removed by enabling global usings.The errors only occur when inheriting from a class (abstract or not).
The text was updated successfully, but these errors were encountered: