Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
See this for SO
This is a program that is ready to run in Xamarin and VS2013.
I'm having an issue where mono isn't calling the serializer Subclass<T>, and need to work around that issue.
**Bug / workaround needed**
How should I modify SetMembershipProof so that it will call a method with the attribute [OnSerializing] located in a nested subclass of <T>?
static void Main(string args)
SetMembershipProof2 setMembershipProof = new SetMembershipProof2();
string setProofJSON = CryptoSerializer.Serialize<SetMembershipProof2>(setMembershipProof);
// Inspect the contents of SetProofJSON, it is null under mono, and not null in .NET
public class CryptoSerializer
/// Serialize serializable types in namespace UProveCrypto.PolyProof.
/// <typeparam name="T">input type</typeparam>
/// <param name="obj">instance of serializable type</param>
/// <returns>JSON string</returns>
public static string Serialize<T>(T obj)
using (MemoryStream ms = new MemoryStream())
DataContractJsonSerializer jsonSerializer =
ms.Position = 0;
StreamReader reader = new StreamReader(ms);
result = reader.ReadToEnd();
catch (Exception e)
throw new SerializationException(obj.GetType().Name, e);
public abstract class GroupParameterizedSerializer2
public void SerializeGroup(StreamingContext context)
public class SetMembershipProof2 : GroupParameterizedSerializer2
/// Serialization of a
[DataMember(Name = "a", EmitDefaultValue = false, Order = 2)]
internal string _a;
/// Serialization of c
[DataMember(Name = "c", EmitDefaultValue = false, Order = 3)]
internal string _c;
/// Serialization of r
[DataMember(Name = "r", EmitDefaultValue = false, Order = 4)]
internal string _r;
/// Serialize a, c, r.
/// <param name="context">The streaming context.</param>
internal void OnSerializing(StreamingContext context)
Console.WriteLine("Debug: This isn't called in Mono...");
List<string> t = new List<string>();
_a = t.ToArray();
_c = t.ToArray();
_r = t.ToArray();
Created attachment 8853 [details]
Customer from this desk case:
Reported they were hitting this issue. (Stated directly, w/ link to this bug report.) And asked for info about it's status. Since it looked like the report didn't have much info, I requested their version info, log files & sample project.
This attachment is the sample project, I was able to build it successfully; but other than that I'm not sure what I'm looking for.
They haven't sent over the logs yet so I'm asking for those again; and will add them when they are received.
---Customer's build info---
=== Xamarin Studio ===
Version 5.5.4 (build 15)
Installation UUID: 748b35df-dbee-4077-a803-dd0e95b67eb7
Mono 3.10.0 ((detached/92c4884)
GTK+ 2.24.23 (Raleigh theme)
Package version: 310000031
=== Xamarin.Android ===
Version: 220.127.116.11 (Trial Edition)
Android SDK: /Users/Chris/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
2.1 (API level 7)
2.2 (API level 8)
2.3 (API level 10)
3.1 (API level 12)
4.0.3 (API level 15)
4.4 (API level 19)
5.0 (API level 21)
Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)
=== Apple Developer Tools ===
Xcode 6.1 (6604)
=== Xamarin.Mac ===
=== Xamarin.iOS ===
Version: 18.104.22.168 (Business Edition)
Build date: 2014-11-16 21:03:22-0500
=== Build Information ===
Release ID: 505040015
Git revision: f93940a35458a18052f1a25e106e62ca970d9c40
Build date: 2014-11-19 15:32:41-05
Xamarin addins: dc23cbd91a3a0e1d326328e1229e86c942a49ec8
=== Operating System ===
Mac OS X 10.10.1
Darwin Chriss-MacBook-Pro.local 14.0.0 Darwin Kernel Version 14.0.0
Fri Sep 19 00:26:44 PDT 2014
To be clear the issue I'm having is that .NET will call the [OnSerializing] method, while mono does not.
This means the resulting output for _a, _c, and _r is null
DataContractJsonSerializer jsonSerializer =
In my mind this is a defect, since .NET can serialize the type properly, and the values shouldn't be null.
I will add the logs shortly as an attachment.
Already fixed in recent Mono versions