Skip to content

Commit 3904dd9

Browse files
committed
Fix Unity iOS build.
1 parent 029a4e6 commit 3904dd9

4 files changed

Lines changed: 43 additions & 4 deletions

File tree

CHANGES.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,21 @@ Release 0.5.1 - 2014/8/9
148148
NOTE
149149
* This release changes drop for Unity3D from source assets to dll assets (source assets are still available).
150150

151-
Release 0.5.2 - 2014/9/?
151+
Release 0.5.2 - 2014/9/6
152+
153+
BREAKING CHANGES
154+
* MessagePackObjectEqualityComparer does not inherit EqualityComparer<T> now to avoid ExecutionEngineException on iOS.
152155

153156
FEATURES
154157
* Support Windows Phone 8.1 (Both of WinRT & Silverlight) issue #36
155158
* Add MessagePackSerializer.Get() for usability.
156159

157160
BUG FIXES
158161
* Fix FILETIME is not available in WinRT
162+
* Fix does not work in Unity3D. issue #37
163+
164+
Relese 1.0 - ???
165+
166+
BREAKING CHANGES [planed]
167+
* APIs marked with [Obsolete] are removed.
168+

src/MsgPack/MessagePackObjectEqualityComparer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace MsgPack
2929
#if !SILVERLIGHT && !NETFX_CORE
3030
[Serializable]
3131
#endif
32-
public sealed class MessagePackObjectEqualityComparer : EqualityComparer<MessagePackObject>
32+
public sealed class MessagePackObjectEqualityComparer : IEqualityComparer<MessagePackObject>
3333
{
3434
private static readonly MessagePackObjectEqualityComparer _instance = new MessagePackObjectEqualityComparer();
3535

@@ -51,7 +51,7 @@ public MessagePackObjectEqualityComparer() { }
5151
/// <returns>
5252
/// <c>true</c> if the specified objects are equal; otherwise, <c>false</c>.
5353
/// </returns>
54-
public override bool Equals( MessagePackObject x, MessagePackObject y )
54+
public bool Equals( MessagePackObject x, MessagePackObject y )
5555
{
5656
return x.Equals( y );
5757
}
@@ -63,7 +63,7 @@ public override bool Equals( MessagePackObject x, MessagePackObject y )
6363
/// <returns>
6464
/// A hash code for <paramref name="obj"/>, suitable for use in hashing algorithms and data structures like a hash table.
6565
/// </returns>
66-
public override int GetHashCode( MessagePackObject obj )
66+
public int GetHashCode( MessagePackObject obj )
6767
{
6868
return obj.GetHashCode();
6969
}

src/MsgPack/Serialization/DataMemberContract.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ namespace MsgPack.Serialization
3535
/// <summary>
3636
/// Represents member's data contract.
3737
/// </summary>
38+
#if !UNITY
3839
internal struct DataMemberContract
40+
#else
41+
internal sealed class DataMemberContract
42+
#endif // !UNITY
3943
{
4044
internal const int UnspecifiedId = -1;
4145

@@ -92,6 +96,15 @@ public NilImplication NilImplication
9296
get { return this._nilImplication; }
9397
}
9498

99+
#if UNITY
100+
public DataMemberContract()
101+
{
102+
this._name = null;
103+
this._nilImplication = NilImplication.MemberDefault;
104+
this._id = UnspecifiedId;
105+
}
106+
#endif // UNITY
107+
95108
/// <summary>
96109
/// Initializes a new instance of the <see cref="DataMemberContract"/> struct.
97110
/// </summary>

src/MsgPack/Serialization/SerializingMember.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
//
1919
#endregion -- License Terms --
2020

21+
#if UNITY_STANDALONE || UNITY_WEBPLAYER || UNITY_WII || UNITY_IPHONE || UNITY_ANDROID || UNITY_PS3 || UNITY_XBOX360 || UNITY_FLASH || UNITY_BKACKBERRY || UNITY_WINRT
22+
#define UNITY
23+
#endif
24+
2125
using System;
2226
using System.Reflection;
2327

@@ -26,11 +30,23 @@ namespace MsgPack.Serialization
2630
/// <summary>
2731
/// Represents serializing member information.
2832
/// </summary>
33+
#if !UNITY
2934
internal struct SerializingMember
35+
#else
36+
internal sealed class SerializingMember
37+
#endif // !UNITY
3038
{
3139
public readonly MemberInfo Member;
3240
public readonly DataMemberContract Contract;
3341

42+
#if UNITY
43+
public SerializingMember()
44+
{
45+
this.Member = null;
46+
this.Contract = new DataMemberContract ();
47+
}
48+
#endif // UNITY
49+
3450
public SerializingMember( MemberInfo member, DataMemberContract contract )
3551
{
3652
this.Member = member;

0 commit comments

Comments
 (0)