In our application, we have an extension for Enum
namespace System
{
/// <summary>
/// Contains extention methods for emuns.
/// </summary>
public static class EnumExtention
{
/// <summary>
/// Check is value has flag.
/// </summary>
/// <param name="value">Checked value</param>
/// <param name="checkedFlag">Checked flag.</param>
/// <returns>True if enum contains specified flag. Otherwise false</returns>
public static bool HasFlag(this Enum value, Enum checkedFlag)
{
ulong num = Convert.ToUInt64(checkedFlag);
ulong num2 = Convert.ToUInt64(value);
return (num2 & num) == num;
}
}
}
And somewhere in the project we have some Enum and some Func
[Flags]
public enum MyEnum
{
zero= 0,
two = 2,
three = 3,
threetwo = two | three
}
public void SomeFunc()
{
var ThreeTwo = Myenum.threetwo;
bool _true = ThreeTwo.HasFlag(Myenum.three);
bool _false = ThreeTwo.HasFlag(Myenum.zero);
System.Windows.MessageBox.Show(String.Format("_true is: {0} and _false is : {1}", _true, _false);
}
public void СallerFunction()
{
try
{
SomeFunc();
}
catch (Exception ex)
{
System.Windows.MessageBox.Show(String.Format("Oops! {0}"), ex.Message));
}
}
After build in release mode all wocks fine and we get this:
"_true is: true and _false is : false"
But aftet Dotfuscator worked on the code, we obtain the following:
"Oops! MethodNotFoundException"
And all Features set to Yes
Version of Dotfuscator: PreEmptive ver4.9.7000 WindowsPhoneEdition
What is wrong with the extension?
P.S. sorry for my english.