diff --git a/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs b/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs
index 4fe6ea7c7d..1c71dc9516 100644
--- a/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs
+++ b/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs
@@ -100,11 +100,7 @@ namespace Google.ProtocolBuffers.Serialization
private class JsonStreamWriter : JsonFormatWriter
{
-#if SILVERLIGHT || COMPACT_FRAMEWORK
static readonly Encoding Encoding = new UTF8Encoding(false);
-#else
- private static readonly Encoding Encoding = Encoding.ASCII;
-#endif
private readonly byte[] _buffer;
private Stream _output;
private int _bufferPos;
diff --git a/src/ProtocolBuffers.Serialization/RecursionLimitExceeded.cs b/src/ProtocolBuffers.Serialization/RecursionLimitExceeded.cs
index a2f683f70d..14e72ba872 100644
--- a/src/ProtocolBuffers.Serialization/RecursionLimitExceeded.cs
+++ b/src/ProtocolBuffers.Serialization/RecursionLimitExceeded.cs
@@ -7,9 +7,6 @@ namespace Google.ProtocolBuffers.Serialization
///
/// The exception raised when a recursion limit is reached while parsing input.
///
-#if !SILVERLIGHT && !COMPACT_FRAMEWORK
- [Serializable]
-#endif
public sealed class RecursionLimitExceededException : FormatException
{
const string message = "Possible malicious message had too many levels of nesting.";
@@ -17,12 +14,5 @@ namespace Google.ProtocolBuffers.Serialization
internal RecursionLimitExceededException() : base(message)
{
}
-
-#if !SILVERLIGHT && !COMPACT_FRAMEWORK
- private RecursionLimitExceededException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
- : base(info, context)
- {
- }
-#endif
}
}
diff --git a/src/ProtocolBuffers.Test/CodedOutputStreamTest.cs b/src/ProtocolBuffers.Test/CodedOutputStreamTest.cs
index f6e7537ca1..172c14bdbb 100644
--- a/src/ProtocolBuffers.Test/CodedOutputStreamTest.cs
+++ b/src/ProtocolBuffers.Test/CodedOutputStreamTest.cs
@@ -196,7 +196,6 @@ namespace Google.ProtocolBuffers
0x9abcdef012345678UL);
}
-#if !SILVERLIGHT && !COMPACT_FRAMEWORK
[TestMethod]
public void WriteWholeMessage()
{
@@ -230,7 +229,6 @@ namespace Google.ProtocolBuffers
TestUtil.AssertEqualBytes(TestUtil.GetGoldenPackedFieldsMessage().ToByteArray(),
rawBytes);
}
-#endif
[TestMethod]
public void EncodeZigZag32()
diff --git a/src/ProtocolBuffers.Test/Compatibility/BinaryCompatibilityTests.cs b/src/ProtocolBuffers.Test/Compatibility/BinaryCompatibilityTests.cs
index 8438d94fcb..9707f8e8ed 100644
--- a/src/ProtocolBuffers.Test/Compatibility/BinaryCompatibilityTests.cs
+++ b/src/ProtocolBuffers.Test/Compatibility/BinaryCompatibilityTests.cs
@@ -1,11 +1,5 @@
using System;
-#if SILVERLIGHT
-using TestClass = Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute;
-using Test = Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute;
-using Assert = Microsoft.VisualStudio.TestTools.UnitTesting.Assert;
-#else
using Microsoft.VisualStudio.TestTools.UnitTesting;
-#endif
namespace Google.ProtocolBuffers.Compatibility
{
diff --git a/src/ProtocolBuffers.Test/Compatibility/DictionaryCompatibilityTests.cs b/src/ProtocolBuffers.Test/Compatibility/DictionaryCompatibilityTests.cs
index fddddf849d..73037cce6a 100644
--- a/src/ProtocolBuffers.Test/Compatibility/DictionaryCompatibilityTests.cs
+++ b/src/ProtocolBuffers.Test/Compatibility/DictionaryCompatibilityTests.cs
@@ -3,14 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Text;
using Google.ProtocolBuffers.Serialization;
-#if SILVERLIGHT
-using TestClass = Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute;
-using Test = Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute;
-using Assert = Microsoft.VisualStudio.TestTools.UnitTesting.Assert;
-#else
using Microsoft.VisualStudio.TestTools.UnitTesting;
-#endif
-
namespace Google.ProtocolBuffers.Compatibility
{
diff --git a/src/ProtocolBuffers.Test/Compatibility/TestResources.cs b/src/ProtocolBuffers.Test/Compatibility/TestResources.cs
index 2fc1322b82..c3ce58834d 100644
--- a/src/ProtocolBuffers.Test/Compatibility/TestResources.cs
+++ b/src/ProtocolBuffers.Test/Compatibility/TestResources.cs
@@ -2,14 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Text;
-#if SILVERLIGHT
-using TestClass = Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute;
-using Test = Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute;
-using Assert = Microsoft.VisualStudio.TestTools.UnitTesting.Assert;
-#else
using Microsoft.VisualStudio.TestTools.UnitTesting;
-#endif
-
namespace Google.ProtocolBuffers.Compatibility
{
diff --git a/src/ProtocolBuffers.Test/Compatibility/XmlCompatibilityTests.cs b/src/ProtocolBuffers.Test/Compatibility/XmlCompatibilityTests.cs
index 9113b58971..70614744b0 100644
--- a/src/ProtocolBuffers.Test/Compatibility/XmlCompatibilityTests.cs
+++ b/src/ProtocolBuffers.Test/Compatibility/XmlCompatibilityTests.cs
@@ -2,14 +2,7 @@ using System.IO;
using System.Xml;
using Google.ProtocolBuffers.Serialization;
using Google.ProtocolBuffers.TestProtos;
-#if SILVERLIGHT
-using TestClass = Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute;
-using Test = Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute;
-using Assert = Microsoft.VisualStudio.TestTools.UnitTesting.Assert;
-#else
using Microsoft.VisualStudio.TestTools.UnitTesting;
-#endif
-
namespace Google.ProtocolBuffers.Compatibility
{
diff --git a/src/ProtocolBuffers.Test/DescriptorsTest.cs b/src/ProtocolBuffers.Test/DescriptorsTest.cs
index 5cf79e3ba8..ca10c62162 100644
--- a/src/ProtocolBuffers.Test/DescriptorsTest.cs
+++ b/src/ProtocolBuffers.Test/DescriptorsTest.cs
@@ -229,7 +229,6 @@ namespace Google.ProtocolBuffers
Assert.IsFalse(repeatedField.IsRequired);
Assert.IsTrue(repeatedField.IsRepeated);
}
-#if !SILVERLIGHT
[TestMethod]
public void FieldDescriptorDefault()
{
@@ -240,13 +239,12 @@ namespace Google.ProtocolBuffers
Assert.AreEqual