Skip to content

Commit c143af6

Browse files
committed
Disable runtime serialization for .net standard 2.0
.NET Standard 2.0 does no support RuntimeType serialization, so this feature is not available in .net core. In addition, this feature is not very important because runtime serialization (binary formatter) is legacy for .net core.
1 parent 7e76b29 commit c143af6

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

src/MsgPack/MessagePackObject.Utilities.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444

4545
namespace MsgPack
4646
{
47-
#if !SILVERLIGHT && !NETSTANDARD1_1 && !NETSTANDARD1_3
47+
#if !SILVERLIGHT && !NETSTANDARD1_1 && !NETSTANDARD1_3 && !NETSTANDARD2_0
4848
[Serializable]
49-
#endif // !SILVERLIGHT && !NETSTANDARD1_1 && !NETSTANDARD1_3
49+
#endif // !SILVERLIGHT && !NETSTANDARD1_1 && !NETSTANDARD1_3 && !NETSTANDARD2_0
5050
partial struct MessagePackObject : IPackable
5151
#if FEATURE_TAP
5252
, IAsyncPackable

src/MsgPack/MessagePackString.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#region -- License Terms --
1+
#region -- License Terms --
22
//
33
// MessagePack for CLI
44
//
@@ -43,9 +43,9 @@ namespace MsgPack
4343
/// <summary>
4444
/// Encapselates <see cref="String"/> and its serialized UTF-8 bytes.
4545
/// </summary>
46-
#if !SILVERLIGHT && !NETSTANDARD1_1 && !NETSTANDARD1_3
46+
#if !SILVERLIGHT && !NETSTANDARD1_1 && !NETSTANDARD1_3 && !NETSTANDARD2_0
4747
[Serializable]
48-
#endif // !SILVERLIGHT && !NETSTANDARD1_1 && !NETSTANDARD1_3
48+
#endif // !SILVERLIGHT && !NETSTANDARD1_1 && !NETSTANDARD1_3 && !NETSTANDARD2_0
4949
#if !NET35 && !UNITY
5050
[SecuritySafeCritical]
5151
#endif // !NET35 && !UNITY

test/MsgPack.UnitTest/MessagePackObjectDictionaryTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#region -- License Terms --
1+
#region -- License Terms --
22
//
33
// MessagePack for CLI
44
//
@@ -1337,7 +1337,7 @@ public void TestValuesCopyTo()
13371337
Assert.That( array[ 4 ], Is.EqualTo( MessagePackObject.Nil ) );
13381338
}
13391339

1340-
#if !NETFX_CORE && !SILVERLIGHT && !UNITY && !NETSTANDARD1_1 && !NETSTANDARD1_3
1340+
#if !NETFX_CORE && !SILVERLIGHT && !UNITY && !NETSTANDARD1_1 && !NETSTANDARD1_3 && !NETSTANDARD2_0
13411341
[Test]
13421342
public void TestRuntimeSerialization_NotEmpty_RoundTripped()
13431343
{
@@ -1351,7 +1351,7 @@ public void TestRuntimeSerialization_NotEmpty_RoundTripped()
13511351
Assert.AreEqual( target, deserialized );
13521352
}
13531353
}
1354-
#endif // !NETFX_CORE && !SILVERLIGHT && !UNITY && !NETSTANDARD1_1 && !NETSTANDARD1_3
1354+
#endif // !NETFX_CORE && !SILVERLIGHT && !UNITY && !NETSTANDARD1_1 && !NETSTANDARD1_3 && !NETSTANDARD2_0
13551355

13561356
private sealed class MyClass { }
13571357
}

test/MsgPack.UnitTest/MsgPack.UnitTest.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,9 @@
769769
<LastGenOutput>UnpackerTest.cs</LastGenOutput>
770770
</None>
771771
</ItemGroup>
772+
<ItemGroup>
773+
<Compile Remove="MessagePackObjectTest.RuntimeSerialization.cs" Condition="'$(TargetFramework)' == 'netcoreapp1.0' or '$(TargetFramework)' == 'netcoreapp2.0'" />
774+
</ItemGroup>
772775
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
773776
Other similar extension points exist, see Microsoft.Common.targets.
774777
<Target Name="BeforeBuild">

0 commit comments

Comments
 (0)