I am facing a problem that I can not figure out.
Say I have two methods: public void Method1(object obj)
in ViewModel
class and public void Method2(object obj)
in Model
class.
Method2
gets called from Method1
using the instance of Model
class(say, objM is the object of Model
class and a member of ViewModel
class).
class ViewModel
{
public void Methods1(object obj)
{
if (!(
( (false == this.HasSal)
&& (typeof(Class1) == obj.GetType())
)
||
( (true == this.HasSal)
&& (typeof(Class2) == obj.GetType())
)
)
)
{
throw new ArgumentException("invalid obj");
}
Contract.EndContractBlock();
objM.Method2(obj);
.....
}
}
class Model
{
public void Method2(object obj)
{
Contract.Requires(
( (false == this.HasSal)
&& (typeof(Class1) == obj.GetType())
)
||
( (true == this.HasSal)
&& (typeof(Class2) == obj.GetType())
)
);
.....
}
}
Now whenever I try to build the code, Visual studio produces following warning
Code contracts: Requires unproven
(
( (false == this.HasSal)
&& (typeof(Class1) == obj.GetType())
)
||
( (true == this.HasSal)
&& (typeof(Class2) == obj.GetType())
)
)
Please suggest.