Consider the following code:
```
class Program
{
[Obfuscation(Exclude = true)]
static void Main(string[] args)
{
var t = new Two();
Console.WriteLine(t.Property1);
Console.WriteLine(t.Property2);
Console.WriteLine(t.Property3);
Console.WriteLine(((I1) t).Property1);
Console.WriteLine(((I3) t).Property1);
Console.WriteLine(((I3) t).Property3);
Console.WriteLine(((I3) t).Property2);
var o = new One();
Console.WriteLine(o.Property1);
Console.WriteLine(((I1) o).Property1);
}
}
interface I1 { double Property1 { get; } }
interface I2 { double Property2 { get; } }
interface I3 : I1, I2 { double Property3 { get; } }
class One : I1
{
public double Property1 { get { return 1; } }
public double Another1 { get { return -1; } }
double I1.Property1 { get { return 1.5; } }
}
class Two : One, I3
{
public double Property2 { get { return 2; } }
public double Property3 { get { return 3; } }
public double Another2 { get { return -2; } }
public double Another3 { get { return -3; } }
double I3.Property3 { get { return 3.5; } }
}
```
Executed before obfuscation the output is:
```
1 2 3 1.5 1.5 3.5 2 1 1.5
```
Obfuscated with just KeepPublicApi=false and HidePrivateApi=true using the latest code in the repo (79ee199979), and executing the obfuscated assembly, the output changes:
```
1 2 3 **2** **2** 3.5 2 1 1.5
```
I've been fighting with the sourcecode trying to understand and fix (hack) this but I still haven't been lucky...
```
class Program
{
[Obfuscation(Exclude = true)]
static void Main(string[] args)
{
var t = new Two();
Console.WriteLine(t.Property1);
Console.WriteLine(t.Property2);
Console.WriteLine(t.Property3);
Console.WriteLine(((I1) t).Property1);
Console.WriteLine(((I3) t).Property1);
Console.WriteLine(((I3) t).Property3);
Console.WriteLine(((I3) t).Property2);
var o = new One();
Console.WriteLine(o.Property1);
Console.WriteLine(((I1) o).Property1);
}
}
interface I1 { double Property1 { get; } }
interface I2 { double Property2 { get; } }
interface I3 : I1, I2 { double Property3 { get; } }
class One : I1
{
public double Property1 { get { return 1; } }
public double Another1 { get { return -1; } }
double I1.Property1 { get { return 1.5; } }
}
class Two : One, I3
{
public double Property2 { get { return 2; } }
public double Property3 { get { return 3; } }
public double Another2 { get { return -2; } }
public double Another3 { get { return -3; } }
double I3.Property3 { get { return 3.5; } }
}
```
Executed before obfuscation the output is:
```
1 2 3 1.5 1.5 3.5 2 1 1.5
```
Obfuscated with just KeepPublicApi=false and HidePrivateApi=true using the latest code in the repo (79ee199979), and executing the obfuscated assembly, the output changes:
```
1 2 3 **2** **2** 3.5 2 1 1.5
```
I've been fighting with the sourcecode trying to understand and fix (hack) this but I still haven't been lucky...