Open GoogleCodeExporter opened 9 years ago
At the current time, this functionality is intended for use with dynamic
*contract* types; I have added specific messages to clarify the problem (so it
isn't a mystery), however, adding full support for all types (including inbuilt
types) is a bit more involved. Can probably do it, but not today (and am about
to disappear for a few days).
Original comment by marc.gravell
on 30 Mar 2012 at 5:55
I'm seeing the same issue here with r580 with non-contract types. Given
something like:
class Program {
static void Main(string[] args) {
cls val = new cls();
val.something = 123.45;
Serializer.DeepClone(val);
}
}
[ProtoContract]
public class cls {
[ProtoMember(1, DynamicType = true)]
public object something; // { get; set; }
The DeepClone call complains: "Dynamic type is not a contract-type: Double"
(same with other non-contract types, eg int).
Original comment by j...@tabascoterrier.net
on 22 Aug 2012 at 1:54
Yes, this regression is *basically* why I haven't made a 58* build "listed" on
NuGet or "featured" on google-code. This is on my list to investigate ASAP.
Original comment by marc.gravell
on 22 Aug 2012 at 2:12
[deleted comment]
I'm having the same problem with r602.
My test
[TestMethod]
public void Execute()
{
var m = RuntimeTypeModel.Default;
m.DynamicTypeFormatting += OnDynamicTypeFormatting;
var fieldDefinition = new IntegerFieldDefinition();
fieldDefinition.DefaultValue = 60;
fieldDefinition.MinValue = 10;
fieldDefinition.MaxValue = 999;
var cloneTest = CloneTest(fieldDefinition);
Assert.AreEqual(fieldDefinition.DefaultValue, cloneTest.DefaultValue);
Assert.AreEqual(fieldDefinition.MinValue, cloneTest.MinValue);
Assert.AreEqual(fieldDefinition.MaxValue, cloneTest.MaxValue);
}
public void OnDynamicTypeFormatting(object sender, TypeFormatEventArgs args)
{
if (args.Type == typeof(Int32))
{
args.FormattedName = "System.Int32";
}
else if (args.FormattedName == "System.Int32")
{
args.Type = typeof(System.Int32);
}
}
The event OnDynamicTypeFormatting is not called
The DefaultValue property of class IntegerFieldDefinition
[ProtoMember(7, DynamicType = true)]
public object DefaultValue {
get { return _defaultValue; }
set { _defaultValue = value; }
}
Original comment by h.rickma...@gmail.com
on 10 Dec 2012 at 1:43
Having this issue in 2.0.0.668
[ProtoContract]
[ProtoInclude(100, typeof(string))]
[ProtoInclude(101, typeof(int))]
internal class ZZZZ
{
[ProtoMember(1, DynamicType = true)]
private object _value = 56;
[ProtoMember(2, DynamicType = true)]
private object _value2 = "RRRRR";
}
private void TestProtobuf()
{
var zzz = new ZZZZ();
using (var memoryStream = new MemoryStream())
{
Serializer.Serialize(memoryStream, zzz);
}
}
Original comment by evgen...@gmail.com
on 27 Nov 2013 at 8:09
Original issue reported on code.google.com by
jay.tha...@gmail.com
on 29 Mar 2012 at 4:03