|
Bugzilla – Full Text Bug Listing |
| Summary: | DataContractSerializer constructor crashes if one of the 'KnownType' attributes defines a method instead of a type. | ||
|---|---|---|---|
| Product: | [Mono] Mono: Class Libraries | Reporter: | Joseph Fradley <joe.fradley> |
| Component: | WCF | Assignee: | Noam Lampert <noaml> |
| Status: | NEW --- | QA Contact: | Mono Bugs <mono-bugs> |
| Severity: | Normal | ||
| Priority: | P5 - None | ||
| Version: | 2.4.x | ||
| Target Milestone: | --- | ||
| Hardware: | 32bit | ||
| OS: | Other | ||
| Whiteboard: | |||
| Found By: | --- | Services Priority: | |
| Business Priority: | Blocker: | --- | |
| Marketing QA Status: | --- | IT Deployment: | --- |
| Attachments: | Simple stand alone example of problem | ||
Created attachment 297227 [details] Simple stand alone example of problem User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.10) Gecko/2009042708 Fedora/3.0.10-1.fc9 Firefox/3.0.10 If the constructor of DataContractSerializer is called using a type that has any KnowType attributes defined using a methodname and not a Type a NullReferenceException is thrown. Looking at the source code for DataContractSerializer for version 2.4 it looks like the problem is in PopulateTypes(). It assumes that a type is always defined when in fact a methodname could be instead, in which case the method would need to be called to get the list of known types. Reproducible: Always Steps to Reproduce: 1. create a class with [DataContract] attribute and [KnownType(string methodname)] attribute. 2. Serialize the class using a DataContractSerializer object. Actual Results: Stack Trace: Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object at System.Runtime.Serialization.KnownTypeCollection.IsPrimitiveNotEnum (System.Type type) [0x00000] at System.Runtime.Serialization.KnownTypeCollection.TryRegister (System.Type type) [0x00000] at System.Runtime.Serialization.DataContractSerializer.PopulateTypes (IEnumerable`1 knownTypes) [0x00000] at System.Runtime.Serialization.DataContractSerializer..ctor (System.Type type, IEnumerable`1 knownTypes) [0x00000] at System.Runtime.Serialization.DataContractSerializer..ctor (System.Type type) [0x00000] Expected Results: No exception.