Skip to content

Commit 850c1b3

Browse files
committed
Fix IL2CPP.exe crash. Issue #101.
IL2CPP crash when it faces following code: 1) It uses generic contraint with another generic parameter. 2) Using 1, invoking some member via contrained type. 3) The type of generic argument for parameter in 1 is value type instead of reference type. So, this commit changes ReflectionSerializerNilImplication*Parameter from struct to class in Unity build.
1 parent a7aad0d commit 850c1b3

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

src/MsgPack/Serialization/ReflectionSerializers/ReflectionSerializerNilImplicationHandlerOnUnpackedParameter.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// MessagePack for CLI
44
//
5-
// Copyright (C) 2014 FUJIWARA, Yusuke
5+
// Copyright (C) 2014-2015 FUJIWARA, Yusuke
66
//
77
// Licensed under the Apache License, Version 2.0 (the "License");
88
// you may not use this file except in compliance with the License.
@@ -18,11 +18,19 @@
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

2327
namespace MsgPack.Serialization.ReflectionSerializers
2428
{
29+
#if !UNITY
2530
internal struct ReflectionSerializerNilImplicationHandlerOnUnpackedParameter : INilImplicationHandlerOnUnpackedParameter<Action<object>>
31+
#else
32+
internal sealed class ReflectionSerializerNilImplicationHandlerOnUnpackedParameter : INilImplicationHandlerOnUnpackedParameter<Action<object>>
33+
#endif
2634
{
2735
private readonly Type _itemType;
2836
public Type ItemType { get { return this._itemType; } }

src/MsgPack/Serialization/ReflectionSerializers/ReflectionSerializerNilImplicationHandlerParameter.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// MessagePack for CLI
44
//
5-
// Copyright (C) 2014 FUJIWARA, Yusuke
5+
// Copyright (C) 2014-2015 FUJIWARA, Yusuke
66
//
77
// Licensed under the Apache License, Version 2.0 (the "License");
88
// you may not use this file except in compliance with the License.
@@ -18,11 +18,19 @@
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

2327
namespace MsgPack.Serialization.ReflectionSerializers
2428
{
29+
#if !UNITY
2530
internal struct ReflectionSerializerNilImplicationHandlerParameter : INilImplicationHandlerParameter
31+
#else
32+
internal sealed class ReflectionSerializerNilImplicationHandlerParameter : INilImplicationHandlerParameter
33+
#endif
2634
{
2735
private readonly Type _itemType;
2836

0 commit comments

Comments
 (0)