Bug 15572 - XmlFormatterDeserializer.GetTypeFromNamePair() throws "Type not found; name: string, namespace:" when deserializing KnownType(typeof(string[]))
Summary: XmlFormatterDeserializer.GetTypeFromNamePair() throws "Type not found; name: ...
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: WCF assemblies ()
Version: 3.2.x
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-10-21 23:09 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2014-02-12 16:07 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Test case (3.05 KB, application/zip)
2013-10-21 23:09 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Brendan Zagaeski (Xamarin Team, assistant) 2013-10-21 23:09:32 UTC
Created attachment 5196 [details]
Test case

Reported on behalf of a user.

Related to bug #2205. Also similar to bug #3811, but the test case for #3811 appears to be working correctly as of Mono 3.2.3.


## Summary

1. Build and run the attached test project using Mono. This will produce the following error:

"Type not found; name: string, namespace:"

The problem seems to be the use of String.Empty in the call to `XmlFormatterDeserializer.GetTypeFromNamePair (name, String.Empty)` [1]. Breaking on this call and invoking `GetTypeFromNamePair (name, "http://schemas.microsoft.com/2003/10/Serialization/")` in the Immediate window yields a nice looking result, at least in the cases `name = "int"` and `name = "string"`. 

> [1] https://github.com/mono/mono/blob/master/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/XmlFormatterDeserializer.cs#L264


2. Due to this problem, DataContractSerializer fails when deserializing DataMembers that use an array KnownType.


3. The project builds and runs without error on .NET.


4. Note that the project includes two different XML files for the serialized object. The Mono version is currently incorrect due to bug #2205.


## Version information
Mono 3.2.3
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2013-11-26 23:32:54 UTC
https://github.com/mono/mono/pull/820

Pull request that works around the problem for the test case, and that might be acceptable as a complete fix.
Comment 2 Miguel de Icaza [MSFT] 2014-02-12 15:31:31 UTC
Applied the patch.

Thanks!
Comment 3 Miguel de Icaza [MSFT] 2014-02-12 16:07:10 UTC
Added a unit test based on your sample as well