aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ProtoGen/EnumFieldGenerator.cs3
-rw-r--r--src/ProtoGen/ExtensionGenerator.cs6
-rw-r--r--src/ProtoGen/FieldGeneratorBase.cs6
-rw-r--r--src/ProtoGen/PrimitiveFieldGenerator.cs3
-rw-r--r--src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs7
-rw-r--r--src/ProtocolBuffers.Test/Properties/AssemblyInfo.cs4
-rw-r--r--src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs6
-rw-r--r--src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs102
-rw-r--r--src/ProtocolBuffers/CodedInputStream.cs13
-rw-r--r--src/ProtocolBuffers/CodedOutputStream.cs26
-rw-r--r--src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs3
-rw-r--r--src/ProtocolBuffers/Descriptors/FieldDescriptor.cs4
-rw-r--r--src/ProtocolBuffers/ExtendableBuilder.cs2
-rw-r--r--src/ProtocolBuffers/GeneratedBuilder.cs1
-rw-r--r--src/ProtocolBuffers/Properties/AssemblyInfo.cs2
-rw-r--r--src/ProtocolBuffers/UnknownField.cs4
-rw-r--r--src/ProtocolBuffers/UnknownFieldSet.cs2
-rw-r--r--src/ProtocolBuffers/WireFormat.cs8
18 files changed, 201 insertions, 1 deletions
diff --git a/src/ProtoGen/EnumFieldGenerator.cs b/src/ProtoGen/EnumFieldGenerator.cs
index aecf6885..25627310 100644
--- a/src/ProtoGen/EnumFieldGenerator.cs
+++ b/src/ProtoGen/EnumFieldGenerator.cs
@@ -15,6 +15,7 @@ namespace Google.ProtocolBuffers.ProtoGen {
writer.WriteLine("public bool Has{0} {{", PropertyName);
writer.WriteLine(" get {{ return has{0}; }}", PropertyName);
writer.WriteLine("}");
+ AddClsComplianceCheck(writer);
writer.WriteLine("public {0} {1} {{", TypeName, PropertyName);
writer.WriteLine(" get {{ return {0}_; }}", Name);
writer.WriteLine("}");
@@ -24,10 +25,12 @@ namespace Google.ProtocolBuffers.ProtoGen {
writer.WriteLine("public bool Has{0} {{", PropertyName);
writer.WriteLine(" get {{ return result.Has{0}; }}", PropertyName);
writer.WriteLine("}");
+ AddClsComplianceCheck(writer);
writer.WriteLine("public {0} {1} {{", TypeName, PropertyName);
writer.WriteLine(" get {{ return result.{0}; }}", PropertyName);
writer.WriteLine(" set {{ Set{0}(value); }}", PropertyName);
writer.WriteLine("}");
+ AddClsComplianceCheck(writer);
writer.WriteLine("public Builder Set{0}({1} value) {{", PropertyName, TypeName);
writer.WriteLine(" result.has{0} = true;", PropertyName);
writer.WriteLine(" result.{0}_ = value;", Name);
diff --git a/src/ProtoGen/ExtensionGenerator.cs b/src/ProtoGen/ExtensionGenerator.cs
index 6b44ed73..5c0afed4 100644
--- a/src/ProtoGen/ExtensionGenerator.cs
+++ b/src/ProtoGen/ExtensionGenerator.cs
@@ -30,8 +30,14 @@ namespace Google.ProtocolBuffers.ProtoGen {
public void Generate(TextGenerator writer) {
writer.WriteLine ("public const int {0} = {1};", GetFieldConstantName(Descriptor), Descriptor.FieldNumber);
if (Descriptor.IsRepeated) {
+ if (!Descriptor.IsCLSCompliant) {
+ writer.WriteLine("[global::System.CLSCompliant(false)]");
+ }
writer.WriteLine("{0} static pb::GeneratedExtensionBase<scg::IList<{1}>> {2};", ClassAccessLevel, type, name);
} else {
+ if (!Descriptor.IsCLSCompliant) {
+ writer.WriteLine("[global::System.CLSCompliant(false)]");
+ }
writer.WriteLine("{0} static pb::GeneratedExtensionBase<{1}> {2};", ClassAccessLevel, type, name);
}
}
diff --git a/src/ProtoGen/FieldGeneratorBase.cs b/src/ProtoGen/FieldGeneratorBase.cs
index 357614d1..f34d01cd 100644
--- a/src/ProtoGen/FieldGeneratorBase.cs
+++ b/src/ProtoGen/FieldGeneratorBase.cs
@@ -97,6 +97,12 @@ namespace Google.ProtocolBuffers.ProtoGen {
}
}
+ protected void AddClsComplianceCheck(TextGenerator writer) {
+ if (!Descriptor.IsCLSCompliant) {
+ writer.WriteLine("[global::System.CLSCompliant(false)]");
+ }
+ }
+
/// <summary>
/// For encodings with fixed sizes, returns that size in bytes. Otherwise
/// returns -1. TODO(jonskeet): Make this less ugly.
diff --git a/src/ProtoGen/PrimitiveFieldGenerator.cs b/src/ProtoGen/PrimitiveFieldGenerator.cs
index 3c2fb246..29d5a739 100644
--- a/src/ProtoGen/PrimitiveFieldGenerator.cs
+++ b/src/ProtoGen/PrimitiveFieldGenerator.cs
@@ -15,6 +15,7 @@ namespace Google.ProtocolBuffers.ProtoGen {
writer.WriteLine("public bool Has{0} {{", PropertyName);
writer.WriteLine(" get {{ return has{0}; }}", PropertyName);
writer.WriteLine("}");
+ AddClsComplianceCheck(writer);
writer.WriteLine("public {0} {1} {{", TypeName, PropertyName);
writer.WriteLine(" get {{ return {0}_; }}", Name);
writer.WriteLine("}");
@@ -24,10 +25,12 @@ namespace Google.ProtocolBuffers.ProtoGen {
writer.WriteLine("public bool Has{0} {{", PropertyName);
writer.WriteLine(" get {{ return result.Has{0}; }}", PropertyName);
writer.WriteLine("}");
+ AddClsComplianceCheck(writer);
writer.WriteLine("public {0} {1} {{", TypeName, PropertyName);
writer.WriteLine(" get {{ return result.{0}; }}", PropertyName);
writer.WriteLine(" set {{ Set{0}(value); }}", PropertyName);
writer.WriteLine("}");
+ AddClsComplianceCheck(writer);
writer.WriteLine("public Builder Set{0}({1} value) {{", PropertyName, TypeName);
AddNullCheck(writer);
writer.WriteLine(" result.has{0} = true;", PropertyName);
diff --git a/src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs b/src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs
index 208d4151..09e9fa08 100644
--- a/src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs
+++ b/src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs
@@ -16,6 +16,7 @@ namespace Google.ProtocolBuffers.ProtoGen {
writer.WriteLine("private int {0}MemoizedSerializedSize;", Name);
}
writer.WriteLine("private pbc::PopsicleList<{0}> {1}_ = new pbc::PopsicleList<{0}>();", TypeName, Name);
+ AddClsComplianceCheck(writer);
writer.WriteLine("public scg::IList<{0}> {1}List {{", TypeName, PropertyName);
writer.WriteLine(" get {{ return pbc::Lists.AsReadOnly({0}_); }}", Name);
writer.WriteLine("}");
@@ -25,6 +26,7 @@ namespace Google.ProtocolBuffers.ProtoGen {
writer.WriteLine(" get {{ return {0}_.Count; }}", Name);
writer.WriteLine("}");
+ AddClsComplianceCheck(writer);
writer.WriteLine("public {0} Get{1}(int index) {{", TypeName, PropertyName);
writer.WriteLine(" return {0}_[index];", Name);
writer.WriteLine("}");
@@ -32,25 +34,30 @@ namespace Google.ProtocolBuffers.ProtoGen {
public void GenerateBuilderMembers(TextGenerator writer) {
// Note: We can return the original list here, because we make it unmodifiable when we build
+ AddClsComplianceCheck(writer);
writer.WriteLine("public scg::IList<{0}> {1}List {{", TypeName, PropertyName);
writer.WriteLine(" get {{ return result.{0}_; }}", Name);
writer.WriteLine("}");
writer.WriteLine("public int {0}Count {{", PropertyName);
writer.WriteLine(" get {{ return result.{0}Count; }}", PropertyName);
writer.WriteLine("}");
+ AddClsComplianceCheck(writer);
writer.WriteLine("public {0} Get{1}(int index) {{", TypeName, PropertyName);
writer.WriteLine(" return result.Get{0}(index);", PropertyName);
writer.WriteLine("}");
+ AddClsComplianceCheck(writer);
writer.WriteLine("public Builder Set{0}(int index, {1} value) {{", PropertyName, TypeName);
AddNullCheck(writer);
writer.WriteLine(" result.{0}_[index] = value;", Name);
writer.WriteLine(" return this;");
writer.WriteLine("}");
+ AddClsComplianceCheck(writer);
writer.WriteLine("public Builder Add{0}({1} value) {{", PropertyName, TypeName);
AddNullCheck(writer);
writer.WriteLine(" result.{0}_.Add(value);", Name, TypeName);
writer.WriteLine(" return this;");
writer.WriteLine("}");
+ AddClsComplianceCheck(writer);
writer.WriteLine("public Builder AddRange{0}(scg::IEnumerable<{1}> values) {{", PropertyName, TypeName);
writer.WriteLine(" base.AddRange(values, result.{0}_);", Name);
writer.WriteLine(" return this;");
diff --git a/src/ProtocolBuffers.Test/Properties/AssemblyInfo.cs b/src/ProtocolBuffers.Test/Properties/AssemblyInfo.cs
index df454739..67aebdc1 100644
--- a/src/ProtocolBuffers.Test/Properties/AssemblyInfo.cs
+++ b/src/ProtocolBuffers.Test/Properties/AssemblyInfo.cs
@@ -1,3 +1,4 @@
+using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@@ -34,3 +35,6 @@ using System.Runtime.InteropServices;
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+// We don't really need CLSCompliance, but if the assembly builds with no warnings,
+// that means the generator is okay.
+[assembly: CLSCompliant(true)]
diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs
index b864f4e9..d603c89b 100644
--- a/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs
+++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs
@@ -47,10 +47,12 @@ namespace Google.ProtocolBuffers.TestProtos {
#endregion
#region Extensions
public const int FileOpt1FieldNumber = 7736974;
+ [global::System.CLSCompliant(false)]
public static pb::GeneratedExtensionBase<ulong> FileOpt1;
public const int MessageOpt1FieldNumber = 7739036;
public static pb::GeneratedExtensionBase<int> MessageOpt1;
public const int FieldOpt1FieldNumber = 7740936;
+ [global::System.CLSCompliant(false)]
public static pb::GeneratedExtensionBase<ulong> FieldOpt1;
public const int FieldOpt2FieldNumber = 7753913;
public static pb::GeneratedExtensionBase<int> FieldOpt2;
@@ -67,16 +69,20 @@ namespace Google.ProtocolBuffers.TestProtos {
public const int Int64OptFieldNumber = 7705542;
public static pb::GeneratedExtensionBase<long> Int64Opt;
public const int Uint32OptFieldNumber = 7704880;
+ [global::System.CLSCompliant(false)]
public static pb::GeneratedExtensionBase<uint> Uint32Opt;
public const int Uint64OptFieldNumber = 7702367;
+ [global::System.CLSCompliant(false)]
public static pb::GeneratedExtensionBase<ulong> Uint64Opt;
public const int Sint32OptFieldNumber = 7701568;
public static pb::GeneratedExtensionBase<int> Sint32Opt;
public const int Sint64OptFieldNumber = 7700863;
public static pb::GeneratedExtensionBase<long> Sint64Opt;
public const int Fixed32OptFieldNumber = 7700307;
+ [global::System.CLSCompliant(false)]
public static pb::GeneratedExtensionBase<uint> Fixed32Opt;
public const int Fixed64OptFieldNumber = 7700194;
+ [global::System.CLSCompliant(false)]
public static pb::GeneratedExtensionBase<ulong> Fixed64Opt;
public const int Sfixed32OptFieldNumber = 7698645;
public static pb::GeneratedExtensionBase<int> Sfixed32Opt;
diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs
index bf9b83cd..8d9b4c49 100644
--- a/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs
+++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs
@@ -104,16 +104,20 @@ namespace Google.ProtocolBuffers.TestProtos {
public const int OptionalInt64ExtensionFieldNumber = 2;
public static pb::GeneratedExtensionBase<long> OptionalInt64Extension;
public const int OptionalUint32ExtensionFieldNumber = 3;
+ [global::System.CLSCompliant(false)]
public static pb::GeneratedExtensionBase<uint> OptionalUint32Extension;
public const int OptionalUint64ExtensionFieldNumber = 4;
+ [global::System.CLSCompliant(false)]
public static pb::GeneratedExtensionBase<ulong> OptionalUint64Extension;
public const int OptionalSint32ExtensionFieldNumber = 5;
public static pb::GeneratedExtensionBase<int> OptionalSint32Extension;
public const int OptionalSint64ExtensionFieldNumber = 6;
public static pb::GeneratedExtensionBase<long> OptionalSint64Extension;
public const int OptionalFixed32ExtensionFieldNumber = 7;
+ [global::System.CLSCompliant(false)]
public static pb::GeneratedExtensionBase<uint> OptionalFixed32Extension;
public const int OptionalFixed64ExtensionFieldNumber = 8;
+ [global::System.CLSCompliant(false)]
public static pb::GeneratedExtensionBase<ulong> OptionalFixed64Extension;
public const int OptionalSfixed32ExtensionFieldNumber = 9;
public static pb::GeneratedExtensionBase<int> OptionalSfixed32Extension;
@@ -152,16 +156,20 @@ namespace Google.ProtocolBuffers.TestProtos {
public const int RepeatedInt64ExtensionFieldNumber = 32;
public static pb::GeneratedExtensionBase<scg::IList<long>> RepeatedInt64Extension;
public const int RepeatedUint32ExtensionFieldNumber = 33;
+ [global::System.CLSCompliant(false)]
public static pb::GeneratedExtensionBase<scg::IList<uint>> RepeatedUint32Extension;
public const int RepeatedUint64ExtensionFieldNumber = 34;
+ [global::System.CLSCompliant(false)]
public static pb::GeneratedExtensionBase<scg::IList<ulong>> RepeatedUint64Extension;
public const int RepeatedSint32ExtensionFieldNumber = 35;
public static pb::GeneratedExtensionBase<scg::IList<int>> RepeatedSint32Extension;
public const int RepeatedSint64ExtensionFieldNumber = 36;
public static pb::GeneratedExtensionBase<scg::IList<long>> RepeatedSint64Extension;
public const int RepeatedFixed32ExtensionFieldNumber = 37;
+ [global::System.CLSCompliant(false)]
public static pb::GeneratedExtensionBase<scg::IList<uint>> RepeatedFixed32Extension;
public const int RepeatedFixed64ExtensionFieldNumber = 38;
+ [global::System.CLSCompliant(false)]
public static pb::GeneratedExtensionBase<scg::IList<ulong>> RepeatedFixed64Extension;
public const int RepeatedSfixed32ExtensionFieldNumber = 39;
public static pb::GeneratedExtensionBase<scg::IList<int>> RepeatedSfixed32Extension;
@@ -200,16 +208,20 @@ namespace Google.ProtocolBuffers.TestProtos {
public const int DefaultInt64ExtensionFieldNumber = 62;
public static pb::GeneratedExtensionBase<long> DefaultInt64Extension;
public const int DefaultUint32ExtensionFieldNumber = 63;
+ [global::System.CLSCompliant(false)]
public static pb::GeneratedExtensionBase<uint> DefaultUint32Extension;
public const int DefaultUint64ExtensionFieldNumber = 64;
+ [global::System.CLSCompliant(false)]
public static pb::GeneratedExtensionBase<ulong> DefaultUint64Extension;
public const int DefaultSint32ExtensionFieldNumber = 65;
public static pb::GeneratedExtensionBase<int> DefaultSint32Extension;
public const int DefaultSint64ExtensionFieldNumber = 66;
public static pb::GeneratedExtensionBase<long> DefaultSint64Extension;
public const int DefaultFixed32ExtensionFieldNumber = 67;
+ [global::System.CLSCompliant(false)]
public static pb::GeneratedExtensionBase<uint> DefaultFixed32Extension;
public const int DefaultFixed64ExtensionFieldNumber = 68;
+ [global::System.CLSCompliant(false)]
public static pb::GeneratedExtensionBase<ulong> DefaultFixed64Extension;
public const int DefaultSfixed32ExtensionFieldNumber = 69;
public static pb::GeneratedExtensionBase<int> DefaultSfixed32Extension;
@@ -244,16 +256,20 @@ namespace Google.ProtocolBuffers.TestProtos {
public const int PackedInt64ExtensionFieldNumber = 91;
public static pb::GeneratedExtensionBase<scg::IList<long>> PackedInt64Extension;
public const int PackedUint32ExtensionFieldNumber = 92;
+ [global::System.CLSCompliant(false)]
public static pb::GeneratedExtensionBase<scg::IList<uint>> PackedUint32Extension;
public const int PackedUint64ExtensionFieldNumber = 93;
+ [global::System.CLSCompliant(false)]
public static pb::GeneratedExtensionBase<scg::IList<ulong>> PackedUint64Extension;
public const int PackedSint32ExtensionFieldNumber = 94;
public static pb::GeneratedExtensionBase<scg::IList<int>> PackedSint32Extension;
public const int PackedSint64ExtensionFieldNumber = 95;
public static pb::GeneratedExtensionBase<scg::IList<long>> PackedSint64Extension;
public const int PackedFixed32ExtensionFieldNumber = 96;
+ [global::System.CLSCompliant(false)]
public static pb::GeneratedExtensionBase<scg::IList<uint>> PackedFixed32Extension;
public const int PackedFixed64ExtensionFieldNumber = 97;
+ [global::System.CLSCompliant(false)]
public static pb::GeneratedExtensionBase<scg::IList<ulong>> PackedFixed64Extension;
public const int PackedSfixed32ExtensionFieldNumber = 98;
public static pb::GeneratedExtensionBase<scg::IList<int>> PackedSfixed32Extension;
@@ -1605,6 +1621,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasOptionalUint32 {
get { return hasOptionalUint32; }
}
+ [global::System.CLSCompliant(false)]
public uint OptionalUint32 {
get { return optionalUint32_; }
}
@@ -1615,6 +1632,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasOptionalUint64 {
get { return hasOptionalUint64; }
}
+ [global::System.CLSCompliant(false)]
public ulong OptionalUint64 {
get { return optionalUint64_; }
}
@@ -1645,6 +1663,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasOptionalFixed32 {
get { return hasOptionalFixed32; }
}
+ [global::System.CLSCompliant(false)]
public uint OptionalFixed32 {
get { return optionalFixed32_; }
}
@@ -1655,6 +1674,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasOptionalFixed64 {
get { return hasOptionalFixed64; }
}
+ [global::System.CLSCompliant(false)]
public ulong OptionalFixed64 {
get { return optionalFixed64_; }
}
@@ -1845,24 +1865,28 @@ namespace Google.ProtocolBuffers.TestProtos {
public const int RepeatedUint32FieldNumber = 33;
private pbc::PopsicleList<uint> repeatedUint32_ = new pbc::PopsicleList<uint>();
+ [global::System.CLSCompliant(false)]
public scg::IList<uint> RepeatedUint32List {
get { return pbc::Lists.AsReadOnly(repeatedUint32_); }
}
public int RepeatedUint32Count {
get { return repeatedUint32_.Count; }
}
+ [global::System.CLSCompliant(false)]
public uint GetRepeatedUint32(int index) {
return repeatedUint32_[index];
}
public const int RepeatedUint64FieldNumber = 34;
private pbc::PopsicleList<ulong> repeatedUint64_ = new pbc::PopsicleList<ulong>();
+ [global::System.CLSCompliant(false)]
public scg::IList<ulong> RepeatedUint64List {
get { return pbc::Lists.AsReadOnly(repeatedUint64_); }
}
public int RepeatedUint64Count {
get { return repeatedUint64_.Count; }
}
+ [global::System.CLSCompliant(false)]
public ulong GetRepeatedUint64(int index) {
return repeatedUint64_[index];
}
@@ -1893,24 +1917,28 @@ namespace Google.ProtocolBuffers.TestProtos {
public const int RepeatedFixed32FieldNumber = 37;
private pbc::PopsicleList<uint> repeatedFixed32_ = new pbc::PopsicleList<uint>();
+ [global::System.CLSCompliant(false)]
public scg::IList<uint> RepeatedFixed32List {
get { return pbc::Lists.AsReadOnly(repeatedFixed32_); }
}
public int RepeatedFixed32Count {
get { return repeatedFixed32_.Count; }
}
+ [global::System.CLSCompliant(false)]
public uint GetRepeatedFixed32(int index) {
return repeatedFixed32_[index];
}
public const int RepeatedFixed64FieldNumber = 38;
private pbc::PopsicleList<ulong> repeatedFixed64_ = new pbc::PopsicleList<ulong>();
+ [global::System.CLSCompliant(false)]
public scg::IList<ulong> RepeatedFixed64List {
get { return pbc::Lists.AsReadOnly(repeatedFixed64_); }
}
public int RepeatedFixed64Count {
get { return repeatedFixed64_.Count; }
}
+ [global::System.CLSCompliant(false)]
public ulong GetRepeatedFixed64(int index) {
return repeatedFixed64_[index];
}
@@ -2133,6 +2161,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasDefaultUint32 {
get { return hasDefaultUint32; }
}
+ [global::System.CLSCompliant(false)]
public uint DefaultUint32 {
get { return defaultUint32_; }
}
@@ -2143,6 +2172,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasDefaultUint64 {
get { return hasDefaultUint64; }
}
+ [global::System.CLSCompliant(false)]
public ulong DefaultUint64 {
get { return defaultUint64_; }
}
@@ -2173,6 +2203,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasDefaultFixed32 {
get { return hasDefaultFixed32; }
}
+ [global::System.CLSCompliant(false)]
public uint DefaultFixed32 {
get { return defaultFixed32_; }
}
@@ -2183,6 +2214,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasDefaultFixed64 {
get { return hasDefaultFixed64; }
}
+ [global::System.CLSCompliant(false)]
public ulong DefaultFixed64 {
get { return defaultFixed64_; }
}
@@ -3632,10 +3664,12 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasOptionalUint32 {
get { return result.HasOptionalUint32; }
}
+ [global::System.CLSCompliant(false)]
public uint OptionalUint32 {
get { return result.OptionalUint32; }
set { SetOptionalUint32(value); }
}
+ [global::System.CLSCompliant(false)]
public Builder SetOptionalUint32(uint value) {
result.hasOptionalUint32 = true;
result.optionalUint32_ = value;
@@ -3650,10 +3684,12 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasOptionalUint64 {
get { return result.HasOptionalUint64; }
}
+ [global::System.CLSCompliant(false)]
public ulong OptionalUint64 {
get { return result.OptionalUint64; }
set { SetOptionalUint64(value); }
}
+ [global::System.CLSCompliant(false)]
public Builder SetOptionalUint64(ulong value) {
result.hasOptionalUint64 = true;
result.optionalUint64_ = value;
@@ -3704,10 +3740,12 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasOptionalFixed32 {
get { return result.HasOptionalFixed32; }
}
+ [global::System.CLSCompliant(false)]
public uint OptionalFixed32 {
get { return result.OptionalFixed32; }
set { SetOptionalFixed32(value); }
}
+ [global::System.CLSCompliant(false)]
public Builder SetOptionalFixed32(uint value) {
result.hasOptionalFixed32 = true;
result.optionalFixed32_ = value;
@@ -3722,10 +3760,12 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasOptionalFixed64 {
get { return result.HasOptionalFixed64; }
}
+ [global::System.CLSCompliant(false)]
public ulong OptionalFixed64 {
get { return result.OptionalFixed64; }
set { SetOptionalFixed64(value); }
}
+ [global::System.CLSCompliant(false)]
public Builder SetOptionalFixed64(ulong value) {
result.hasOptionalFixed64 = true;
result.optionalFixed64_ = value;
@@ -4153,23 +4193,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
+ [global::System.CLSCompliant(false)]
public scg::IList<uint> RepeatedUint32List {
get { return result.repeatedUint32_; }
}
public int RepeatedUint32Count {
get { return result.RepeatedUint32Count; }
}
+ [global::System.CLSCompliant(false)]
public uint GetRepeatedUint32(int index) {
return result.GetRepeatedUint32(index);
}
+ [global::System.CLSCompliant(false)]
public Builder SetRepeatedUint32(int index, uint value) {
result.repeatedUint32_[index] = value;
return this;
}
+ [global::System.CLSCompliant(false)]
public Builder AddRepeatedUint32(uint value) {
result.repeatedUint32_.Add(value);
return this;
}
+ [global::System.CLSCompliant(false)]
public Builder AddRangeRepeatedUint32(scg::IEnumerable<uint> values) {
base.AddRange(values, result.repeatedUint32_);
return this;
@@ -4179,23 +4224,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
+ [global::System.CLSCompliant(false)]
public scg::IList<ulong> RepeatedUint64List {
get { return result.repeatedUint64_; }
}
public int RepeatedUint64Count {
get { return result.RepeatedUint64Count; }
}
+ [global::System.CLSCompliant(false)]
public ulong GetRepeatedUint64(int index) {
return result.GetRepeatedUint64(index);
}
+ [global::System.CLSCompliant(false)]
public Builder SetRepeatedUint64(int index, ulong value) {
result.repeatedUint64_[index] = value;
return this;
}
+ [global::System.CLSCompliant(false)]
public Builder AddRepeatedUint64(ulong value) {
result.repeatedUint64_.Add(value);
return this;
}
+ [global::System.CLSCompliant(false)]
public Builder AddRangeRepeatedUint64(scg::IEnumerable<ulong> values) {
base.AddRange(values, result.repeatedUint64_);
return this;
@@ -4257,23 +4307,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
+ [global::System.CLSCompliant(false)]
public scg::IList<uint> RepeatedFixed32List {
get { return result.repeatedFixed32_; }
}
public int RepeatedFixed32Count {
get { return result.RepeatedFixed32Count; }
}
+ [global::System.CLSCompliant(false)]
public uint GetRepeatedFixed32(int index) {
return result.GetRepeatedFixed32(index);
}
+ [global::System.CLSCompliant(false)]
public Builder SetRepeatedFixed32(int index, uint value) {
result.repeatedFixed32_[index] = value;
return this;
}
+ [global::System.CLSCompliant(false)]
public Builder AddRepeatedFixed32(uint value) {
result.repeatedFixed32_.Add(value);
return this;
}
+ [global::System.CLSCompliant(false)]
public Builder AddRangeRepeatedFixed32(scg::IEnumerable<uint> values) {
base.AddRange(values, result.repeatedFixed32_);
return this;
@@ -4283,23 +4338,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
+ [global::System.CLSCompliant(false)]
public scg::IList<ulong> RepeatedFixed64List {
get { return result.repeatedFixed64_; }
}
public int RepeatedFixed64Count {
get { return result.RepeatedFixed64Count; }
}
+ [global::System.CLSCompliant(false)]
public ulong GetRepeatedFixed64(int index) {
return result.GetRepeatedFixed64(index);
}
+ [global::System.CLSCompliant(false)]
public Builder SetRepeatedFixed64(int index, ulong value) {
result.repeatedFixed64_[index] = value;
return this;
}
+ [global::System.CLSCompliant(false)]
public Builder AddRepeatedFixed64(ulong value) {
result.repeatedFixed64_.Add(value);
return this;
}
+ [global::System.CLSCompliant(false)]
public Builder AddRangeRepeatedFixed64(scg::IEnumerable<ulong> values) {
base.AddRange(values, result.repeatedFixed64_);
return this;
@@ -4820,10 +4880,12 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasDefaultUint32 {
get { return result.HasDefaultUint32; }
}
+ [global::System.CLSCompliant(false)]
public uint DefaultUint32 {
get { return result.DefaultUint32; }
set { SetDefaultUint32(value); }
}
+ [global::System.CLSCompliant(false)]
public Builder SetDefaultUint32(uint value) {
result.hasDefaultUint32 = true;
result.defaultUint32_ = value;
@@ -4838,10 +4900,12 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasDefaultUint64 {
get { return result.HasDefaultUint64; }
}
+ [global::System.CLSCompliant(false)]
public ulong DefaultUint64 {
get { return result.DefaultUint64; }
set { SetDefaultUint64(value); }
}
+ [global::System.CLSCompliant(false)]
public Builder SetDefaultUint64(ulong value) {
result.hasDefaultUint64 = true;
result.defaultUint64_ = value;
@@ -4892,10 +4956,12 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasDefaultFixed32 {
get { return result.HasDefaultFixed32; }
}
+ [global::System.CLSCompliant(false)]
public uint DefaultFixed32 {
get { return result.DefaultFixed32; }
set { SetDefaultFixed32(value); }
}
+ [global::System.CLSCompliant(false)]
public Builder SetDefaultFixed32(uint value) {
result.hasDefaultFixed32 = true;
result.defaultFixed32_ = value;
@@ -4910,10 +4976,12 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasDefaultFixed64 {
get { return result.HasDefaultFixed64; }
}
+ [global::System.CLSCompliant(false)]
public ulong DefaultFixed64 {
get { return result.DefaultFixed64; }
set { SetDefaultFixed64(value); }
}
+ [global::System.CLSCompliant(false)]
public Builder SetDefaultFixed64(ulong value) {
result.hasDefaultFixed64 = true;
result.defaultFixed64_ = value;
@@ -11975,6 +12043,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasLargeUint32 {
get { return hasLargeUint32; }
}
+ [global::System.CLSCompliant(false)]
public uint LargeUint32 {
get { return largeUint32_; }
}
@@ -11985,6 +12054,7 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasLargeUint64 {
get { return hasLargeUint64; }
}
+ [global::System.CLSCompliant(false)]
public ulong LargeUint64 {
get { return largeUint64_; }
}
@@ -12265,10 +12335,12 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasLargeUint32 {
get { return result.HasLargeUint32; }
}
+ [global::System.CLSCompliant(false)]
public uint LargeUint32 {
get { return result.LargeUint32; }
set { SetLargeUint32(value); }
}
+ [global::System.CLSCompliant(false)]
public Builder SetLargeUint32(uint value) {
result.hasLargeUint32 = true;
result.largeUint32_ = value;
@@ -12283,10 +12355,12 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasLargeUint64 {
get { return result.HasLargeUint64; }
}
+ [global::System.CLSCompliant(false)]
public ulong LargeUint64 {
get { return result.LargeUint64; }
set { SetLargeUint64(value); }
}
+ [global::System.CLSCompliant(false)]
public Builder SetLargeUint64(ulong value) {
result.hasLargeUint64 = true;
result.largeUint64_ = value;
@@ -12409,12 +12483,14 @@ namespace Google.ProtocolBuffers.TestProtos {
public const int PackedUint32FieldNumber = 92;
private int packedUint32MemoizedSerializedSize;
private pbc::PopsicleList<uint> packedUint32_ = new pbc::PopsicleList<uint>();
+ [global::System.CLSCompliant(false)]
public scg::IList<uint> PackedUint32List {
get { return pbc::Lists.AsReadOnly(packedUint32_); }
}
public int PackedUint32Count {
get { return packedUint32_.Count; }
}
+ [global::System.CLSCompliant(false)]
public uint GetPackedUint32(int index) {
return packedUint32_[index];
}
@@ -12422,12 +12498,14 @@ namespace Google.ProtocolBuffers.TestProtos {
public const int PackedUint64FieldNumber = 93;
private int packedUint64MemoizedSerializedSize;
private pbc::PopsicleList<ulong> packedUint64_ = new pbc::PopsicleList<ulong>();
+ [global::System.CLSCompliant(false)]
public scg::IList<ulong> PackedUint64List {
get { return pbc::Lists.AsReadOnly(packedUint64_); }
}
public int PackedUint64Count {
get { return packedUint64_.Count; }
}
+ [global::System.CLSCompliant(false)]
public ulong GetPackedUint64(int index) {
return packedUint64_[index];
}
@@ -12461,12 +12539,14 @@ namespace Google.ProtocolBuffers.TestProtos {
public const int PackedFixed32FieldNumber = 96;
private int packedFixed32MemoizedSerializedSize;
private pbc::PopsicleList<uint> packedFixed32_ = new pbc::PopsicleList<uint>();
+ [global::System.CLSCompliant(false)]
public scg::IList<uint> PackedFixed32List {
get { return pbc::Lists.AsReadOnly(packedFixed32_); }
}
public int PackedFixed32Count {
get { return packedFixed32_.Count; }
}
+ [global::System.CLSCompliant(false)]
public uint GetPackedFixed32(int index) {
return packedFixed32_[index];
}
@@ -12474,12 +12554,14 @@ namespace Google.ProtocolBuffers.TestProtos {
public const int PackedFixed64FieldNumber = 97;
private int packedFixed64MemoizedSerializedSize;
private pbc::PopsicleList<ulong> packedFixed64_ = new pbc::PopsicleList<ulong>();
+ [global::System.CLSCompliant(false)]
public scg::IList<ulong> PackedFixed64List {
get { return pbc::Lists.AsReadOnly(packedFixed64_); }
}
public int PackedFixed64Count {
get { return packedFixed64_.Count; }
}
+ [global::System.CLSCompliant(false)]
public ulong GetPackedFixed64(int index) {
return packedFixed64_[index];
}
@@ -13176,23 +13258,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
+ [global::System.CLSCompliant(false)]
public scg::IList<uint> PackedUint32List {
get { return result.packedUint32_; }
}
public int PackedUint32Count {
get { return result.PackedUint32Count; }
}
+ [global::System.CLSCompliant(false)]
public uint GetPackedUint32(int index) {
return result.GetPackedUint32(index);
}
+ [global::System.CLSCompliant(false)]
public Builder SetPackedUint32(int index, uint value) {
result.packedUint32_[index] = value;
return this;
}
+ [global::System.CLSCompliant(false)]
public Builder AddPackedUint32(uint value) {
result.packedUint32_.Add(value);
return this;
}
+ [global::System.CLSCompliant(false)]
public Builder AddRangePackedUint32(scg::IEnumerable<uint> values) {
base.AddRange(values, result.packedUint32_);
return this;
@@ -13202,23 +13289,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
+ [global::System.CLSCompliant(false)]
public scg::IList<ulong> PackedUint64List {
get { return result.packedUint64_; }
}
public int PackedUint64Count {
get { return result.PackedUint64Count; }
}
+ [global::System.CLSCompliant(false)]
public ulong GetPackedUint64(int index) {
return result.GetPackedUint64(index);
}
+ [global::System.CLSCompliant(false)]
public Builder SetPackedUint64(int index, ulong value) {
result.packedUint64_[index] = value;
return this;
}
+ [global::System.CLSCompliant(false)]
public Builder AddPackedUint64(ulong value) {
result.packedUint64_.Add(value);
return this;
}
+ [global::System.CLSCompliant(false)]
public Builder AddRangePackedUint64(scg::IEnumerable<ulong> values) {
base.AddRange(values, result.packedUint64_);
return this;
@@ -13280,23 +13372,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
+ [global::System.CLSCompliant(false)]
public scg::IList<uint> PackedFixed32List {
get { return result.packedFixed32_; }
}
public int PackedFixed32Count {
get { return result.PackedFixed32Count; }
}
+ [global::System.CLSCompliant(false)]
public uint GetPackedFixed32(int index) {
return result.GetPackedFixed32(index);
}
+ [global::System.CLSCompliant(false)]
public Builder SetPackedFixed32(int index, uint value) {
result.packedFixed32_[index] = value;
return this;
}
+ [global::System.CLSCompliant(false)]
public Builder AddPackedFixed32(uint value) {
result.packedFixed32_.Add(value);
return this;
}
+ [global::System.CLSCompliant(false)]
public Builder AddRangePackedFixed32(scg::IEnumerable<uint> values) {
base.AddRange(values, result.packedFixed32_);
return this;
@@ -13306,23 +13403,28 @@ namespace Google.ProtocolBuffers.TestProtos {
return this;
}
+ [global::System.CLSCompliant(false)]
public scg::IList<ulong> PackedFixed64List {
get { return result.packedFixed64_; }
}
public int PackedFixed64Count {
get { return result.PackedFixed64Count; }
}
+ [global::System.CLSCompliant(false)]
public ulong GetPackedFixed64(int index) {
return result.GetPackedFixed64(index);
}
+ [global::System.CLSCompliant(false)]
public Builder SetPackedFixed64(int index, ulong value) {
result.packedFixed64_[index] = value;
return this;
}
+ [global::System.CLSCompliant(false)]
public Builder AddPackedFixed64(ulong value) {
result.packedFixed64_.Add(value);
return this;
}
+ [global::System.CLSCompliant(false)]
public Builder AddRangePackedFixed64(scg::IEnumerable<ulong> values) {
base.AddRange(values, result.packedFixed64_);
return this;
diff --git a/src/ProtocolBuffers/CodedInputStream.cs b/src/ProtocolBuffers/CodedInputStream.cs
index 04308554..132773c9 100644
--- a/src/ProtocolBuffers/CodedInputStream.cs
+++ b/src/ProtocolBuffers/CodedInputStream.cs
@@ -126,6 +126,7 @@ namespace Google.ProtocolBuffers {
/// </summary>
/// <exception cref="InvalidProtocolBufferException">The last
/// tag read was not the one specified</exception>
+ [CLSCompliant(false)]
public void CheckLastTagWas(uint value) {
if (lastTag != value) {
throw InvalidProtocolBufferException.InvalidEndTag();
@@ -140,6 +141,7 @@ namespace Google.ProtocolBuffers {
/// since a protocol message may legally end wherever a tag occurs, and
/// zero is not a valid tag number.
/// </summary>
+ [CLSCompliant(false)]
public uint ReadTag() {
if (IsAtEnd) {
lastTag = 0;
@@ -175,6 +177,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Read a uint64 field from the stream.
/// </summary>
+ [CLSCompliant(false)]
public ulong ReadUInt64() {
return ReadRawVarint64();
}
@@ -196,6 +199,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Read a fixed64 field from the stream.
/// </summary>
+ [CLSCompliant(false)]
public ulong ReadFixed64() {
return ReadRawLittleEndian64();
}
@@ -203,6 +207,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Read a fixed32 field from the stream.
/// </summary>
+ [CLSCompliant(false)]
public uint ReadFixed32() {
return ReadRawLittleEndian32();
}
@@ -298,6 +303,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Reads a uint32 field value from the stream.
/// </summary>
+ [CLSCompliant(false)]
public uint ReadUInt32() {
return ReadRawVarint32();
}
@@ -418,6 +424,7 @@ namespace Google.ProtocolBuffers {
/// That means we can check the size just once, then just read directly from the buffer
/// without constant rechecking of the buffer length.
/// </summary>
+ [CLSCompliant(false)]
public uint ReadRawVarint32() {
if (bufferPos + 5 > bufferSize) {
return SlowReadRawVarint32();
@@ -495,6 +502,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Read a raw varint from the stream.
/// </summary>
+ [CLSCompliant(false)]
public ulong ReadRawVarint64() {
int shift = 0;
ulong result = 0;
@@ -512,6 +520,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Read a 32-bit little-endian integer from the stream.
/// </summary>
+ [CLSCompliant(false)]
public uint ReadRawLittleEndian32() {
uint b1 = ReadRawByte();
uint b2 = ReadRawByte();
@@ -523,6 +532,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Read a 64-bit little-endian integer from the stream.
/// </summary>
+ [CLSCompliant(false)]
public ulong ReadRawLittleEndian64() {
ulong b1 = ReadRawByte();
ulong b2 = ReadRawByte();
@@ -546,6 +556,7 @@ namespace Google.ProtocolBuffers {
/// sign-extended to 64 bits to be varint encoded, thus always taking
/// 10 bytes on the wire.)
/// </remarks>
+ [CLSCompliant(false)]
public static int DecodeZigZag32(uint n) {
return (int)(n >> 1) ^ -(int)(n & 1);
}
@@ -559,6 +570,7 @@ namespace Google.ProtocolBuffers {
/// sign-extended to 64 bits to be varint encoded, thus always taking
/// 10 bytes on the wire.)
/// </remarks>
+ [CLSCompliant(false)]
public static long DecodeZigZag64(ulong n) {
return (long)(n >> 1) ^ -(long)(n & 1);
}
@@ -849,6 +861,7 @@ namespace Google.ProtocolBuffers {
/// </summary>
/// <returns>false if the tag is an end-group tag, in which case
/// nothing is skipped. Otherwise, returns true.</returns>
+ [CLSCompliant(false)]
public bool SkipField(uint tag) {
switch (WireFormat.GetTagWireType(tag)) {
case WireFormat.WireType.Varint:
diff --git a/src/ProtocolBuffers/CodedOutputStream.cs b/src/ProtocolBuffers/CodedOutputStream.cs
index 7cc5ff46..e5f890f9 100644
--- a/src/ProtocolBuffers/CodedOutputStream.cs
+++ b/src/ProtocolBuffers/CodedOutputStream.cs
@@ -133,6 +133,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Writes a uint64 field value, including tag, to the stream.
/// </summary>
+ [CLSCompliant(false)]
public void WriteUInt64(int fieldNumber, ulong value) {
WriteTag(fieldNumber, WireFormat.WireType.Varint);
WriteRawVarint64(value);
@@ -162,6 +163,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Writes a fixed64 field value, including tag, to the stream.
/// </summary>
+ [CLSCompliant(false)]
public void WriteFixed64(int fieldNumber, ulong value) {
WriteTag(fieldNumber, WireFormat.WireType.Fixed64);
WriteRawLittleEndian64(value);
@@ -170,6 +172,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Writes a fixed32 field value, including tag, to the stream.
/// </summary>
+ [CLSCompliant(false)]
public void WriteFixed32(int fieldNumber, uint value) {
WriteTag(fieldNumber, WireFormat.WireType.Fixed32);
WriteRawLittleEndian32(value);
@@ -230,6 +233,7 @@ namespace Google.ProtocolBuffers {
WriteRawBytes(bytes);
}
+ [CLSCompliant(false)]
public void WriteUInt32(int fieldNumber, uint value) {
WriteTag(fieldNumber, WireFormat.WireType.Varint);
WriteRawVarint32(value);
@@ -344,6 +348,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Writes a uint64 field value, without a tag, to the stream.
/// </summary>
+ [CLSCompliant(false)]
public void WriteUInt64NoTag(ulong value) {
WriteRawVarint64(value);
}
@@ -370,6 +375,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Writes a fixed64 field value, without a tag, to the stream.
/// </summary>
+ [CLSCompliant(false)]
public void WriteFixed64NoTag(ulong value) {
WriteRawLittleEndian64(value);
}
@@ -377,6 +383,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Writes a fixed32 field value, without a tag, to the stream.
/// </summary>
+ [CLSCompliant(false)]
public void WriteFixed32NoTag(uint value) {
WriteRawLittleEndian32(value);
}
@@ -424,6 +431,7 @@ namespace Google.ProtocolBuffers {
WriteRawBytes(bytes);
}
+ [CLSCompliant(false)]
public void WriteUInt32NoTag(uint value) {
WriteRawVarint32(value);
}
@@ -454,6 +462,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Encodes and writes a tag.
/// </summary>
+ [CLSCompliant(false)]
public void WriteTag(int fieldNumber, WireFormat.WireType type) {
WriteRawVarint32(WireFormat.MakeTag(fieldNumber, type));
}
@@ -475,6 +484,7 @@ namespace Google.ProtocolBuffers {
/// there's enough buffer space left to whizz through without checking
/// for each byte; otherwise, we resort to calling WriteRawByte each time.
/// </summary>
+ [CLSCompliant(false)]
public void WriteRawVarint32(uint value) {
if (position + 5 > limit) {
SlowWriteRawVarint32(value);
@@ -492,6 +502,7 @@ namespace Google.ProtocolBuffers {
}
}
+ [CLSCompliant(false)]
public void WriteRawVarint64(ulong value) {
while (true) {
if ((value & ~0x7FUL) == 0) {
@@ -504,6 +515,7 @@ namespace Google.ProtocolBuffers {
}
}
+ [CLSCompliant(false)]
public void WriteRawLittleEndian32(uint value) {
WriteRawByte((byte)value);
WriteRawByte((byte)(value >> 8));
@@ -511,6 +523,7 @@ namespace Google.ProtocolBuffers {
WriteRawByte((byte)(value >> 24));
}
+ [CLSCompliant(false)]
public void WriteRawLittleEndian64(ulong value) {
WriteRawByte((byte)value);
WriteRawByte((byte)(value >> 8));
@@ -530,6 +543,7 @@ namespace Google.ProtocolBuffers {
buffer[position++] = value;
}
+ [CLSCompliant(false)]
public void WriteRawByte(uint value) {
WriteRawByte((byte)value);
}
@@ -599,6 +613,7 @@ namespace Google.ProtocolBuffers {
/// Compute the number of bytes that would be needed to encode a
/// uint64 field, including the tag.
/// </summary>
+ [CLSCompliant(false)]
public static int ComputeUInt64Size(int fieldNumber, ulong value) {
return ComputeTagSize(fieldNumber) + ComputeRawVarint64Size(value);
}
@@ -628,6 +643,7 @@ namespace Google.ProtocolBuffers {
/// Compute the number of bytes that would be needed to encode a
/// fixed64 field, including the tag.
/// </summary>
+ [CLSCompliant(false)]
public static int ComputeFixed64Size(int fieldNumber, ulong value) {
return ComputeTagSize(fieldNumber) + LittleEndian64Size;
}
@@ -636,6 +652,7 @@ namespace Google.ProtocolBuffers {
/// Compute the number of bytes that would be needed to encode a
/// fixed32 field, including the tag.
/// </summary>
+ [CLSCompliant(false)]
public static int ComputeFixed32Size(int fieldNumber, uint value) {
return ComputeTagSize(fieldNumber) + LittleEndian32Size;
}
@@ -699,6 +716,7 @@ namespace Google.ProtocolBuffers {
/// Compute the number of bytes that would be needed to encode a
/// uint32 field, including the tag.
/// </summary>
+ [CLSCompliant(false)]
public static int ComputeUInt32Size(int fieldNumber, uint value) {
return ComputeTagSize(fieldNumber) + ComputeRawVarint32Size(value);
}
@@ -764,6 +782,7 @@ namespace Google.ProtocolBuffers {
/// Compute the number of bytes that would be needed to encode a
/// uint64 field, including the tag.
/// </summary>
+ [CLSCompliant(false)]
public static int ComputeUInt64SizeNoTag(ulong value) {
return ComputeRawVarint64Size(value);
}
@@ -793,6 +812,7 @@ namespace Google.ProtocolBuffers {
/// Compute the number of bytes that would be needed to encode a
/// fixed64 field, including the tag.
/// </summary>
+ [CLSCompliant(false)]
public static int ComputeFixed64SizeNoTag(ulong value) {
return LittleEndian64Size;
}
@@ -801,6 +821,7 @@ namespace Google.ProtocolBuffers {
/// Compute the number of bytes that would be needed to encode a
/// fixed32 field, including the tag.
/// </summary>
+ [CLSCompliant(false)]
public static int ComputeFixed32SizeNoTag(uint value) {
return LittleEndian32Size;
}
@@ -861,6 +882,7 @@ namespace Google.ProtocolBuffers {
/// Compute the number of bytes that would be needed to encode a
/// uint32 field, including the tag.
/// </summary>
+ [CLSCompliant(false)]
public static int ComputeUInt32SizeNoTag(uint value) {
return ComputeRawVarint32Size(value);
}
@@ -936,6 +958,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Compute the number of bytes that would be needed to encode a varint.
/// </summary>
+ [CLSCompliant(false)]
public static int ComputeRawVarint32Size(uint value) {
if ((value & (0xffffffff << 7)) == 0) return 1;
if ((value & (0xffffffff << 14)) == 0) return 2;
@@ -947,6 +970,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Compute the number of bytes that would be needed to encode a varint.
/// </summary>
+ [CLSCompliant(false)]
public static int ComputeRawVarint64Size(ulong value) {
if ((value & (0xffffffffffffffffL << 7)) == 0) return 1;
if ((value & (0xffffffffffffffffL << 14)) == 0) return 2;
@@ -1035,6 +1059,7 @@ namespace Google.ProtocolBuffers {
/// sign-extended to 64 bits to be varint encoded, thus always taking
/// 10 bytes on the wire.)
/// </remarks>
+ [CLSCompliant(false)]
public static uint EncodeZigZag32(int n) {
// Note: the right-shift must be arithmetic
return (uint)((n << 1) ^ (n >> 31));
@@ -1049,6 +1074,7 @@ namespace Google.ProtocolBuffers {
/// sign-extended to 64 bits to be varint encoded, thus always taking
/// 10 bytes on the wire.)
/// </remarks>
+ [CLSCompliant(false)]
public static ulong EncodeZigZag64(long n) {
return (ulong)((n << 1) ^ (n >> 63));
}
diff --git a/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs b/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs
index fef56372..03c4615c 100644
--- a/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs
+++ b/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs
@@ -6427,6 +6427,7 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public bool HasPositiveIntValue {
get { return hasPositiveIntValue; }
}
+ [global::System.CLSCompliant(false)]
public ulong PositiveIntValue {
get { return positiveIntValue_; }
}
@@ -6751,10 +6752,12 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
public bool HasPositiveIntValue {
get { return result.HasPositiveIntValue; }
}
+ [global::System.CLSCompliant(false)]
public ulong PositiveIntValue {
get { return result.PositiveIntValue; }
set { SetPositiveIntValue(value); }
}
+ [global::System.CLSCompliant(false)]
public Builder SetPositiveIntValue(ulong value) {
result.hasPositiveIntValue = true;
result.positiveIntValue_ = value;
diff --git a/src/ProtocolBuffers/Descriptors/FieldDescriptor.cs b/src/ProtocolBuffers/Descriptors/FieldDescriptor.cs
index cd1477ac..7d99ed21 100644
--- a/src/ProtocolBuffers/Descriptors/FieldDescriptor.cs
+++ b/src/ProtocolBuffers/Descriptors/FieldDescriptor.cs
@@ -278,6 +278,10 @@ namespace Google.ProtocolBuffers.Descriptors {
get { return fieldType; }
}
+ public bool IsCLSCompliant {
+ get { return mappedType != MappedType.UInt32 && mappedType != MappedType.UInt64; }
+ }
+
public int FieldNumber {
get { return Proto.Number; }
}
diff --git a/src/ProtocolBuffers/ExtendableBuilder.cs b/src/ProtocolBuffers/ExtendableBuilder.cs
index b88f2994..db8e0939 100644
--- a/src/ProtocolBuffers/ExtendableBuilder.cs
+++ b/src/ProtocolBuffers/ExtendableBuilder.cs
@@ -29,6 +29,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+using System;
using System.Collections.Generic;
using Google.ProtocolBuffers.Descriptors;
@@ -111,6 +112,7 @@ namespace Google.ProtocolBuffers {
/// Called by subclasses to parse an unknown field or an extension.
/// </summary>
/// <returns>true unless the tag is an end-group tag</returns>
+ [CLSCompliant(false)]
protected override bool ParseUnknownField(CodedInputStream input, UnknownFieldSet.Builder unknownFields,
ExtensionRegistry extensionRegistry, uint tag) {
return unknownFields.MergeFieldFrom(input, extensionRegistry, this, tag);
diff --git a/src/ProtocolBuffers/GeneratedBuilder.cs b/src/ProtocolBuffers/GeneratedBuilder.cs
index cdef93f6..638279e7 100644
--- a/src/ProtocolBuffers/GeneratedBuilder.cs
+++ b/src/ProtocolBuffers/GeneratedBuilder.cs
@@ -99,6 +99,7 @@ namespace Google.ProtocolBuffers {
/// Called by derived classes to parse an unknown field.
/// </summary>
/// <returns>true unless the tag is an end-group tag</returns>
+ [CLSCompliant(false)]
protected virtual bool ParseUnknownField(CodedInputStream input, UnknownFieldSet.Builder unknownFields,
ExtensionRegistry extensionRegistry, uint tag) {
return unknownFields.MergeFieldFrom(tag, input);
diff --git a/src/ProtocolBuffers/Properties/AssemblyInfo.cs b/src/ProtocolBuffers/Properties/AssemblyInfo.cs
index 21bf418e..8d587d18 100644
--- a/src/ProtocolBuffers/Properties/AssemblyInfo.cs
+++ b/src/ProtocolBuffers/Properties/AssemblyInfo.cs
@@ -29,6 +29,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
@@ -77,3 +78,4 @@ using System.Runtime.CompilerServices;
"5e09a6084558f989ccde66094f07822808d3a9b922b0e85b912070032e90bb35360be7efb7982b" +
"702d7a5c6ed1e21d8ca587b4f4c9d2b81210d3641cc75f506cdfc628ac5453ff0a6886986c981d" +
"12245bc7")]
+[assembly: CLSCompliant(true)] \ No newline at end of file
diff --git a/src/ProtocolBuffers/UnknownField.cs b/src/ProtocolBuffers/UnknownField.cs
index 1873e302..62b96feb 100644
--- a/src/ProtocolBuffers/UnknownField.cs
+++ b/src/ProtocolBuffers/UnknownField.cs
@@ -29,6 +29,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Google.ProtocolBuffers.Collections;
@@ -292,6 +293,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Adds a varint value.
/// </summary>
+ [CLSCompliant(false)]
public Builder AddVarint(ulong value) {
varintList = Add(varintList, value);
return this;
@@ -300,6 +302,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Adds a fixed32 value.
/// </summary>
+ [CLSCompliant(false)]
public Builder AddFixed32(uint value) {
fixed32List = Add(fixed32List, value);
return this;
@@ -308,6 +311,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Adds a fixed64 value.
/// </summary>
+ [CLSCompliant(false)]
public Builder AddFixed64(ulong value) {
fixed64List = Add(fixed64List, value);
return this;
diff --git a/src/ProtocolBuffers/UnknownFieldSet.cs b/src/ProtocolBuffers/UnknownFieldSet.cs
index f8cbce4c..9de09709 100644
--- a/src/ProtocolBuffers/UnknownFieldSet.cs
+++ b/src/ProtocolBuffers/UnknownFieldSet.cs
@@ -339,6 +339,7 @@ namespace Google.ProtocolBuffers {
/// <param name="tag">The field's tag number, which was already parsed.</param>
/// <param name="input">The coded input stream containing the field</param>
/// <returns>false if the tag is an "end group" tag, true otherwise</returns>
+ [CLSCompliant(false)]
public bool MergeFieldFrom(uint tag, CodedInputStream input) {
int number = WireFormat.GetTagFieldNumber(tag);
switch (WireFormat.GetTagWireType(tag)) {
@@ -408,6 +409,7 @@ namespace Google.ProtocolBuffers {
/// value. This is used in particular when an unknown enum value is
/// encountered.
/// </summary>
+ [CLSCompliant(false)]
public Builder MergeVarintField(int number, ulong value) {
if (number == 0) {
throw new ArgumentOutOfRangeException("number", "Zero is not a valid field number.");
diff --git a/src/ProtocolBuffers/WireFormat.cs b/src/ProtocolBuffers/WireFormat.cs
index 8f723d54..2b850533 100644
--- a/src/ProtocolBuffers/WireFormat.cs
+++ b/src/ProtocolBuffers/WireFormat.cs
@@ -58,7 +58,7 @@ namespace Google.ProtocolBuffers {
internal const int BoolSize = 1;
#endregion
-
+ [CLSCompliant(false)]
public enum WireType : uint {
Varint = 0,
Fixed64 = 1,
@@ -87,10 +87,12 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Given a tag value, determines the wire type (lower 3 bits).
/// </summary>
+ [CLSCompliant(false)]
public static WireType GetTagWireType(uint tag) {
return (WireType) (tag & TagTypeMask);
}
+ [CLSCompliant(false)]
public static bool IsEndGroupTag(uint tag) {
return (WireType)(tag & TagTypeMask) == WireType.EndGroup;
}
@@ -98,6 +100,7 @@ namespace Google.ProtocolBuffers {
/// <summary>
/// Given a tag value, determines the field number (the upper 29 bits).
/// </summary>
+ [CLSCompliant(false)]
public static int GetTagFieldNumber(uint tag) {
return (int) tag >> TagTypeBits;
}
@@ -106,10 +109,12 @@ namespace Google.ProtocolBuffers {
/// Makes a tag value given a field number and wire type.
/// TODO(jonskeet): Should we just have a Tag structure?
/// </summary>
+ [CLSCompliant(false)]
public static uint MakeTag(int fieldNumber, WireType wireType) {
return (uint) (fieldNumber << TagTypeBits) | (uint) wireType;
}
+ [CLSCompliant(false)]
public static uint MakeTag(FieldDescriptor field) {
return MakeTag(field.FieldNumber, GetWireType(field));
}
@@ -126,6 +131,7 @@ namespace Google.ProtocolBuffers {
/// Converts a field type to its wire type. Done with a switch for the sake
/// of speed - this is significantly faster than a dictionary lookup.
/// </summary>
+ [CLSCompliant(false)]
public static WireType GetWireType(FieldType fieldType) {
switch (fieldType) {
case FieldType.Double: