summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno da Silva Belo <brunodasilvabelo@gmail.com>2019-12-23 22:15:50 +0000
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2019-12-26 14:46:16 -0300
commitcf37047a7c77e4ce7d76bbbfd93a042d59ac2771 (patch)
tree1983614e397e9c4eadcb90329640d10f871e2007
parent55e9d31569eabe313a60cc2ea2ccb103d52ab203 (diff)
c#: Checking null for parameters.
Checking for non-generated code. ref T8399 Reviewed-by: Felipe Magno de Almeida <felipe@expertisesolutions.com.br> Differential Revision: https://phab.enlightenment.org/D10959
-rw-r--r--src/bindings/mono/eina_mono/eina_array.cs2
-rw-r--r--src/bindings/mono/eina_mono/eina_binbuf.cs4
-rw-r--r--src/bindings/mono/eina_mono/eina_inarray.cs2
-rw-r--r--src/bindings/mono/eina_mono/eina_inlist.cs2
-rw-r--r--src/bindings/mono/eina_mono/eina_list.cs2
-rw-r--r--src/bindings/mono/eina_mono/eina_promises.cs4
-rw-r--r--src/bindings/mono/eina_mono/eina_slice.cs2
-rw-r--r--src/bindings/mono/eina_mono/eina_value.cs28
-rw-r--r--src/bindings/mono/eldbus_mono/eldbus_common.cs23
-rw-r--r--src/bindings/mono/eldbus_mono/eldbus_message.cs2
-rw-r--r--src/bindings/mono/eldbus_mono/eldbus_proxy.cs2
11 files changed, 71 insertions, 2 deletions
diff --git a/src/bindings/mono/eina_mono/eina_array.cs b/src/bindings/mono/eina_mono/eina_array.cs
index 37251be6cd..ba3809bf81 100644
--- a/src/bindings/mono/eina_mono/eina_array.cs
+++ b/src/bindings/mono/eina_mono/eina_array.cs
@@ -20,6 +20,7 @@ using System.Runtime.InteropServices;
20using System.Collections.Generic; 20using System.Collections.Generic;
21using System.ComponentModel; 21using System.ComponentModel;
22using System.Diagnostics.CodeAnalysis; 22using System.Diagnostics.CodeAnalysis;
23using System.Diagnostics.Contracts;
23 24
24using static Eina.TraitFunctions; 25using static Eina.TraitFunctions;
25using static Eina.ArrayNativeFunctions; 26using static Eina.ArrayNativeFunctions;
@@ -468,6 +469,7 @@ public class Array<T> : IList<T>, IEnumerable<T>, IDisposable
468 /// </summary> 469 /// </summary>
469 public bool Append(T[] values) 470 public bool Append(T[] values)
470 { 471 {
472 Contract.Requires(values != null, nameof(values));
471 foreach (T v in values) 473 foreach (T v in values)
472 { 474 {
473 if (!Push(v)) 475 if (!Push(v))
diff --git a/src/bindings/mono/eina_mono/eina_binbuf.cs b/src/bindings/mono/eina_mono/eina_binbuf.cs
index 24e93e8d9d..6cc79f9625 100644
--- a/src/bindings/mono/eina_mono/eina_binbuf.cs
+++ b/src/bindings/mono/eina_mono/eina_binbuf.cs
@@ -18,6 +18,7 @@
18using System; 18using System;
19using System.Runtime.InteropServices; 19using System.Runtime.InteropServices;
20using System.ComponentModel; 20using System.ComponentModel;
21using System.Diagnostics.Contracts;
21 22
22namespace Eina 23namespace Eina
23{ 24{
@@ -214,6 +215,7 @@ public class Binbuf : IDisposable
214 /// <returns>true on success, false if data could not be appended.</returns> 215 /// <returns>true on success, false if data could not be appended.</returns>
215 public bool Append(byte[] str) 216 public bool Append(byte[] str)
216 { 217 {
218 Contract.Requires(str != null, nameof(str));
217 return 0 != eina_binbuf_append_length(Handle, str, (UIntPtr)(str.Length)); 219 return 0 != eina_binbuf_append_length(Handle, str, (UIntPtr)(str.Length));
218 } 220 }
219 221
@@ -238,6 +240,7 @@ public class Binbuf : IDisposable
238 /// <returns>true on success, false if data could not be appended.</returns> 240 /// <returns>true on success, false if data could not be appended.</returns>
239 public bool Append(Binbuf bb) 241 public bool Append(Binbuf bb)
240 { 242 {
243 Contract.Requires(bb != null, nameof(bb));
241 return 0 != eina_binbuf_append_buffer(Handle, bb.Handle); 244 return 0 != eina_binbuf_append_buffer(Handle, bb.Handle);
242 } 245 }
243 246
@@ -273,6 +276,7 @@ public class Binbuf : IDisposable
273 /// <returns>true on success, false if data could not be appended.</returns> 276 /// <returns>true on success, false if data could not be appended.</returns>
274 public bool Insert(byte[] str, uint pos) 277 public bool Insert(byte[] str, uint pos)
275 { 278 {
279 Contract.Requires(str != null, nameof(str));
276 return 0 != eina_binbuf_insert_length(Handle, str, (UIntPtr)(str.Length), (UIntPtr)pos); 280 return 0 != eina_binbuf_insert_length(Handle, str, (UIntPtr)(str.Length), (UIntPtr)pos);
277 } 281 }
278 282
diff --git a/src/bindings/mono/eina_mono/eina_inarray.cs b/src/bindings/mono/eina_mono/eina_inarray.cs
index b88570833d..6bb8626e8a 100644
--- a/src/bindings/mono/eina_mono/eina_inarray.cs
+++ b/src/bindings/mono/eina_mono/eina_inarray.cs
@@ -20,6 +20,7 @@ using System.Runtime.InteropServices;
20using System.Collections.Generic; 20using System.Collections.Generic;
21using System.ComponentModel; 21using System.ComponentModel;
22using System.Diagnostics.CodeAnalysis; 22using System.Diagnostics.CodeAnalysis;
23using System.Diagnostics.Contracts;
23 24
24using static Eina.TraitFunctions; 25using static Eina.TraitFunctions;
25using static Eina.InarrayNativeFunctions; 26using static Eina.InarrayNativeFunctions;
@@ -485,6 +486,7 @@ public class Inarray<T> : IEnumerable<T>, IDisposable
485 /// <returns>true on success, false otherwise.</returns> 486 /// <returns>true on success, false otherwise.</returns>
486 public bool Append(T[] values) 487 public bool Append(T[] values)
487 { 488 {
489 Contract.Requires(values != null, nameof(values));
488 foreach (T v in values) 490 foreach (T v in values)
489 { 491 {
490 if (Push(v) == -1) 492 if (Push(v) == -1)
diff --git a/src/bindings/mono/eina_mono/eina_inlist.cs b/src/bindings/mono/eina_mono/eina_inlist.cs
index cef686b469..3d2670e169 100644
--- a/src/bindings/mono/eina_mono/eina_inlist.cs
+++ b/src/bindings/mono/eina_mono/eina_inlist.cs
@@ -20,6 +20,7 @@ using System.Runtime.InteropServices;
20using System.Collections.Generic; 20using System.Collections.Generic;
21using System.ComponentModel; 21using System.ComponentModel;
22using System.Diagnostics.CodeAnalysis; 22using System.Diagnostics.CodeAnalysis;
23using System.Diagnostics.Contracts;
23 24
24using static Eina.TraitFunctions; 25using static Eina.TraitFunctions;
25using static Eina.InlistNativeFunctions; 26using static Eina.InlistNativeFunctions;
@@ -422,6 +423,7 @@ public class Inlist<T> : IEnumerable<T>, IDisposable
422 /// <param name="values">The values to be added.</param> 423 /// <param name="values">The values to be added.</param>
423 public void AppendArray(T[] values) 424 public void AppendArray(T[] values)
424 { 425 {
426 Contract.Requires(values != null, nameof(values));
425 foreach (T v in values) 427 foreach (T v in values)
426 { 428 {
427 Append(v); 429 Append(v);
diff --git a/src/bindings/mono/eina_mono/eina_list.cs b/src/bindings/mono/eina_mono/eina_list.cs
index 667b80834f..f4882d0afc 100644
--- a/src/bindings/mono/eina_mono/eina_list.cs
+++ b/src/bindings/mono/eina_mono/eina_list.cs
@@ -20,6 +20,7 @@ using System.Runtime.InteropServices;
20using System.Collections.Generic; 20using System.Collections.Generic;
21using System.ComponentModel; 21using System.ComponentModel;
22using System.Diagnostics.CodeAnalysis; 22using System.Diagnostics.CodeAnalysis;
23using System.Diagnostics.Contracts;
23 24
24using static Eina.TraitFunctions; 25using static Eina.TraitFunctions;
25using static Eina.ListNativeFunctions; 26using static Eina.ListNativeFunctions;
@@ -533,6 +534,7 @@ public class List<T> : IList<T>, IEnumerable<T>, IDisposable
533 /// <param name="values">The values to be appended.</param> 534 /// <param name="values">The values to be appended.</param>
534 public void Append(T[] values) 535 public void Append(T[] values)
535 { 536 {
537 Contract.Requires(values != null, nameof(values));
536 RequireWritable(); 538 RequireWritable();
537 539
538 foreach (T v in values) 540 foreach (T v in values)
diff --git a/src/bindings/mono/eina_mono/eina_promises.cs b/src/bindings/mono/eina_mono/eina_promises.cs
index 4b14a0d894..9f725add3c 100644
--- a/src/bindings/mono/eina_mono/eina_promises.cs
+++ b/src/bindings/mono/eina_mono/eina_promises.cs
@@ -18,7 +18,7 @@ using System.Runtime.InteropServices;
18using System.Collections.Generic; 18using System.Collections.Generic;
19using System.Linq; 19using System.Linq;
20using System.ComponentModel; 20using System.ComponentModel;
21 21using System.Diagnostics.Contracts;
22 22
23using static Eina.EinaNative.PromiseNativeMethods; 23using static Eina.EinaNative.PromiseNativeMethods;
24 24
@@ -207,6 +207,7 @@ public class Promise : IDisposable
207 /// </summary> 207 /// </summary>
208 public void Resolve(Eina.Value value) 208 public void Resolve(Eina.Value value)
209 { 209 {
210 Contract.Requires(value != null, nameof(value));
210 SanityChecks(); 211 SanityChecks();
211 eina_promise_resolve(this.Handle, value); 212 eina_promise_resolve(this.Handle, value);
212 // Promise will take care of releasing this value correctly. 213 // Promise will take care of releasing this value correctly.
@@ -280,6 +281,7 @@ public class Future
280 /// <param name="cb">The callback to be called when the attached promise resolves.</param> 281 /// <param name="cb">The callback to be called when the attached promise resolves.</param>
281 public Future(Promise promise, ResolvedCb cb = null) 282 public Future(Promise promise, ResolvedCb cb = null)
282 { 283 {
284 Contract.Requires(promise != null, nameof(promise));
283 IntPtr intermediate = eina_future_new(promise.Handle); 285 IntPtr intermediate = eina_future_new(promise.Handle);
284 Handle = ThenRaw(intermediate, (Eina.Value value) => 286 Handle = ThenRaw(intermediate, (Eina.Value value) =>
285 { 287 {
diff --git a/src/bindings/mono/eina_mono/eina_slice.cs b/src/bindings/mono/eina_mono/eina_slice.cs
index e47da1071c..912ddea3bd 100644
--- a/src/bindings/mono/eina_mono/eina_slice.cs
+++ b/src/bindings/mono/eina_mono/eina_slice.cs
@@ -18,6 +18,7 @@
18using System; 18using System;
19using System.Runtime.InteropServices; 19using System.Runtime.InteropServices;
20using System.ComponentModel; 20using System.ComponentModel;
21using System.Diagnostics.Contracts;
21 22
22namespace Eina 23namespace Eina
23{ 24{
@@ -235,6 +236,7 @@ public static class Eina_SliceUtils
235{ 236{
236 public static byte[] GetBytes(this Eina.ISliceBase slc) 237 public static byte[] GetBytes(this Eina.ISliceBase slc)
237 { 238 {
239 Contract.Requires(slc != null, nameof(slc));
238 var size = (int)(slc.Len); 240 var size = (int)(slc.Len);
239 byte[] mArray = new byte[size]; 241 byte[] mArray = new byte[size];
240 Marshal.Copy(slc.Mem, mArray, 0, size); 242 Marshal.Copy(slc.Mem, mArray, 0, size);
diff --git a/src/bindings/mono/eina_mono/eina_value.cs b/src/bindings/mono/eina_mono/eina_value.cs
index 5b203812da..46d1ff02b5 100644
--- a/src/bindings/mono/eina_mono/eina_value.cs
+++ b/src/bindings/mono/eina_mono/eina_value.cs
@@ -27,6 +27,7 @@ using System.Security;
27using System.Diagnostics.CodeAnalysis; 27using System.Diagnostics.CodeAnalysis;
28using System.Runtime.Serialization; 28using System.Runtime.Serialization;
29using System.Globalization; 29using System.Globalization;
30using System.Diagnostics.Contracts;
30 31
31using static Eina.EinaNative.UnsafeNativeMethods; 32using static Eina.EinaNative.UnsafeNativeMethods;
32using static Eina.TraitFunctions; 33using static Eina.TraitFunctions;
@@ -1268,8 +1269,10 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
1268 /// <para>Since EFL 1.23.</para> 1269 /// <para>Since EFL 1.23.</para>
1269 /// </summary> 1270 /// </summary>
1270 /// <param name="obj">The object to be wrapped.</param> 1271 /// <param name="obj">The object to be wrapped.</param>
1272 [SuppressMessage("Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods", Justification="Could not remove warning!")]
1271 public Value(object obj) : this() 1273 public Value(object obj) : this()
1272 { 1274 {
1275 Contract.Requires(obj != null, nameof(obj));
1273 var objType = obj.GetType(); 1276 var objType = obj.GetType();
1274 1277
1275 if (objType == typeof(sbyte)) 1278 if (objType == typeof(sbyte))
@@ -1424,6 +1427,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
1424 /// <param name="v">The value to be copied.</param> 1427 /// <param name="v">The value to be copied.</param>
1425 public Value(Value v) 1428 public Value(Value v)
1426 { 1429 {
1430 Contract.Requires(v != null, nameof(v));
1427 Handle = Alloc(); 1431 Handle = Alloc();
1428 if (!eina_value_copy(v.Handle, this.Handle)) 1432 if (!eina_value_copy(v.Handle, this.Handle))
1429 { 1433 {
@@ -1615,7 +1619,11 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
1615 public static implicit operator ValueNative(Value v) => ToValueNative(v); 1619 public static implicit operator ValueNative(Value v) => ToValueNative(v);
1616 1620
1617 [EditorBrowsable(EditorBrowsableState.Never)] 1621 [EditorBrowsable(EditorBrowsableState.Never)]
1618 public static ValueNative ToValueNative(Value v) => v.GetNative(); 1622 public static ValueNative ToValueNative(Value v)
1623 {
1624 Contract.Requires(v != null, nameof(v));
1625 return v.GetNative();
1626 }
1619 1627
1620 /// <summary>Implicit conversion from native struct representation to managed wrapper. 1628 /// <summary>Implicit conversion from native struct representation to managed wrapper.
1621 /// <para>Since EFL 1.23.</para> 1629 /// <para>Since EFL 1.23.</para>
@@ -1655,6 +1663,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
1655 /// <param name="v">The <see cref="Value" /> to be converted.</param> 1663 /// <param name="v">The <see cref="Value" /> to be converted.</param>
1656 public static byte ToByte(Value v) 1664 public static byte ToByte(Value v)
1657 { 1665 {
1666 Contract.Requires(v != null, nameof(v));
1658 byte b; 1667 byte b;
1659 v.Get(out b); 1668 v.Get(out b);
1660 1669
@@ -1691,6 +1700,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
1691 /// <param name="v">The <see cref="Value" /> to be converted.</param> 1700 /// <param name="v">The <see cref="Value" /> to be converted.</param>
1692 public static sbyte ToSByte(Value v) 1701 public static sbyte ToSByte(Value v)
1693 { 1702 {
1703 Contract.Requires(v != null, nameof(v));
1694 sbyte b; 1704 sbyte b;
1695 v.Get(out b); 1705 v.Get(out b);
1696 1706
@@ -1727,6 +1737,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
1727 /// <param name="v">The <see cref="Value" /> to be converted.</param> 1737 /// <param name="v">The <see cref="Value" /> to be converted.</param>
1728 public static short ToInt16(Value v) 1738 public static short ToInt16(Value v)
1729 { 1739 {
1740 Contract.Requires(v != null, nameof(v));
1730 short b; 1741 short b;
1731 v.Get(out b); 1742 v.Get(out b);
1732 1743
@@ -1763,6 +1774,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
1763 /// <param name="v">The <see cref="Value" /> to be converted.</param> 1774 /// <param name="v">The <see cref="Value" /> to be converted.</param>
1764 public static ushort ToUInt16(Value v) 1775 public static ushort ToUInt16(Value v)
1765 { 1776 {
1777 Contract.Requires(v != null, nameof(v));
1766 ushort b; 1778 ushort b;
1767 v.Get(out b); 1779 v.Get(out b);
1768 1780
@@ -1800,6 +1812,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
1800 /// <param name="v">The <see cref="Value" /> to be converted.</param> 1812 /// <param name="v">The <see cref="Value" /> to be converted.</param>
1801 public static int ToInt32(Value v) 1813 public static int ToInt32(Value v)
1802 { 1814 {
1815 Contract.Requires(v != null, nameof(v));
1803 int b; 1816 int b;
1804 v.Get(out b); 1817 v.Get(out b);
1805 1818
@@ -1836,6 +1849,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
1836 /// <param name="v">The <see cref="Value" /> to be converted.</param> 1849 /// <param name="v">The <see cref="Value" /> to be converted.</param>
1837 public static uint ToUInt32(Value v) 1850 public static uint ToUInt32(Value v)
1838 { 1851 {
1852 Contract.Requires(v != null, nameof(v));
1839 uint b; 1853 uint b;
1840 v.Get(out b); 1854 v.Get(out b);
1841 1855
@@ -1872,6 +1886,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
1872 /// <param name="v">The <see cref="Value" /> to be converted.</param> 1886 /// <param name="v">The <see cref="Value" /> to be converted.</param>
1873 public static long ToInt64(Value v) 1887 public static long ToInt64(Value v)
1874 { 1888 {
1889 Contract.Requires(v != null, nameof(v));
1875 long b; 1890 long b;
1876 v.Get(out b); 1891 v.Get(out b);
1877 1892
@@ -1908,6 +1923,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
1908 /// <param name="v">The <see cref="Value" /> to be converted.</param> 1923 /// <param name="v">The <see cref="Value" /> to be converted.</param>
1909 public static ulong ToUInt64(Value v) 1924 public static ulong ToUInt64(Value v)
1910 { 1925 {
1926 Contract.Requires(v != null, nameof(v));
1911 ulong b; 1927 ulong b;
1912 v.Get(out b); 1928 v.Get(out b);
1913 1929
@@ -1944,6 +1960,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
1944 /// <param name="v">The <see cref="Value" /> to be converted.</param> 1960 /// <param name="v">The <see cref="Value" /> to be converted.</param>
1945 public static float ToSingle(Value v) 1961 public static float ToSingle(Value v)
1946 { 1962 {
1963 Contract.Requires(v != null, nameof(v));
1947 float b; 1964 float b;
1948 v.Get(out b); 1965 v.Get(out b);
1949 1966
@@ -1980,6 +1997,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
1980 /// <param name="v">The <see cref="Value" /> to be converted.</param> 1997 /// <param name="v">The <see cref="Value" /> to be converted.</param>
1981 public static double ToDouble(Value v) 1998 public static double ToDouble(Value v)
1982 { 1999 {
2000 Contract.Requires(v != null, nameof(v));
1983 double b; 2001 double b;
1984 v.Get(out b); 2002 v.Get(out b);
1985 2003
@@ -2016,6 +2034,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
2016 /// <param name="v">The <see cref="Value" /> to be converted.</param> 2034 /// <param name="v">The <see cref="Value" /> to be converted.</param>
2017 public static string ToString(Value v) 2035 public static string ToString(Value v)
2018 { 2036 {
2037 Contract.Requires(v != null, nameof(v));
2019 string b; 2038 string b;
2020 v.Get(out b); 2039 v.Get(out b);
2021 2040
@@ -2171,6 +2190,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
2171 /// <param name="v">The <see cref="Value" /> to be converted.</param> 2190 /// <param name="v">The <see cref="Value" /> to be converted.</param>
2172 public static Efl.Object ToObject(Value v) 2191 public static Efl.Object ToObject(Value v)
2173 { 2192 {
2193 Contract.Requires(v != null, nameof(v));
2174 Efl.Object obj; 2194 Efl.Object obj;
2175 v.Get(out obj); 2195 v.Get(out obj);
2176 2196
@@ -2714,6 +2734,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
2714 /// <returns><c>true</c> if the value was successfully stored.</returns> 2734 /// <returns><c>true</c> if the value was successfully stored.</returns>
2715 public bool Set(Efl.Object value) 2735 public bool Set(Efl.Object value)
2716 { 2736 {
2737 Contract.Requires(value != null, nameof(value));
2717 SanityChecks(); 2738 SanityChecks();
2718 2739
2719 if (this.Optional) 2740 if (this.Optional)
@@ -2735,6 +2756,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
2735 /// <returns><c>true</c> if the value was successfully stored.</returns> 2756 /// <returns><c>true</c> if the value was successfully stored.</returns>
2736 public bool Set(Value value) 2757 public bool Set(Value value)
2737 { 2758 {
2759 Contract.Requires(value != null, nameof(value));
2738 OptionalSanityChecks(); 2760 OptionalSanityChecks();
2739 ValueType subtype = value.GetValueType(); 2761 ValueType subtype = value.GetValueType();
2740 2762
@@ -3321,6 +3343,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
3321 /// <returns><c>true</c> if the value was successfully appended.</returns> 3343 /// <returns><c>true</c> if the value was successfully appended.</returns>
3322 public bool Append(object o) 3344 public bool Append(object o)
3323 { 3345 {
3346 Contract.Requires(o != null, nameof(o));
3324 ContainerSanityChecks(); 3347 ContainerSanityChecks();
3325 3348
3326 switch (GetValueSubType()) 3349 switch (GetValueSubType())
@@ -3508,6 +3531,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
3508 } 3531 }
3509 set 3532 set
3510 { 3533 {
3534 Contract.Requires(value != null, nameof(value));
3511 ContainerSanityChecks(i); 3535 ContainerSanityChecks(i);
3512 3536
3513 switch (GetValueSubType()) 3537 switch (GetValueSubType())
@@ -3650,6 +3674,7 @@ public class ValueMarshaler : ICustomMarshaler
3650 /// keeping the managed ownership.</summary> 3674 /// keeping the managed ownership.</summary>
3651 public IntPtr MarshalManagedToNative(object managedObj) 3675 public IntPtr MarshalManagedToNative(object managedObj)
3652 { 3676 {
3677 Contract.Requires(managedObj != null, nameof(managedObj));
3653 try 3678 try
3654 { 3679 {
3655 Value v = (Value)managedObj; 3680 Value v = (Value)managedObj;
@@ -3703,6 +3728,7 @@ public class ValueMarshalerOwn : ICustomMarshaler
3703 /// when not needed. </summary> 3728 /// when not needed. </summary>
3704 public IntPtr MarshalManagedToNative(object managedObj) 3729 public IntPtr MarshalManagedToNative(object managedObj)
3705 { 3730 {
3731 Contract.Requires(managedObj != null, nameof(managedObj));
3706 try 3732 try
3707 { 3733 {
3708 Value v = (Value)managedObj; 3734 Value v = (Value)managedObj;
diff --git a/src/bindings/mono/eldbus_mono/eldbus_common.cs b/src/bindings/mono/eldbus_mono/eldbus_common.cs
index 2606fe92c8..6ca2de007f 100644
--- a/src/bindings/mono/eldbus_mono/eldbus_common.cs
+++ b/src/bindings/mono/eldbus_mono/eldbus_common.cs
@@ -19,6 +19,7 @@ using System;
19using System.Runtime.InteropServices; 19using System.Runtime.InteropServices;
20using System.ComponentModel; 20using System.ComponentModel;
21using System.Diagnostics.CodeAnalysis; 21using System.Diagnostics.CodeAnalysis;
22using System.Diagnostics.Contracts;
22 23
23using static eldbus.EldbusMessageNativeFunctions; 24using static eldbus.EldbusMessageNativeFunctions;
24 25
@@ -948,12 +949,14 @@ public class ByteMessageArgument : BasicMessageArgument
948 [EditorBrowsable(EditorBrowsableState.Never)] 949 [EditorBrowsable(EditorBrowsableState.Never)]
949 protected override bool InternalAppendTo(eldbus.Message msg) 950 protected override bool InternalAppendTo(eldbus.Message msg)
950 { 951 {
952 Contract.Requires(msg != null, nameof(msg));
951 return eldbus_message_arguments_append(msg.Handle, Signature, value); 953 return eldbus_message_arguments_append(msg.Handle, Signature, value);
952 } 954 }
953 955
954 [EditorBrowsable(EditorBrowsableState.Never)] 956 [EditorBrowsable(EditorBrowsableState.Never)]
955 protected override bool InternalAppendTo(eldbus.MessageIterator iter) 957 protected override bool InternalAppendTo(eldbus.MessageIterator iter)
956 { 958 {
959 Contract.Requires(iter != null, nameof(iter));
957 return eldbus_message_iter_basic_append(iter.Handle, TypeCode, value); 960 return eldbus_message_iter_basic_append(iter.Handle, TypeCode, value);
958 } 961 }
959} 962}
@@ -997,12 +1000,14 @@ public class BoolMessageArgument : BasicMessageArgument
997 [EditorBrowsable(EditorBrowsableState.Never)] 1000 [EditorBrowsable(EditorBrowsableState.Never)]
998 protected override bool InternalAppendTo(eldbus.Message msg) 1001 protected override bool InternalAppendTo(eldbus.Message msg)
999 { 1002 {
1003 Contract.Requires(msg != null, nameof(msg));
1000 return eldbus_message_arguments_append(msg.Handle, Signature, value); 1004 return eldbus_message_arguments_append(msg.Handle, Signature, value);
1001 } 1005 }
1002 1006
1003 [EditorBrowsable(EditorBrowsableState.Never)] 1007 [EditorBrowsable(EditorBrowsableState.Never)]
1004 protected override bool InternalAppendTo(eldbus.MessageIterator iter) 1008 protected override bool InternalAppendTo(eldbus.MessageIterator iter)
1005 { 1009 {
1010 Contract.Requires(iter != null, nameof(iter));
1006 return eldbus_message_iter_basic_append(iter.Handle, TypeCode, value); 1011 return eldbus_message_iter_basic_append(iter.Handle, TypeCode, value);
1007 } 1012 }
1008} 1013}
@@ -1046,12 +1051,14 @@ public class Int16MessageArgument : BasicMessageArgument
1046 [EditorBrowsable(EditorBrowsableState.Never)] 1051 [EditorBrowsable(EditorBrowsableState.Never)]
1047 protected override bool InternalAppendTo(eldbus.Message msg) 1052 protected override bool InternalAppendTo(eldbus.Message msg)
1048 { 1053 {
1054 Contract.Requires(msg != null, nameof(msg));
1049 return eldbus_message_arguments_append(msg.Handle, Signature, value); 1055 return eldbus_message_arguments_append(msg.Handle, Signature, value);
1050 } 1056 }
1051 1057
1052 [EditorBrowsable(EditorBrowsableState.Never)] 1058 [EditorBrowsable(EditorBrowsableState.Never)]
1053 protected override bool InternalAppendTo(eldbus.MessageIterator iter) 1059 protected override bool InternalAppendTo(eldbus.MessageIterator iter)
1054 { 1060 {
1061 Contract.Requires(iter != null, nameof(iter));
1055 return eldbus_message_iter_basic_append(iter.Handle, TypeCode, value); 1062 return eldbus_message_iter_basic_append(iter.Handle, TypeCode, value);
1056 } 1063 }
1057} 1064}
@@ -1095,12 +1102,14 @@ public class UInt16MessageArgument : BasicMessageArgument
1095 [EditorBrowsable(EditorBrowsableState.Never)] 1102 [EditorBrowsable(EditorBrowsableState.Never)]
1096 protected override bool InternalAppendTo(eldbus.Message msg) 1103 protected override bool InternalAppendTo(eldbus.Message msg)
1097 { 1104 {
1105 Contract.Requires(msg != null, nameof(msg));
1098 return eldbus_message_arguments_append(msg.Handle, Signature, value); 1106 return eldbus_message_arguments_append(msg.Handle, Signature, value);
1099 } 1107 }
1100 1108
1101 [EditorBrowsable(EditorBrowsableState.Never)] 1109 [EditorBrowsable(EditorBrowsableState.Never)]
1102 protected override bool InternalAppendTo(eldbus.MessageIterator iter) 1110 protected override bool InternalAppendTo(eldbus.MessageIterator iter)
1103 { 1111 {
1112 Contract.Requires(iter != null, nameof(iter));
1104 return eldbus_message_iter_basic_append(iter.Handle, TypeCode, value); 1113 return eldbus_message_iter_basic_append(iter.Handle, TypeCode, value);
1105 } 1114 }
1106} 1115}
@@ -1144,12 +1153,14 @@ public class Int32MessageArgument : BasicMessageArgument
1144 [EditorBrowsable(EditorBrowsableState.Never)] 1153 [EditorBrowsable(EditorBrowsableState.Never)]
1145 protected override bool InternalAppendTo(eldbus.Message msg) 1154 protected override bool InternalAppendTo(eldbus.Message msg)
1146 { 1155 {
1156 Contract.Requires(msg != null, nameof(msg));
1147 return eldbus_message_arguments_append(msg.Handle, Signature, value); 1157 return eldbus_message_arguments_append(msg.Handle, Signature, value);
1148 } 1158 }
1149 1159
1150 [EditorBrowsable(EditorBrowsableState.Never)] 1160 [EditorBrowsable(EditorBrowsableState.Never)]
1151 protected override bool InternalAppendTo(eldbus.MessageIterator iter) 1161 protected override bool InternalAppendTo(eldbus.MessageIterator iter)
1152 { 1162 {
1163 Contract.Requires(iter != null, nameof(iter));
1153 return eldbus_message_iter_basic_append(iter.Handle, TypeCode, value); 1164 return eldbus_message_iter_basic_append(iter.Handle, TypeCode, value);
1154 } 1165 }
1155} 1166}
@@ -1193,12 +1204,14 @@ public class UInt32MessageArgument : BasicMessageArgument
1193 [EditorBrowsable(EditorBrowsableState.Never)] 1204 [EditorBrowsable(EditorBrowsableState.Never)]
1194 protected override bool InternalAppendTo(eldbus.Message msg) 1205 protected override bool InternalAppendTo(eldbus.Message msg)
1195 { 1206 {
1207 Contract.Requires(msg != null, nameof(msg));
1196 return eldbus_message_arguments_append(msg.Handle, Signature, value); 1208 return eldbus_message_arguments_append(msg.Handle, Signature, value);
1197 } 1209 }
1198 1210
1199 [EditorBrowsable(EditorBrowsableState.Never)] 1211 [EditorBrowsable(EditorBrowsableState.Never)]
1200 protected override bool InternalAppendTo(eldbus.MessageIterator iter) 1212 protected override bool InternalAppendTo(eldbus.MessageIterator iter)
1201 { 1213 {
1214 Contract.Requires(iter != null, nameof(iter));
1202 return eldbus_message_iter_basic_append(iter.Handle, TypeCode, value); 1215 return eldbus_message_iter_basic_append(iter.Handle, TypeCode, value);
1203 } 1216 }
1204} 1217}
@@ -1242,12 +1255,14 @@ public class Int64MessageArgument : BasicMessageArgument
1242 [EditorBrowsable(EditorBrowsableState.Never)] 1255 [EditorBrowsable(EditorBrowsableState.Never)]
1243 protected override bool InternalAppendTo(eldbus.Message msg) 1256 protected override bool InternalAppendTo(eldbus.Message msg)
1244 { 1257 {
1258 Contract.Requires(msg != null, nameof(msg));
1245 return eldbus_message_arguments_append(msg.Handle, Signature, value); 1259 return eldbus_message_arguments_append(msg.Handle, Signature, value);
1246 } 1260 }
1247 1261
1248 [EditorBrowsable(EditorBrowsableState.Never)] 1262 [EditorBrowsable(EditorBrowsableState.Never)]
1249 protected override bool InternalAppendTo(eldbus.MessageIterator iter) 1263 protected override bool InternalAppendTo(eldbus.MessageIterator iter)
1250 { 1264 {
1265 Contract.Requires(iter != null, nameof(iter));
1251 return eldbus_message_iter_basic_append(iter.Handle, TypeCode, value); 1266 return eldbus_message_iter_basic_append(iter.Handle, TypeCode, value);
1252 } 1267 }
1253} 1268}
@@ -1291,12 +1306,14 @@ public class UInt64MessageArgument : BasicMessageArgument
1291 [EditorBrowsable(EditorBrowsableState.Never)] 1306 [EditorBrowsable(EditorBrowsableState.Never)]
1292 protected override bool InternalAppendTo(eldbus.Message msg) 1307 protected override bool InternalAppendTo(eldbus.Message msg)
1293 { 1308 {
1309 Contract.Requires(msg != null, nameof(msg));
1294 return eldbus_message_arguments_append(msg.Handle, Signature, value); 1310 return eldbus_message_arguments_append(msg.Handle, Signature, value);
1295 } 1311 }
1296 1312
1297 [EditorBrowsable(EditorBrowsableState.Never)] 1313 [EditorBrowsable(EditorBrowsableState.Never)]
1298 protected override bool InternalAppendTo(eldbus.MessageIterator iter) 1314 protected override bool InternalAppendTo(eldbus.MessageIterator iter)
1299 { 1315 {
1316 Contract.Requires(iter != null, nameof(iter));
1300 return eldbus_message_iter_basic_append(iter.Handle, TypeCode, value); 1317 return eldbus_message_iter_basic_append(iter.Handle, TypeCode, value);
1301 } 1318 }
1302} 1319}
@@ -1340,12 +1357,14 @@ public class DoubleMessageArgument : BasicMessageArgument
1340 [EditorBrowsable(EditorBrowsableState.Never)] 1357 [EditorBrowsable(EditorBrowsableState.Never)]
1341 protected override bool InternalAppendTo(eldbus.Message msg) 1358 protected override bool InternalAppendTo(eldbus.Message msg)
1342 { 1359 {
1360 Contract.Requires(msg != null, nameof(msg));
1343 return eldbus_message_arguments_append(msg.Handle, Signature, value); 1361 return eldbus_message_arguments_append(msg.Handle, Signature, value);
1344 } 1362 }
1345 1363
1346 [EditorBrowsable(EditorBrowsableState.Never)] 1364 [EditorBrowsable(EditorBrowsableState.Never)]
1347 protected override bool InternalAppendTo(eldbus.MessageIterator iter) 1365 protected override bool InternalAppendTo(eldbus.MessageIterator iter)
1348 { 1366 {
1367 Contract.Requires(iter != null, nameof(iter));
1349 return eldbus_message_iter_basic_append(iter.Handle, TypeCode, value); 1368 return eldbus_message_iter_basic_append(iter.Handle, TypeCode, value);
1350 } 1369 }
1351} 1370}
@@ -1371,12 +1390,14 @@ public abstract class StringLikeMessageArgument : BasicMessageArgument
1371 [EditorBrowsable(EditorBrowsableState.Never)] 1390 [EditorBrowsable(EditorBrowsableState.Never)]
1372 protected override bool InternalAppendTo(eldbus.Message msg) 1391 protected override bool InternalAppendTo(eldbus.Message msg)
1373 { 1392 {
1393 Contract.Requires(msg != null, nameof(msg));
1374 return eldbus_message_arguments_append(msg.Handle, Signature, value); 1394 return eldbus_message_arguments_append(msg.Handle, Signature, value);
1375 } 1395 }
1376 1396
1377 [EditorBrowsable(EditorBrowsableState.Never)] 1397 [EditorBrowsable(EditorBrowsableState.Never)]
1378 protected override bool InternalAppendTo(eldbus.MessageIterator iter) 1398 protected override bool InternalAppendTo(eldbus.MessageIterator iter)
1379 { 1399 {
1400 Contract.Requires(iter != null, nameof(iter));
1380 return eldbus_message_iter_basic_append(iter.Handle, TypeCode, value); 1401 return eldbus_message_iter_basic_append(iter.Handle, TypeCode, value);
1381 } 1402 }
1382} 1403}
@@ -1522,12 +1543,14 @@ public class UnixFdMessageArgument : BasicMessageArgument
1522 [EditorBrowsable(EditorBrowsableState.Never)] 1543 [EditorBrowsable(EditorBrowsableState.Never)]
1523 protected override bool InternalAppendTo(eldbus.Message msg) 1544 protected override bool InternalAppendTo(eldbus.Message msg)
1524 { 1545 {
1546 Contract.Requires(msg != null, nameof(msg));
1525 return eldbus_message_arguments_append(msg.Handle, Signature, value); 1547 return eldbus_message_arguments_append(msg.Handle, Signature, value);
1526 } 1548 }
1527 1549
1528 [EditorBrowsable(EditorBrowsableState.Never)] 1550 [EditorBrowsable(EditorBrowsableState.Never)]
1529 protected override bool InternalAppendTo(eldbus.MessageIterator iter) 1551 protected override bool InternalAppendTo(eldbus.MessageIterator iter)
1530 { 1552 {
1553 Contract.Requires(iter != null, nameof(iter));
1531 return eldbus_message_iter_basic_append(iter.Handle, TypeCode, value); 1554 return eldbus_message_iter_basic_append(iter.Handle, TypeCode, value);
1532 } 1555 }
1533} 1556}
diff --git a/src/bindings/mono/eldbus_mono/eldbus_message.cs b/src/bindings/mono/eldbus_mono/eldbus_message.cs
index 71baf6d83f..8ab48ba2bd 100644
--- a/src/bindings/mono/eldbus_mono/eldbus_message.cs
+++ b/src/bindings/mono/eldbus_mono/eldbus_message.cs
@@ -18,6 +18,7 @@
18using System; 18using System;
19using System.Runtime.InteropServices; 19using System.Runtime.InteropServices;
20using System.ComponentModel; 20using System.ComponentModel;
21using System.Diagnostics.Contracts;
21 22
22using static eldbus.EldbusMessageNativeFunctions; 23using static eldbus.EldbusMessageNativeFunctions;
23 24
@@ -773,6 +774,7 @@ public class MessageIterator
773 /// <returns>A <see cref="eldbus.MessageIterator" />.</returns> 774 /// <returns>A <see cref="eldbus.MessageIterator" />.</returns>
774 public eldbus.MessageIterator AppendOpenContainer(string signature) 775 public eldbus.MessageIterator AppendOpenContainer(string signature)
775 { 776 {
777 Contract.Requires(signature != null, nameof(signature));
776 CheckHandle(); 778 CheckHandle();
777 779
778 IntPtr new_iter = IntPtr.Zero; 780 IntPtr new_iter = IntPtr.Zero;
diff --git a/src/bindings/mono/eldbus_mono/eldbus_proxy.cs b/src/bindings/mono/eldbus_mono/eldbus_proxy.cs
index a3a984df97..8ed9bed82b 100644
--- a/src/bindings/mono/eldbus_mono/eldbus_proxy.cs
+++ b/src/bindings/mono/eldbus_mono/eldbus_proxy.cs
@@ -18,6 +18,7 @@
18using System; 18using System;
19using System.Runtime.InteropServices; 19using System.Runtime.InteropServices;
20using System.ComponentModel; 20using System.ComponentModel;
21using System.Diagnostics.Contracts;
21 22
22using static eldbus.EldbusProxyNativeFunctions; 23using static eldbus.EldbusProxyNativeFunctions;
23 24
@@ -123,6 +124,7 @@ public class Proxy : IDisposable
123 /// <param name="_interface">The interface name.</param> 124 /// <param name="_interface">The interface name.</param>
124 public Proxy(eldbus.Object obj, string _interface) 125 public Proxy(eldbus.Object obj, string _interface)
125 { 126 {
127 Contract.Requires(obj != null, nameof(obj));
126 InitNew(eldbus_proxy_get(obj.Handle, _interface), true); 128 InitNew(eldbus_proxy_get(obj.Handle, _interface), true);
127 } 129 }
128 130