Page 1 of 1

.NET XmlSerializer issue

Posted: Wed Dec 17, 2014 6:39 pm
by JeeBently
Hi
After I've protected the .net assembly, it runs fine on win7 x64, but it crashes with the error on Win XP SP3 x32:

As far as I understand, the .net demands to deserialize some types in runtime, so according to .net rules it creates temp files in temp dir and generates on the fly the so-called xxx.XmlSerializers.dll assembly
but during that process, the .net consults(reads?) the original .exe which is protected by enigma tool.

Please advice what could be done to add support for other OS.
.net used is 4.0

------------------------------------------------------------------------------------------------------------------
System.InvalidOperationException: Unable to generate a temporary class (result=1).
error CS0009: Metadata file 'c:\Program Files\xxxxxxx\yyyy.exe' could not be opened -- 'An attempt was made to load a program with an incorrect format. '

at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence)
at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies)
at System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlMapping xmlMapping, Type type, String defaultNamespace)
at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)
at xxxxx.DataIdentifierCollection.ReadFromStream(Stream content)
at xxxxx.DataIdentifierCollection.ReadFromFile(String path)
at frmMain..ctor(xxxxxx)
at xxxxx.Main(String[] args)

Re: .NET XmlSerializer issue

Posted: Sat Dec 20, 2014 10:10 am
by JeeBently
Hi again
after hardwork & investigation I"ve found a working solution
generally speaking, theoretically you'll have this kind of issue (user complains) from time to time
We could make a deal regarding this subject, I could write a very nice and user friendly how-to

Re: .NET XmlSerializer issue

Posted: Mon Dec 22, 2014 8:34 am
by Alec
We usually recommend to put serialization stuff in separate assembly and use put it inside the virtualbox. However if it runs fine on W7 while it doesn't on XPSP3 then this is a bug that should be fixed.

Re: .NET XmlSerializer issue

Posted: Fri Dec 26, 2014 10:47 am
by Enigma
Guys, there is a solution: http://forum.enigmaprotector.com/viewto ... 9141#p9123

XML Serialization dll may be created before protection and such problem will never appear.

Re: .NET XmlSerializer issue

Posted: Sat Dec 27, 2014 7:42 pm
by JeeBently
the mentioned solution
>“$(FrameworkSDKDir)\Bin\sgen”
will work in 80 to 90% of cases
the rest of the cases are not supported by that tool
PM me in a case you'll have that 10 to 20% of issues
That's doable by handcrafting the sgen itself :)
cheers to everybody and yeah, Happy NEW YEAR 2k15!!!