ArgumentException Identifier ' ' is not CLS-compliant. On Serialization [closed]
I'm having a trouble debugging this problem.
It has occurred twice now in an application I'm working on and only happens when the program is run in release mode. The program runs fine in debug mode :-(
I get the ArgumentException when I attempt to serialize an object. I tracked the first exception down to when the following variable was serialized:
public SerializableDictionary<MyEnum1, SerializableDictionary<MyEnum2, Double>> my_collection;
I evaded the issue by replacing MyEnum2 with a string, evading the issue it then cropped up again in a total开发者_StackOverflow different area of the program. This time, when an object containing the following variable is serialized:
public SerializableDictionary<MyEnum1, MyObject> my_other_collection;
In both instances i'm using Paul Welter's SerializableDictionary object. I have used this on previous releases of the program and have never run into this problem. The Exception for the latter is as follows:
System.ArgumentException: Identifier ' ' is not CLS-compliant.
Parameter name: ident
A full dump of the Exception can be viewed on pastebin
I have viewed a number of posts with CLS-compliant warnings/errors on SO but they don't seem to be the same problem. I would appreciate some tips on how I can debug this issue further, as the exception only occurs when run in release mode I'm running out of ideas!
OMG... 5 days of my life have been wasted with this error.
Another dev had added eazfuscator to the whole app. I removed the post build event command line inserted by eazfuscator and life is good again.
Obviously, obfuscation and serializable classes are not a good mix!
It's possible that you are trying to encode a character that is not cls compliant, ' ' might not be a space but could be a non printable character.
Does your program have to be CLS compliant? You can mark and assembly as not being CLS compliant if you want to. (I can't remember how though as it's been a while since I've needed to do this)
A bit late not for the original poster, but anyway.
I was receiving this error as my public property's where not named correctly, they had to start with an Uppercase letter.
It may be worth mentioning that this only happened when building in release as I have "Warning as Error" turned on. Hope this helps
精彩评论