Comments (15)
I'm currently stuck on this issue. Any help is highly appreciated.
from aqlaserializer.
It's possible that your scenario is not supported by the reference tracking system. I can't say what exactly causes this without a reproducable example. Try removing fields one by one until the issue disappears. Then send me an isolated repro.
from aqlaserializer.
To be more clear, TrapNextObject
is used to set object id which is used by a following NoteObject
call when an instance is created. If the next serializer in the chain can't create object instance right away, it should call ReserveNoteObject
to store the id in a stack for later use. Either way, next TrapNextObject
call should not happen before any of these. This exception is thrown when calling TrapNextObject
while previous trap hasn't been utilized yet. Allowing such calls would lead to loosing previously stored object id.
So you need to find out which type of serializer called TrapNextObject
previous time (without throwing) and why next serializer doesn't utilize the trap.
from aqlaserializer.
Finally, I was able to replicate this issue with a simple test case. The call "Serializer.DeepClone(inst);" will fail with error message like "AqlaSerializer.ProtoException : Trap count > 1, will be mismatched with next NoteObject".
Could you please take a look and see what's wrong? Thanks a lot for your help!
private class Root
{
private UniqueIds2 _uniqueIds2;
private Information _inputField;
public UniqueIds2 InstrumentIds { get => _uniqueIds2; set => _uniqueIds2 = value; }
public Information InputField { get => _inputField; set => _inputField = value; }
}
private sealed class Information
{
private object _data;
public object Data { get => _data; set => _data = value; }
}
private class UniqueIds2
{
private long _uniqueId;
private long _repeatableId;
public UniqueIds2(long uniqueId, long repeatableId)
{
UniqueId = uniqueId;
RepeatableId = repeatableId;
}
public long UniqueId { get => _uniqueId; private set => _uniqueId = value; }
public long RepeatableId { get => _repeatableId; private set => _repeatableId = value; }
}
[Fact]
public void Test()
{
var metaType1 = AqlaSerializer.Meta.RuntimeTypeModel.Default.Add(typeof(Root), false);
metaType1.DefaultFormat = ValueFormat.Reference;
metaType1.UseConstructor = false;
metaType1.IgnoreListHandling = true;
var metaType2 = AqlaSerializer.Meta.RuntimeTypeModel.Default.Add(typeof(Information), false);
metaType2.DefaultFormat = ValueFormat.Reference;
metaType2.UseConstructor = false;
metaType2.IgnoreListHandling = true;
AqlaSerializer.Meta.MetaType metaType3 = AqlaSerializer.Meta.RuntimeTypeModel.Default[typeof(Information)];
var metaField1 = metaType3.AddField(1, "_data");
metaField1.SetSettings(x => { x.V.Format = ValueFormat.Reference; });
metaField1.SetSettings(x => x.V.WriteAsDynamicType = true, 0);
AqlaSerializer.Meta.MetaType metaType4 = AqlaSerializer.Meta.RuntimeTypeModel.Default[typeof(Root)];
var metaField2 = metaType4.AddField(1, "_inputField");
metaField2.SetSettings(x => { x.V.Format = ValueFormat.Reference; });
var metaType5 = AqlaSerializer.Meta.RuntimeTypeModel.Default.Add(typeof(UniqueIds2), false);
metaType5.DefaultFormat = ValueFormat.Reference;
metaType5.UseConstructor = false;
metaType5.IgnoreListHandling = true;
AqlaSerializer.Meta.MetaType metaType6 = AqlaSerializer.Meta.RuntimeTypeModel.Default[typeof(UniqueIds2)];
var metaField3 = metaType6.AddField(1, "_repeatableId");
metaField3.SetSettings(x => { x.V.Format = ValueFormat.Compact; });
var metaField4 = metaType6.AddField(2, "_uniqueId");
metaField4.SetSettings(x => { x.V.Format = ValueFormat.Compact; });
AqlaSerializer.Meta.MetaType metaType8 = AqlaSerializer.Meta.RuntimeTypeModel.Default[typeof(Root)];
var metaField5 = metaType8.AddField(2, "_uniqueIds2");
metaField5.SetSettings(x => { x.V.Format = ValueFormat.Reference; });
var inst = new Root();
inst.InstrumentIds = new UniqueIds2(1001, 1001);
var columnData = new Information();
columnData.Data = "test";
inst.InputField = columnData;
Serializer.DeepClone(inst);
}
from aqlaserializer.
Fixed in develop branch
from aqlaserializer.
Great! Thanks for the quick fix. Just be curious, what was the problem? It has take me hours to replicate it with a simple test case.
from aqlaserializer.
See 4f6a770
from aqlaserializer.
I see, thanks.
from aqlaserializer.
I just verified that the issue is fixed with the develop branch. Can you publish it in nuget? We can only use nuget packages for our official builds.
from aqlaserializer.
Unfortunately, I uninstalled VS 2019 and it's not possible to make the full build with all supported platforms using VS 2022. It may take some time before I will be able to publish the new release.
from aqlaserializer.
Any update on publishing the new release? Thanks
from aqlaserializer.
Not today unless you know how to build Portable Class Library project with VS 2022.
from aqlaserializer.
Any update on this? Thanks
from aqlaserializer.
Released
from aqlaserializer.
Cool, thank a lot!
from aqlaserializer.
Related Issues (20)
- RuntimeTypeModel.Default.CompileInPlace is too slow HOT 5
- Non-public member cannot be used with full dll compilation HOT 12
- Dynamic type is not a contract-type
- Un-defined enum values HOT 1
- Unexpected sub-type HOT 4
- How to setup Aqla for complicated object relationships HOT 4
- Wrong group was ended
- Recursion depth exceeded safe limit HOT 2
- "Unable to determine member" when running obfuscated code HOT 1
- A deferred key does not have a value yet (NoteObject call missed?) HOT 10
- How to unregister or re-register a type? HOT 6
- Can you please publish the latest code?
- Failed to clone a dictionary with enum value
- Unable to Serialize a string object dictionary containing a string array as object
- Is Aqla's metadata inspection thread-safe? HOT 2
- Is there a way to re-compile the runtime type model as a dll? HOT 2
- Can we reformat the source code? HOT 1
- Reference tracking error message only for release build but not for debug build
- When a SortedDictionary is serialized, does Aqla keep the "Comparer" of it? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aqlaserializer.