question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

V 16.1.1-FileUpload: JSON Error in OnUploadComplete Event - Sys.ArgumentException: Cannot deserialize.

See original GitHub issue

The AJAX Control Toolkit <16.1.1>

The installation method

  • NuGet package

Steps to reproduce the bug

The user uploads the file using Upload button in the FileUpload control. The file is uploaded in the TEMP folder of the server (Windows\Temp_AjaxFileUpload folder) Then in the OnUploadComplete event -

  1. Get the Byte Array of file data from AjaxFileUploadEventArgs parameter of the event
  2. Try inserting it in SQL Server table. While the Parameters for the SQL stored procedure are being built, on the last “String” parameter suddenly the code jumps to the event error handler and shows the following error in a dialog box:

http://localhost:54707/ScriptResource.axd?d=D9drwtSJ4hBA6O8UhT6CQgpXCD1qinW4JQMZEulR4i9agpZvcQpXII5IhvWlVxdFAWSv2wOvry2vKPNBwZaGtoOAsfV_970iEegMrPrWe23VqntJU355JMh8X01BYDij25EvJyUO-9vqAiN9ZSBQQdM6hBruRT9bNCEYIJiq-tA1&t=ffffffffc7ae6e38

0x800a139e - JavaScript runtime error: Sys.ArgumentException: Cannot deserialize. The data does not correspond to valid JSON.

The procedure in the ScriptResource.axd which throws the error is: `Sys.Serialization.JavaScriptSerializer.deserialize = function Sys$Serialization$JavaScriptSerializer$deserialize(data, secure) { var e = Function._validateParams(arguments, [ {name: “data”, type: String}, {name: “secure”, type: Boolean, optional: true} ]); if (e) throw e; if (data.length === 0) throw Error.argument(‘data’, Sys.Res.cannotDeserializeEmptyString); try {
var exp = data.replace(Sys.Serialization.JavaScriptSerializer._dateRegEx, “$1new Date($2)”);

    if (secure && Sys.Serialization.JavaScriptSerializer._jsonRegEx.test(
         exp.replace(Sys.Serialization.JavaScriptSerializer._jsonStringRegEx, ''))) throw null;
    return eval('(' + exp + ')');
}
catch (e) {
     throw Error.argument('data', Sys.Res.cannotDeserializeInvalidJson);
}

} `

This is happening in Version 16.1.1 earlier versions 15.x were running fine. My code has not changed.

This happens in IE 11, Edge, Firefox and Chrome browsers (latest versions). Others have not been tested.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nitinphansalkarcommented, Jan 12, 2017

UPDATE: I installed NuGet package for version 16.1.0 and it works. So the latest version 16.1.1 has some issue. Please note that I have NOT added the TempFolder attribute for the AjaxControlToolkit in the web.config that was introduced in the 16.1.1

0reactions
MikhailTymchukDXcommented, Jan 26, 2017

Since we still haven’t received the requested information, I’m closing this issue. Feel free to reopen it once you have any additional info regarding the error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot deserialize the json file with list of events?
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is...
Read more >
Ajax file upload in wizard - MSDN - Microsoft
Uncaught Sys.ArgumentException: Sys.ArgumentException: Cannot deserialize. The data does not correspond to valid JSON. Parameter name: data.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found