Bug 23788 - JavaScriptSerializer fails serialize/deserialize null
Summary: JavaScriptSerializer fails serialize/deserialize null
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Web (show other bugs)
Version: 3.8.0
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-10-13 14:51 UTC by mewan
Modified: 2014-10-13 14:51 UTC (History)
1 user (show)

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


Attachments

Description mewan 2014-10-13 14:51:27 UTC
The following unit test fails when run under mono:

        private static readonly JavaScriptSerializer _serializer = new JavaScriptSerializer();

        /*
         * Fails under Mono!!
         * 
         * System.ArgumentException : Invalid JSON string
         */
        [Test]
        public void SerialDeserialNullString()
        {
            var str = _serializer.Serialize(null);
            Console.WriteLine(str);
            Assert.IsNull(_serializer.Deserialize<string>(str));
        }

I get the same result when testing this against any nullable type:  arrays, objects, etc.  This test passes when run on Windows using Microsoft's c-sharp libs.

Note You need to log in before you can comment on or make changes to this bug.