Showing posts with label beta2. Show all posts
Showing posts with label beta2. Show all posts

Wednesday, March 28, 2012

Ajax beta2 -> RTM > JSON Serialization exception when calling a dataservice

Hi all, I must migrate an application from Ajax beta2 to RTM version and I experienced a serious problem.This application uses xml-script that calls some webservices (more specifically dataservices) to fill in objets. These calls throw json serialization exceptions, whatever the returned type.I then wanted to try with a "fresh" web project, I thus created a new project, and then created a small web service inherited from the dataservice class. I placed a typical example of a sample dataservice from internet into my dataservice. Then I used Fiddler to emulate the dataservice call from the script (ie doing a POST with loadmethod parameters etc…), and this simple code produces a serialization exception.The only information I found is herehttp://www.oreilly.com/catalog/atlas/update/version1.0-update.pdf (chapter 9). This chapter is about the same subject, and the author is experience the same trouble in the same circumstances. Christophe Below is the complete exception:

{"Message":"A circular reference was detected while serializing an object of type \u0027System.Reflection.Module\u0027.","StackTrace":" à System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse)\r\n à System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse)\r\n à System.Web.Script.Serialization.JavaScriptSerializer.SerializeCustomObject(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse)\r\n à System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse)\r\n à System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse)\r\n à System.Web.Script.Serialization.JavaScriptSerializer.SerializeCustomObject(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse)\r\n à System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse)\r\n à System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse)\r\n à System.Web.Script.Serialization.JavaScriptSerializer.SerializeCustomObject(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse)\r\n à System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse)\r\n à System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse)\r\n à System.Web.Script.Serialization.JavaScriptSerializer.SerializeCustomObject(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse)\r\n à System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse)\r\n à System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse)\r\n à System.Web.Script.Serialization.JavaScriptSerializer.SerializeEnumerable(IEnumerable enumerable, StringBuilder sb, Int32 depth, Hashtable objectsInUse)\r\n à System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse)\r\n à System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse)\r\n à System.Web.Script.Serialization.JavaScriptSerializer.SerializeCustomObject(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse)\r\n à System.Web.Script.Serialization.JavaScriptSerializer.SerializeValueInternal(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse)\r\n à System.Web.Script.Serialization.JavaScriptSerializer.SerializeValue(Object o, StringBuilder sb, Int32 depth, Hashtable objectsInUse)\r\n à System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext context, WebServiceMethodData methodData, IDictionary`2 rawParams)\r\n à System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.InvalidOperationException"}

The latest release does not support DataSet, DataTables or the Xml Script. You have to add the Preview to work with these objects.


Have you install framework 2.0?


I am using Microsoft.Web.Preview from the the "ASP.NET Futures May 2007" package (assembly version 1.1.61025.0).

I do not use complex objets like Dataset, Datatables,...

The sample code was picked up fromhttp://aspalliance.com/1302_Unveil_the_Data_Binding_Architecture_inside_Microsoft_ASPNET_Ajax_10__Part_2#Page2, but even a string does not serialize !

Note that the call stack shows an exception within System.Web.Script.Serialization, which is in Ajax Extensions, not in futures ...

Christophe.


No, we have no answer at this time.


Hi chrisrodri,

Has your problem been resolved yet ? Would you share your solution(resolved) or new findings?


Hi all,

I finally solved this issue. I have to add these threw following lines into the web.config (in jsonSerialization/converters section):

<addname="DataSetConverter"type="Microsoft.Web.Preview.Script.Serialization.Converters.DataSetConverter"/>
<addname="DataRowConverter"type="Microsoft.Web.Preview.Script.Serialization.Converters.DataRowConverter"/>
<addname="DataTableConverter"type="Microsoft.Web.Preview.Script.Serialization.Converters.DataTableConverter"/>

I do not understand why these lines are needed because i do not use any DataTable or DataRow, just generics Lists that are not dependant of these ones.... but it works !

Wednesday, March 21, 2012

AJAX and Content Pages require MasterPage open stil an Issue in RC1?

Hi,

I have just updated my project to RC1 from BETA2 and it appears that the problem with content pages still exists. When I have a content page open without having the master page open I get a build compilation error on items such as ScriptManager and UpdatePanel. Is everyone else still experiencing this? Or is there something I've missed in my setup and migration? If this issue does exist for everyone, is this issue going to be fixed for the Full Release Version of Microsoft Ajax Extensions?

Thanks

Andrew

Sorry all,

I think I can answer my own post. If found a Post on Scott Guthries Blog which has resolved the problem for me. At the base of the post, Scott instructs users to delete the cached schema files for VS2005 in order to enable Intellisense correctly. The post link ishttp://weblogs.asp.net/scottgu/archive/2006/12/15/asp-net-ajax-1-0-release-candidate-now-available.aspx

Cheers

Andrew


Hi Andrew,

I have same problem as yours, and I did what Scott suggests. But I still get build compliation error. Can you give me some hints.

Thanks a lot,

Sean


Hi Sean,

I found that I needed to close down VS05, delete the schemas from the following directory (Windows XP)

C:\Documents and Settings\[Insert User Name Here]\Application Data\Microsoft\VisualStudio\8.0\ReflectedSchemas

and then go back into VS05 and rebuild the project/site.

Give this a go and let me know how you get on.

Cheers

Andrew


Thanks Andrew,

I did exactly what you instructed and I even re-installed RC, but I still get error. Actually, I should say I get build error from page source view, but no error building from design view. I am wondering if this is bug in RC. Did you have same problem?

Best,

Sean


Hi Sean,

sorry I didn't have the same problem I found once I had followed the steps in the readme and cleared out my schemes I was fine.

ASP.net AJAX v1.0 has now been officially released so why not download the full build and update your project and see if your issue is fixed? I can't upgrade mine at the mo, 'cos I 'm at home and the apps I'm working on are work ones. Will do them in the morning. Let me know how you get on.

Cheers

Andrew


Thanks Andrew,

Actually, I am using AJAX 1.0 officially release. For time being, I just let it go since I can build from design view. And I got one more question, after migrating to AJAX 1.0, the TAB not working properly, for example, click checkbox to display and panel, but the cursor will go to top of page. when I use 'Atlas', I can use Focus( ) to force cursor stay on the check box. But now the Focus not working anymore, Do you have any idea?

Thanks,

Sean


Hi Sean,

how are you getting on with this? One thing that might be worth looking at to clear your issue with building in code view is to create a blank ajax site and then copy the web.config to your site you're having a problem with and put in your appSettings and connection strings etc from your original web.config into the new web.config file.

As for the tab issue can elaborate or provide a sample and I'll see if I can replicate the issue? I haven't had any issues with my current project, the installation of version 1.0 went fine. I have a page which has some calculations updating through AJAX and would expect to see a similar issue with tab but don't.

Cheers

Andrew