Closed GoogleCodeExporter closed 9 years ago
Hi; can you sell me what `SerializableQuat` looks like, so I can investigate?
Also, does `SerializableQuat` work fine on the other platforms? or is your
other-platform usage using different data types?
The `MethodAccessException` *sounds* a lot like the annoying "missing
Interlocked" methods; there is a compiler symbol that switches that code to use
a unity-compatible implementation. If so, using the unity build should help
with that.
I'll happily try to investigate, but anything you can do to help me reproduce
the scenario (hence: what does `SerializableQuoa` look like) would be really
helpful.
Original comment by marc.gravell
on 12 Oct 2012 at 11:22
The class I'm serializing is declared as follows:
[ProtoContract]
public struct HitInformation
{
[ProtoMember(1)]
public bool isAttachedToPrevious;
[ProtoMember(2)]
public int i;
[ProtoMember(3)]
public int j;
[ProtoMember(4)]
public float timeStamp;
[ProtoMember(5)]
public int colorId;
[ProtoMember(6)]
public int brush;
[ProtoMember(7)]
public int scale;
override public string ToString()
{
return ( isAttachedToPrevious + ":" + i + ":" + j + ":" + timeStamp + ":" + colorId + ":" + brush + ":" + scale );
}
}
And this is the function that I'm using to serialize:
public string SerializeToString<T>(T obj) where T : class {
using ( MemoryStream stream = new MemoryStream() ) {
new hitStructSerializer().Serialize(stream,obj);
return Convert.ToBase64String( stream.ToArray() );
}
}
I forgot to write that I'm using windows 7 64bit, if that matters and yes, in
the other platforms I'm using the same class and data types, it's in fact the
same application.
Here are the steps I've followed for creating my dlls:
I've created a new solution in monodevelop with my .cs HitStruct class and
built it in a dll.
I've created another solution in monodevelop building a mono executable that
does as follows:
using System;
using ProtoBuf;
using ProtoBuf.Meta;
using UnityEngine;
class MainClass {
public static void Main (string[] args) {
var model = TypeModel.Create();
model.Add( typeof(HitInformation), true );
model.Compile( "hitStructSerializer", "hitStructSerializer.dll" );
}
}
After that, I've called "mono myclass.dll" that created the other dll files.
At the end, I put all those files in the Plugins Unity editor.
Meanwhile, I could try to change the timestamp type from float to another type
to see if the error comes again.
And thanks for the fast answer!
Original comment by willyru...@gmail.com
on 12 Oct 2012 at 12:37
The error message explicitly relates to "SerializableQuat". Is that a type in
your system?
Original comment by marc.gravell
on 12 Oct 2012 at 12:45
No, it isn't.
My dll's method hitStructSerializer().Serialize is declared as
hitStructSerializer.Write ((HitInformation)obj, protoWriter);
and the Write() is
private static void Write (HitInformation hitInformation, ProtoWriter writer)
Original comment by willyru...@gmail.com
on 12 Oct 2012 at 12:48
I meant, the Serialize() is:
void TypeModel.Serialize (int num, object obj, ProtoWriter protoWriter)
{
switch (num)
{
case 0:
{
hitStructSerializer.Write ((HitInformation)obj, protoWriter);
return;
}
default:
{
return;
}
}
}
Original comment by willyru...@gmail.com
on 12 Oct 2012 at 12:49
k; that's **really** odd - the stacktrace shouldn't be making up random method
signatures...
It sounds like something is very odd inside the generated hitStructSerializer.
I don't know how much of this code is private, but is there any way you could
email me a copy of the dlls (DTO dll and generated serialization dll), so that
I can look at the generated IL? I'm not trying to steal your project - but
understanding a verification exception without the IL is very hard, and I
can't repro it just from the above. Is that an option at all? If it isn't,
then: I guess it isn't - but worth asking.
Original comment by marc.gravell
on 12 Oct 2012 at 12:57
marc.gravell@gmail.com ?
Of course I can send you the dlls, there is no problem at all!
Original comment by willyru...@gmail.com
on 12 Oct 2012 at 1:02
Hmmm... it is indeed just the "unsafe" flag; it looks like the "unity" build is
not including the right build symbol to omit this; I will re-deploy later today
with this fixed.
Original comment by marc.gravell
on 12 Oct 2012 at 1:34
Thanks :D
And what about the mistery of the SerializableQuat ?
Original comment by willyru...@gmail.com
on 12 Oct 2012 at 1:37
No idea whatsoever on that; that is not a pb-net type. CLI going nuts, maybe.
Please try r594 from google-code. Let me know.
Original comment by marc.gravell
on 12 Oct 2012 at 3:20
It works! Awesome :D
Original comment by willyru...@gmail.com
on 12 Oct 2012 at 3:37
Original issue reported on code.google.com by
willyru...@gmail.com
on 12 Oct 2012 at 10:46