Application is in encrypted state even on hard drive and this is why .net framework core may refuse to load encrypted application on some occasions. Any programming technique (like xml serialization) which is expecting original, non-encrypted .net application on hard drive may thus fail.
If you are using xml serialization or reflection and you are having problems with protected application you can do the following:
1. Move this code to another, non-encrypted .net .dll or .exe application.
2. Use .NET Framework XML Serializer Generator Tool (Sgen.exe) or XGenPlus to generate new assembly (*.XmlSerializers.Dll) with serializable types in order to be able to use XML serialization from protected application.
- For some reason, .NET 3.5 will ignore generated *.XmlSerializers.Dll and will still use command line c# compiler (csc) for serialization. Changing target .NET framework version from 3.5 to 4.0 would be the easiest solution in this case.
- By default, Sgen.exe will generate new assembly with all public types. We suggest using sgen with /type parameter and generating assembly only with types on which serialization is actually used.