Comments (22)
Stacktrace?
from aqlaserializer.
Stack Trace:
DeflateStream.get_Position()
ProtoWriter.ctor(Stream dest, TypeModel model, SerializationContext context) line 886
TypeModel.Serialize(Stream dest, Object value, SerializationContext context) line 240
TypeModel.Serialize(Stream dest, Object value) line 227
Serializer.Serialize[T](Stream destination, T instance) line 135
UnitTest.TestCompress() line 170
from aqlaserializer.
Yeah, it's expected that it's possible to get stream position, if it's not supported in DeflateStream
than you can't use it directly. Though you can make a wrapper around DeflateStream
which implements Position
. It should just count written bytes.
from aqlaserializer.
But this code works for Protobuf-net. Is Aqla supposed to support whatever Protobuf-net provides?
The following code works:
using (DeflateStream dest = new DeflateStream(new MemoryStream(), CompressionMode.Compress))
{
ProtoBuf.Serializer.Serialize(dest, "Test");
}
from aqlaserializer.
Mostly it supports things from Protobuf-net, but not using Position
property is a very implementation specific thing. Ok, I'll see if Position
can be avoided. For now you can workaround it using a wrapper.
from aqlaserializer.
We've already had a serialization solution which is a mix of BinaryFormatter and ProtoBuf, each has its own issues. I'm trying to consolidate them into Aqla, but found these two issues. It would be very much appreciated if you can get them addressed.
from aqlaserializer.
Can you provide an example with full cycle: serialization + deserialization using DeflateStream?
from aqlaserializer.
This is an example of how to serialize/deserialize into/from a DeflateStream:
public void TestCompress()
{
byte[] bytes;
using (MemoryStream stream = new MemoryStream())
{
using (DeflateStream dest = new DeflateStream(stream, CompressionMode.Compress))
{
ProtoBuf.Serializer.Serialize(dest, "Test");
}
bytes = stream.ToArray();
}
using (var stream = new MemoryStream(bytes))
using (DeflateStream dest = new DeflateStream(stream, CompressionMode.Decompress))
{
var str = ProtoBuf.Serializer.Deserialize<string>(dest);
Assert.Equal("Test", str);
}
}
from aqlaserializer.
Ok, I fixed it so that Position is not used unless it is really necessary. You can test it with the develop branch. But mind that some features require seeking during reading like If you try to reference an object from inside itself.
from aqlaserializer.
Thanks for the quick turn around. I want to make Aqla our standard serializer, but these two issues have caused many unit tests to fail. Now you have quickly fixed issue #36, it would be really helpful if you can also fix #35.
from aqlaserializer.
I got the following error while trying to run our tests with the Aqla develop branch:
AqlaSerializer.ProtoAggregateException : One or multiple exceptions occurred: InvalidOperationException (Non-public member cannot be used with full dll compilation:
Any idea what could be the cause?
from aqlaserializer.
It means you are serializing a private field. If it's not the case can you give me a repro?
from aqlaserializer.
Yes, we are serializing private fields. We use reflection to find out all fields (public and private) and use RuntimeTypeModel APIs to register our classes and fields. This has never been a problem before.
from aqlaserializer.
I have encountered similar issues before. One thing I noticed is that if I download and use the binaries you built, then this problem goes away.
from aqlaserializer.
Can you please publish the binaries? I would like to give it a try.
from aqlaserializer.
What does "full dll compilation" mean?
from aqlaserializer.
When you call RuntimeTypeModel.Compile(dllName)
it generates dll that can serialize your classes without reflection. If works as any other compiled C# code so it can't access private members.
from aqlaserializer.
It looks like you use DEBUG configuration of aqlaserializer project, that's why it attempts to test dll compilation. Just switch to release.
from aqlaserializer.
You are right, I was running in DEBUG configuration. However, I didn't call RuntimeTypeModel.Compile(dllName), instead what I called is RuntimeTypeModel.Default.CompileInPlace(). Does this have the same effect as "RuntimeTypeModel.Compile(dllName)"?
from aqlaserializer.
I'm having some trouble to build the release build of Aqla. Can you post the release build of it? Thanks
from aqlaserializer.
Never mind, I figured out how to create the release build. I've verified that this issue is fixed in develop branch. Now can you please create a nuget package? I will ask our IT to download it and put it in our internal nuget repo so that our system can start to use it.
from aqlaserializer.
I've published the new release.
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
- AqlaSerializer.ProtoException: Trap count > 1, will be mismatched with next NoteObject HOT 15
- 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.