-
-
Notifications
You must be signed in to change notification settings - Fork 754
Description
ExchangeTimeLimits is a field of GdsExchangeShop.
this is my code
[MessagePackFormatter(typeof(ExchangeTimeLimitsFormatter))]
public class ExchangeTimeLimits
{
public List<Tuple<long, long>> TimeLimits = new List<Tuple<long, long>>();
public ExchangeTimeLimits()
{
}
public ExchangeTimeLimits(JArray jArray)
{
foreach (var jar in jArray)
{
TimeLimits.Add(new Tuple<long, long>(jar["view_time_start"].Value<long>(),jar["view_time_end"] .Value<long>()));
}
}
}
[MessagePackObject]
public class GdsExchangeShop : GdsAbstractBase
{
#region Fields
[Key(StartKeyIndex )]
public string ExchangeShopName;
[Key(StartKeyIndex + 1)]
public string DisplayName;
[Key(StartKeyIndex + 2)]
public bool IsTimeLimited;
[Key(StartKeyIndex + 3)]
public ExchangeTimeLimits ExchangeTimeLimits;
#endregion
#region Methods
public GdsExchangeShop()
{
}
public GdsExchangeShop(JObject jObject) : base(jObject)
{
ExchangeShopName = jObject["name"].Value<string>();
DisplayName = jObject["display_name"].Value<string>();
IsTimeLimited = jObject["time_limited"].Value<int>() == 1;
ExchangeTimeLimits=new ExchangeTimeLimits((JArray) jObject["schedule"]);
}
#endregion
}
when perform mpc.exe generate formatter code in Unity, i get the following error:
process result:1,stdoutx=Project Compilation Start:/Users/shishaoguang/work/hap-unity/client/Unity/Assets/CustomAssets/Scripts/Model/Common/Gds
Project Compilation Complete:00:00:02.1225221
Method Collect Start
Fail in console app running on MessagepackCompiler.RunAsync
MessagePackCompiler.CodeAnalysis.MessagePackGeneratorResolveFailedException: Serialization Object must mark MessagePackObjectAttribute. type: global::CustomAssets.Scripts.Model.Common.Gds.ExchangeTimeLimits
at MessagePackCompiler.CodeAnalysis.TypeCollector.GetObjectInfo(INamedTypeSymbol type) in D:\a\1\s\src\MessagePack.GeneratorCore\CodeAnalysis\TypeCollector.cs:line 589
at MessagePackCompiler.CodeAnalysis.TypeCollector.CollectObject(INamedTypeSymbol type) in D:\a\1\s\src\MessagePack.GeneratorCore\CodeAnalysis\TypeCollector.cs:line 583
at MessagePackCompiler.CodeAnalysis.TypeCollector.CollectCore(ITypeSymbol typeSymbol) in D:\a\1\s\src\MessagePack.GeneratorCore\CodeAnalysis\TypeCollector.cs:line 391
at MessagePackCompiler.CodeAnalysis.TypeCollector.GetObjectInfo(INamedTypeSymbol type) in D:\a\1\s\src\MessagePack.GeneratorCore\CodeAnalysis\TypeCollector.cs:line 763
at MessagePackCompiler.CodeAnalysis.TypeCollector.CollectObject(INamedTypeSymbol type) in D:\a\1\s\src\MessagePack.GeneratorCore\CodeAnalysis\TypeCollector.cs:line 583
at MessagePackCompiler.CodeAnalysis.TypeCollector.CollectCore(ITypeSymbol typeSymbol) in D:\a\1\s\src\MessagePack.GeneratorCore\CodeAnalysis\TypeCollector.cs:line 391
at MessagePackCompiler.CodeAnalysis.TypeCollector.Collect() in D:\a\1\s\src\MessagePack.GeneratorCore\CodeAnalysis\TypeCollector.cs:line 322
at MessagePackCompiler.CodeGenerator.GenerateFileAsync(String input, String output, String conditionalSymbol, String resolverName, String namespace, Boolean useMapMode, String multipleIfDirectiveOutputSymbols) in D:\a\1\s\src\MessagePack.GeneratorCore\CodeGenerator.cs:line 58
at MessagePack.Generator.MessagepackCompiler.RunAsync(String input, String output, String conditionalSymbol, String resolverName, String namespace, Boolean useMapMode, String multipleIfDirectiveOutputSymbols) in D:\a\1\s\src\MessagePack.Generator\MessagepackCompiler.cs:line 30
at ConsoleAppFramework.ConsoleAppEngine.RunCore(ConsoleAppContext ctx, Type type, MethodInfo methodInfo, String[] args, Int32 argsOffset)
,stderrx=
UnityEngine.Debug:Log(Object)
why is this happen?
Now i must manual writing CustomFormatter for GdsExchangeShop to avoid this error.