ASP.NET Javascript Converter doesn't seem to be called

I have an ASP.NET 3.5 SP1 web application that uses its own JavaScriptConverter. The code used to work at some point in the past, but stops working. I do not know what changes have occurred on the side of the middle server. The problem that we see now is that the converter is not being called, so we get errors that cannot be serialized in System.Data.DataRow.

The following is the relevant part of web.config:

<system.web.extensions> <scripting> <webServices> <jsonSerialization> <converters> <add name="DataSetConverter" type="Microsoft.Web.Preview.Script.Serialization.Converters.DataSetConverter, Microsoft.Web.Preview" /> <add name="DataRowConverter" type="WebUI.DataRowConverter, WebUI.DataRowConverter, Version=1.1.0.323, Culture=neutral" /> <add name="DataTableConverter" type="Microsoft.Web.Preview.Script.Serialization.Converters.DataTableConverter, Microsoft.Web.Preview" /> </converters> </jsonSerialization> </webServices> </scripting> </system.web.extensions> 

The truncated version of the class looks as follows (it is truncated only to avoid losing space with an unnecessary implementation):

 using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Data; using System.Web.Script.Serialization; namespace WebUI { public class DataRowConverter : JavaScriptConverter { private ReadOnlyCollection<Type> _supportedTypes = new ReadOnlyCollection<Type>(new Type[] { typeof(DataRow) }); public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer) { // stuff return dr; } public override IDictionary<string, object> Serialize(object obj, JavaScriptSerializer serializer) { // stuff return dictionary; } public override IEnumerable<Type> SupportedTypes { get { return this._supportedTypes; } } } } 

It seems that the class is really loading (if we select it from web.config and the project links, there are no breakpoints, return it to web.config and copy the DLL / PDB manually or add it to the project, breakpoints are available), but it doesn’t used properly. Not a single breakpoint in the class falls, and no exceptions (including those thrown in the constructor, added to view what is happening) are thrown. It seems that the class is loading, but never called.

This applies to IIS 7.5 and IIS 7.0 in integrated mode, if that matters.

Does anyone have any idea?

+6
json asp.net-ajax
source share
1 answer

OK, just in case anyone else does this, when calling web services through automatically generated test pages, custom serializers do not call - they are bypassed. This is apparently by design.

0
source share

All Articles