Reflection WPF .net

Post here messages if you have any problems with working of Enigma Protector
Post Reply
groupThink
Posts: 15
Joined: Mon Apr 02, 2012 4:08 pm

Reflection WPF .net

Post by groupThink »

When protected my WPF .net application crashes on this line:

Code: Select all

XmlSerializer x = new XmlSerializer(p.GetType());
Is that because Enigma obfuscates the code and reflection doesn't work ? That said

Code: Select all

MessageBox.Show(p.GetType().ToString());
Shows the expected type name

Cheers,

Chris.
Enigma
Site Admin
Posts: 2945
Joined: Wed Aug 20, 2008 2:24 pm

Re: Reflection WPF .net

Post by Enigma »

Hi Chris,

This can be fixed by generating the serialisers using sgen.exe as a Post Build Event

“$(FrameworkSDKDir)\Bin\sgen” /a:"$(TargetPath)" /force

It generates a dll ({ProjectName}.XmlSerializers.dll) that makes it work. It can be included in the Virtual Box then.
groupThink
Posts: 15
Joined: Mon Apr 02, 2012 4:08 pm

Re: Reflection WPF .net

Post by groupThink »

That's it thanks.

Note 64 bit and .net 4.0 users will need to use the correct path:

Code: Select all

“$(FrameworkSDKDir)\Bin\NETFX 4.0 Tools\sgen” /a:"$(TargetPath)" /force
Enigma
Site Admin
Posts: 2945
Joined: Wed Aug 20, 2008 2:24 pm

Re: Reflection WPF .net

Post by Enigma »

Yes, thanks you for the addition!
sanyock
Posts: 60
Joined: Sat May 12, 2012 7:36 am
Contact:

Re: Reflection WPF .net

Post by sanyock »

Is it allowed to disable obfuscation of a .NET assembly if using 3rd party obfuscator?
Btw, is obfuscation feature missing from the demo?
Enigma
Site Admin
Posts: 2945
Joined: Wed Aug 20, 2008 2:24 pm

Re: Reflection WPF .net

Post by Enigma »

Enigma Protector does not allow to obfuscate .net code, so it is even recommended to use some obfuscator before protection.
As per experience, there was not reported any incompatibility of Enigma Protector with any 3rd obfuscation tools.
Post Reply