Red Gate forums :: View topic - Obfuscation problem
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SmartAssembly 5
SmartAssembly 5 forum

Obfuscation problem

Search in SmartAssembly 5 forum
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
Jump to:  
Author Message
sergey



Joined: 02 Dec 2010
Posts: 1

PostPosted: Thu Dec 02, 2010 12:46 pm    Post subject: Obfuscation problem Reply with quote

Hi guys,

I am using SmartAssembly 5.5 to obfuscate my assembly and it seems an unexpected problem occurred: A few internal classes and enums is partially obfuscated - namespace and class name aren't changed after obfuscation, although their members in classes are obfuscated and the ones aren't obfuscated in enums. Nevertheless, other internal classes in my code were obfuscated normally. I cannot found any differences for these classes in source code. Could you explain me what is the reason of this problem?

Code:

namespace Html.Model
{
    internal enum TextVAlignType
    {
        Baseline,
        Bottom,
        Middle,
        Top,
        Sub,
        Super,
        TextBottom,
        TextTop
    }
}

or
Code:

internal class SupportClass {
...
}


Here is my sa project
Code:

SmartAssemblyProject ProjectId="{ae26c659-45c9-4856-9773-bda43a46f02d}" Version="2.0">
    <MainAssemblyFileName>..\..\build-out\NET20\MyAssembly.dll</MainAssemblyFileName>
    <FriendlyName>MyAssembly</FriendlyName>
    <CompanyName>MyAssembly</CompanyName>
    <Configuration Name="Release">
        <ApplicationName>MyAssembly</ApplicationName>
        <Destination DestinationFileName="..\..\build-out\Obfuscated\NET20\MyAssembly.dll" />
        <Assemblies>
            <Assembly AssemblyName="MyAssembly, Culture=neutral, PublicKeyToken=716fcc553a201e56">
                <Merging>
                    <ResourcesCompression Compress="1" />
                    <MemberRefsProxy Proxy="0" />
                    <Pruning Prune="1">
                        <Exclusion />
                    </Pruning>
                    <Obfuscation Obfuscate="1">
                        <Exclusion />
                    </Obfuscation>
                    <ControlFlow Obfuscate="1" ObfuscationLevel="2" />
                    <ResourcesPruning />
                </Merging>
            </Assembly>
            <Assembly AssemblyName="{smartassembly}.ResourceResolver, Culture=neutral, PublicKeyToken=7f465a1c156d4d57">
                <Merging>
                    <Obfuscation>
                        <Exclusion />
                    </Obfuscation>
                </Merging>
            </Assembly>
            <Assembly AssemblyName="SmartAssembly.AssemblyResolver, Culture=neutral, PublicKeyToken=7f465a1c156d4d57">
                <Merging>
                    <Obfuscation>
                        <Exclusion />
                    </Obfuscation>
                </Merging>
            </Assembly>
            <Assembly AssemblyName="SmartAssembly.StringsEncoding, Culture=neutral, PublicKeyToken=7f465a1c156d4d57">
                <Merging>
                    <Obfuscation>
                        <Exclusion />
                    </Obfuscation>
                </Merging>
            </Assembly>
            <Assembly AssemblyName="SmartAssembly.Zip, Culture=neutral, PublicKeyToken=7f465a1c156d4d57">
                <Merging>
                    <Obfuscation>
                        <Exclusion />
                    </Obfuscation>
                </Merging>
            </Assembly>
        </Assemblies>
        <Options>
            <Obfuscation FieldsNameMangling="2" NameMangling="2" />
            <ExceptionReporting ReportExceptions="0" Template="res:{SmartExceptions}.1033.dll" />
            <StrongNameSigning KeyFileName="..\..\src\MyKey.snk" Sign="1" />
            <OtherProtections SuppressIldasm="1" />
            <StringsEncoding Compress="1" Encode="1" />
            <OtherOptimizations SealClasses="0" />
            <Debugging />
        </Options>
    </Configuration>
</SmartAssemblyProject>


Thanks,
Sergey
Back to top
View user's profile Send private message
CodeGuru



Joined: 22 Nov 2010
Posts: 9

PostPosted: Thu Dec 02, 2010 8:10 pm    Post subject: Reply with quote

If you .ToString() an enum, the enum and its class won't get obfuscated.

I've made a post about it here, and also submitted the working example to SA.
Back to top
View user's profile Send private message
nick.maidment



Joined: 29 Jan 2010
Posts: 74

PostPosted: Fri Dec 03, 2010 10:56 am    Post subject: Reply with quote

Yes, it would seem that if at any point you have a call to Format, GetName, GetNames, Parse, or ToString on an Enum, SA decides to not obfuscate it Sad
Back to top
View user's profile Send private message
Display posts from previous:   
This topic is locked: you cannot edit posts or make replies. All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group