mkaring / ConfuserEx

An open-source, free protector for .NET applications
https://mkaring.github.io/ConfuserEx/
MIT License
2.26k stars 349 forks source link

class with function pointer produces wrong code #533

Open MarcBorgers opened 1 year ago

MarcBorgers commented 1 year ago

Target framework: 4.6.1

For the target framework, the version of .NET that is targetted by the assembly you are trying to obfuscate is relevant. -->

Steps to Reproduce:

  1. enclosed 2 source files that produce an exception when running, see the log of the exception: Exception : System.ArgumentException: Identifier '?????????????????????????????????????????' is not CLS-compliant.

    Parameter name: ident
    
       at System.Xml.Serialization.CodeIdentifier.CheckValidIdentifier(String ident)
    
       at System.Xml.Serialization.XmlSerializationWriterILGen.WriteStructMethod(StructMapping mapping)
    
       at System.Xml.Serialization.XmlSerializationWriterILGen.GenerateMethod(TypeMapping mapping)
    
       at System.Xml.Serialization.XmlSerializationILGen.GenerateReferencedMethods()
    
       at System.Xml.Serialization.XmlSerializationWriterILGen.GenerateEnd()
    
       at System.Xml.Serialization.TempAssembly.GenerateRefEmitAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence)
    
       at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence)
    
       at System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlMapping xmlMapping, Type type, String defaultNamespace)
    
       at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)
    
       at Agfa.Licensing.LicenseServiceConfig.?????????????????????????????????????????(FileInfo )
    
       at Agfa.Licensing.Utilities.SafeFilePersister`1.Read(FileInfo fileToRead, FileInfo tempFileToRead)

The workaround was to exclude one class from Obfuscating (as shown in the source enclosed)

sourcesProducingError.zip