nyxiscoo1 / obfuscar

Automatically exported from code.google.com/p/obfuscar
0 stars 0 forks source link

The attrib property of SkipMethod/SkipProperty is not observed #19

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. Include a SkipMethod as such;
<Module file="$(InPath)\xxx.dll" >
    <SkipMethod type="BroadcastBionics.*" attrib="public" rx=".*" />
</Module>

What is the expected output? What do you see instead?
Examining with .Net Reflector shows that protected methods were also 
skipped. They should not be skipped as they are not public!

What version of the product are you using? On what operating system?
1.4.0.0

Please provide any additional information below.
Examining MethodTester.cs and PropertyTester.cs they both take attrib as a 
parameter of the constructor, but this attribute is never referenced in the 
comparison math 'Test' of these classes.

Original issue reported on code.google.com by adam%wyl...@gtempaccount.com on 12 Aug 2009 at 2:32

GoogleCodeExporter commented 8 years ago
Updating MethodTester.Test() to 

public bool Test( MethodKey method )
        {
            if ( key != null )
                return method == key;

            if ( Helper.CompareOptionalRegex(method.TypeKey.Fullname, 
type) )
            {
                if ( name != null ) {
                    if (attrib=="" || attrib==method.attrib) {
                        return 
Helper.CompareOptionalRegex(method.Name, name);
                    }
                } else {
                    if (attrib=="" || attrib==method.attrib) {
                        return nameRx.IsMatch( method.Name );
                    }
                }
            }

            return false;
        }

and adding a property to MethodKey class of attrib to return 
public/protected/private  
depending on the MethodDefinition passed to the constructor. I'm not familiar 
enough 
with the project to be certain what to do in the other constructors of 
MethodKey to 
make it consistent (or if this is the 'right' fix), but it works for me.

Original comment by adam%wyl...@gtempaccount.com on 12 Aug 2009 at 3:39

GoogleCodeExporter commented 8 years ago
With version 1.5 the attrib attribute is evaluated correctly.
There are two possible values: 'public' and 'protected' (which includes public)

Original comment by webbi...@gmail.com on 6 Nov 2009 at 3:08

GoogleCodeExporter commented 8 years ago
Using the binary release of Obfuscar 1.5.0, I still see this problem. I have 
tried
several variations of the SkipProperty -Method, and -Field command, and it 
appears to
ignore both the public and protected attributes, only following the rx= 
parameter and
other pattern matching. I have tried simple configurations such as:

<SkipType name="^.*"/>
<SkipMethod type="^.*" attrib="public" rx=".*" />

This does not skip public methods for me. :( Similar results with more specific
patterns for type and rx, with both public and private. I will try with svn 
when I
have time.

Original comment by tekh...@gmail.com on 6 Nov 2009 at 10:57