eina_mono: remove exceptions in unexpected locations

Summary:
Unexpected locations are listed in
https://docs.microsoft.com/en-us/visualstudio/code-quality/ca1065

fix CA1065
ref T8402

Test Plan:
meson setup -Dbindings=mono,cxx -Dmono-beta=true
ninja test

Reviewers: lauromoura, felipealmeida, brunobelo

Reviewed By: brunobelo

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T8402

Differential Revision: https://phab.enlightenment.org/D10461
This commit is contained in:
Yeongjong Lee 2019-10-28 20:33:47 -03:00 committed by Lauro Moura
parent d59197d2ee
commit 91ae0ea12f
2 changed files with 24 additions and 101 deletions

View File

@ -253,11 +253,6 @@ public class Strbuf : IDisposable
/// <returns>A string with the contents of this buffer.</returns> /// <returns>A string with the contents of this buffer.</returns>
public override string ToString() public override string ToString()
{ {
if (Disposed)
{
throw new ObjectDisposedException(base.GetType().Name);
}
return eina_strbuf_string_get(this.Handle); return eina_strbuf_string_get(this.Handle);
} }
} }

View File

@ -1584,10 +1584,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
public static implicit operator Value(byte x) public static implicit operator Value(byte x)
{ {
var v = new Eina.Value(ValueType.Byte); var v = new Eina.Value(ValueType.Byte);
if (!v.Set(x)) v.Set(x);
{
throw new InvalidOperationException("Couldn't set value.");
}
return v; return v;
} }
@ -1598,10 +1595,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
public static implicit operator byte(Value v) public static implicit operator byte(Value v)
{ {
byte b; byte b;
if (!v.Get(out b)) v.Get(out b);
{
throw new InvalidOperationException("Couldn't get value.");
}
return b; return b;
} }
@ -1612,10 +1606,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
public static implicit operator Value(sbyte x) public static implicit operator Value(sbyte x)
{ {
var v = new Eina.Value(ValueType.SByte); var v = new Eina.Value(ValueType.SByte);
if (!v.Set(x)) v.Set(x);
{
throw new InvalidOperationException("Couldn't set value.");
}
return v; return v;
} }
@ -1626,10 +1617,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
public static implicit operator sbyte(Value v) public static implicit operator sbyte(Value v)
{ {
sbyte b; sbyte b;
if (!v.Get(out b)) v.Get(out b);
{
throw new InvalidOperationException("Couldn't get value.");
}
return b; return b;
} }
@ -1640,10 +1628,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
public static implicit operator Value(short x) public static implicit operator Value(short x)
{ {
var v = new Eina.Value(ValueType.Short); var v = new Eina.Value(ValueType.Short);
if (!v.Set(x)) v.Set(x);
{
throw new InvalidOperationException("Couldn't set value.");
}
return v; return v;
} }
@ -1654,10 +1639,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
public static implicit operator short(Value v) public static implicit operator short(Value v)
{ {
short b; short b;
if (!v.Get(out b)) v.Get(out b);
{
throw new InvalidOperationException("Couldn't get value.");
}
return b; return b;
} }
@ -1668,10 +1650,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
public static implicit operator Value(ushort x) public static implicit operator Value(ushort x)
{ {
var v = new Eina.Value(ValueType.UShort); var v = new Eina.Value(ValueType.UShort);
if (!v.Set(x)) v.Set(x);
{
throw new InvalidOperationException("Couldn't set value.");
}
return v; return v;
} }
@ -1682,10 +1661,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
public static implicit operator ushort(Value v) public static implicit operator ushort(Value v)
{ {
ushort b; ushort b;
if (!v.Get(out b)) v.Get(out b);
{
throw new InvalidOperationException("Couldn't get value.");
}
return b; return b;
} }
@ -1696,10 +1672,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
public static implicit operator Value(int x) public static implicit operator Value(int x)
{ {
var v = new Eina.Value(ValueType.Int32); var v = new Eina.Value(ValueType.Int32);
if (!v.Set(x)) v.Set(x);
{
throw new InvalidOperationException("Couldn't set value.");
}
return v; return v;
} }
@ -1710,10 +1683,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
public static implicit operator int(Value v) public static implicit operator int(Value v)
{ {
int b; int b;
if (!v.Get(out b)) v.Get(out b);
{
throw new InvalidOperationException("Couldn't get value.");
}
return b; return b;
} }
@ -1724,10 +1694,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
public static implicit operator Value(uint x) public static implicit operator Value(uint x)
{ {
var v = new Eina.Value(ValueType.UInt32); var v = new Eina.Value(ValueType.UInt32);
if (!v.Set(x)) v.Set(x);
{
throw new InvalidOperationException("Couldn't set value.");
}
return v; return v;
} }
@ -1738,10 +1705,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
public static implicit operator uint(Value v) public static implicit operator uint(Value v)
{ {
uint b; uint b;
if (!v.Get(out b)) v.Get(out b);
{
throw new InvalidOperationException("Couldn't get value.");
}
return b; return b;
} }
@ -1752,10 +1716,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
public static implicit operator Value(long x) public static implicit operator Value(long x)
{ {
var v = new Eina.Value(ValueType.Long); var v = new Eina.Value(ValueType.Long);
if (!v.Set(x)) v.Set(x);
{
throw new InvalidOperationException("Couldn't set value.");
}
return v; return v;
} }
@ -1766,10 +1727,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
public static implicit operator long(Value v) public static implicit operator long(Value v)
{ {
long b; long b;
if (!v.Get(out b)) v.Get(out b);
{
throw new InvalidOperationException("Couldn't get value.");
}
return b; return b;
} }
@ -1780,10 +1738,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
public static implicit operator Value(ulong x) public static implicit operator Value(ulong x)
{ {
var v = new Eina.Value(ValueType.ULong); var v = new Eina.Value(ValueType.ULong);
if (!v.Set(x)) v.Set(x);
{
throw new InvalidOperationException("Couldn't set value.");
}
return v; return v;
} }
@ -1794,10 +1749,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
public static implicit operator ulong(Value v) public static implicit operator ulong(Value v)
{ {
ulong b; ulong b;
if (!v.Get(out b)) v.Get(out b);
{
throw new InvalidOperationException("Couldn't get value.");
}
return b; return b;
} }
@ -1808,10 +1760,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
public static implicit operator Value(float x) public static implicit operator Value(float x)
{ {
var v = new Eina.Value(ValueType.Float); var v = new Eina.Value(ValueType.Float);
if (!v.Set(x)) v.Set(x);
{
throw new InvalidOperationException("Couldn't set value.");
}
return v; return v;
} }
@ -1822,10 +1771,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
public static implicit operator float(Value v) public static implicit operator float(Value v)
{ {
float b; float b;
if (!v.Get(out b)) v.Get(out b);
{
throw new InvalidOperationException("Couldn't get value.");
}
return b; return b;
} }
@ -1836,10 +1782,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
public static implicit operator Value(double x) public static implicit operator Value(double x)
{ {
var v = new Eina.Value(ValueType.Double); var v = new Eina.Value(ValueType.Double);
if (!v.Set(x)) v.Set(x);
{
throw new InvalidOperationException("Couldn't set value.");
}
return v; return v;
} }
@ -1850,10 +1793,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
public static implicit operator double(Value v) public static implicit operator double(Value v)
{ {
double b; double b;
if (!v.Get(out b)) v.Get(out b);
{
throw new InvalidOperationException("Couldn't get value.");
}
return b; return b;
} }
@ -1864,10 +1804,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
public static implicit operator Value(string x) public static implicit operator Value(string x)
{ {
var v = new Eina.Value(ValueType.String); var v = new Eina.Value(ValueType.String);
if (!v.Set(x)) v.Set(x);
{
throw new InvalidOperationException("Couldn't set value.");
}
return v; return v;
} }
@ -1878,10 +1815,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
public static implicit operator string(Value v) public static implicit operator string(Value v)
{ {
string b; string b;
if (!v.Get(out b)) v.Get(out b);
{
throw new InvalidOperationException("Couldn't get value.");
}
return b; return b;
} }
@ -2012,10 +1946,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
public static explicit operator Value(Efl.Object obj) public static explicit operator Value(Efl.Object obj)
{ {
var v = new Eina.Value(ValueType.Object); var v = new Eina.Value(ValueType.Object);
if (!v.Set(obj)) v.Set(obj);
{
throw new InvalidOperationException("Couldn't set value.");
}
return v; return v;
} }
@ -2025,10 +1956,7 @@ public class Value : IDisposable, IComparable<Value>, IEquatable<Value>
public static explicit operator Efl.Object(Value v) public static explicit operator Efl.Object(Value v)
{ {
Efl.Object obj; Efl.Object obj;
if (!v.Get(out obj)) v.Get(out obj);
{
throw new InvalidOperationException("Couldn't get value.");
}
return obj; return obj;
} }