New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

F# dlls obfuscation #47

Closed
GoogleCodeExporter opened this Issue Apr 4, 2015 · 4 comments

Comments

Projects
None yet
2 participants
@GoogleCodeExporter

GoogleCodeExporter commented Apr 4, 2015

Hello,

I try to obfuscate F# dll and I meet some diffcults. It's thrown unhandled 
exception: 

System.InvalidOperationException: Type names do not match: "FSharpFunc `3" != 
"Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3...

If I'm not mistaken Obfuscar.exe can obfuscate all types .NET assemblies. So 
the problem is may be in my code?

Could you get me some suggestions for this issue?

Original issue reported on code.google.com by aleksand...@gmail.com on 16 Oct 2012 at 10:29

@GoogleCodeExporter

This comment has been minimized.

Show comment
Hide comment
@GoogleCodeExporter

GoogleCodeExporter Apr 4, 2015

Unless you can provide obfuscated assembly with mapping file and the original 
one, it is very hard to tell what is the cause of the exception.

You might try my fork at https://github.com/lextm/obfuscar which has already 
resolved many known issues.

Original comment by lextu...@gmail.com on 28 Apr 2013 at 7:57

GoogleCodeExporter commented Apr 4, 2015

Unless you can provide obfuscated assembly with mapping file and the original 
one, it is very hard to tell what is the cause of the exception.

You might try my fork at https://github.com/lextm/obfuscar which has already 
resolved many known issues.

Original comment by lextu...@gmail.com on 28 Apr 2013 at 7:57

@lextm

This comment has been minimized.

Show comment
Hide comment
@lextm

lextm Apr 15, 2015

Member

Another way to reproduce similar issues is to obfuscate F# compiler with

<?xml version='1.0'?>
<Obfuscator>
 <Var name='InPath' value='.' />
 <Var name='OutPath' value='.' />
<Var name='KeyFile' value='$(InPath)\test.snk' />
 <Var name='HidePrivateApi' value='true' />
 <Module file='$(InPath)\fsc.exe' />
<Module file='$(InPath)\FSharp.Compiler.dll' />
<Module file='$(InPath)\FSharp.Compiler.Interactive.Settings.dll' />
<Module file='$(InPath)\FSharp.Compiler.Server.Shared.dll' />
<Module file='$(InPath)\fsi.exe' />
</Obfuscator>

which leads to a crash

Unhandled Exception: System.TypeInitializationException: The type initializer for 'A.a' threw an exception. ---> System.TypeInitializationException: The type initializer for 'C.K' threw an exception. ---> System.TypeInitializationException: The type initializer for 'C.k' threw an exception. ---> System.TypeLoadException: Method 'GenerateNext' in type 'bD' from assembly 'FSharp.Compiler, Version=4.3.0.0, Culture=neutral, PublicKeyToken=f536804aa0eb945b' does not have an implementation.
   at C.k..cctor()
   --- End of inner exception stack trace ---
   at C.K..cctor()
   --- End of inner exception stack trace ---
   at C.K.a()
   at A.a..cctor()
   --- End of inner exception stack trace ---
   at A.A.A(String[] )

Further analysis shows that an overriding method was not properly skipped.

Member

lextm commented Apr 15, 2015

Another way to reproduce similar issues is to obfuscate F# compiler with

<?xml version='1.0'?>
<Obfuscator>
 <Var name='InPath' value='.' />
 <Var name='OutPath' value='.' />
<Var name='KeyFile' value='$(InPath)\test.snk' />
 <Var name='HidePrivateApi' value='true' />
 <Module file='$(InPath)\fsc.exe' />
<Module file='$(InPath)\FSharp.Compiler.dll' />
<Module file='$(InPath)\FSharp.Compiler.Interactive.Settings.dll' />
<Module file='$(InPath)\FSharp.Compiler.Server.Shared.dll' />
<Module file='$(InPath)\fsi.exe' />
</Obfuscator>

which leads to a crash

Unhandled Exception: System.TypeInitializationException: The type initializer for 'A.a' threw an exception. ---> System.TypeInitializationException: The type initializer for 'C.K' threw an exception. ---> System.TypeInitializationException: The type initializer for 'C.k' threw an exception. ---> System.TypeLoadException: Method 'GenerateNext' in type 'bD' from assembly 'FSharp.Compiler, Version=4.3.0.0, Culture=neutral, PublicKeyToken=f536804aa0eb945b' does not have an implementation.
   at C.k..cctor()
   --- End of inner exception stack trace ---
   at C.K..cctor()
   --- End of inner exception stack trace ---
   at C.K.a()
   at A.a..cctor()
   --- End of inner exception stack trace ---
   at A.A.A(String[] )

Further analysis shows that an overriding method was not properly skipped.

@lextm

This comment has been minimized.

Show comment
Hide comment
@lextm

lextm Apr 15, 2015

Member

One generic related issue has been identified and fixed.

Member

lextm commented Apr 15, 2015

One generic related issue has been identified and fixed.

lextm added a commit that referenced this issue Apr 16, 2015

Fixed generic support which is related to #47.
Conflicts:
	Obfuscar/InheritMap.cs
@lextm

This comment has been minimized.

Show comment
Hide comment
@lextm
Member

lextm commented Apr 16, 2015

@lextm lextm closed this Apr 16, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment