What the AJAX Sys.ParameterCountException: Parameter count mismatch error?

Developers turn to Google or Cuil.com when they receive an error message, I believe is an automatic reaction, in the old days you were stuck debugging that COTS library, right now, we are looking for peers that went through the same experience, and hopefully they were successful, this post is not the case.

Since I added the ScriptManager into my application I have been having an intermittent issue. Sys.ParameterCountException. So I did some research. 

Somebody is throwing an exception with the incorrect parameters? MSDN article

Debug the problem here

Download Microsoft Script Debugger here

So not fast answer? I am shocked, this is what I was looking for, a quick simple resolution for me to implement, instead I am here deciding to move the problem to the back burner.

The articles above are the most viewed and search articles for this search. Still cannot find the answer or how to find out what parameters is causing the exception.

For the time being I removed the ScriptManager and I’ll be using my AJAX.js file until I hate the time to look into it.

In other words, if you know the resolution to this problem, please share with me before I spend any more time looking for the answer in Google.

Cheers

Al

Published Thursday, July 31, 2008 11:28 PM by albertpascual
Filed under: , , , ,

Comments

# re: What the AJAX Sys.ParameterCountException: Parameter count mismatch error?

Friday, August 01, 2008 3:42 AM by InfinitiesLoop

Thats what happens when you call a public method of an ajax API with the incorrect number of parameters. For example, try Boolean.parse("true", "what?"). It only takes 1 parameter, you passed in 2. This error is only thrown in debug mode, which is probably why you dont get it if you dont use the script manager (you're using the release mode of the script when you reference it manually, arent you?)

You aren't finding many specific articles about the error because it's such a generic error -- thousands of methods can throw this error.

As for what method it is you are calling, the best way to find out is to look at the call stack when the exception occurs.

# re: What the AJAX Sys.ParameterCountException: Parameter count mismatch error?

Friday, August 01, 2008 4:20 AM by Sean Kinsey

The most likely reason is that one of the values you are submitting is null or undefined. This will cause the javascript proxy function to completely drop the parameter. So instead of having x name/value pairs, one which contains a null, you have only the name/value pairs of non-null values.

The easies way to debug this is through Firebug or with Fiddler2.

# re: What the AJAX Sys.ParameterCountException: Parameter count mismatch error?

Friday, August 01, 2008 7:33 AM by kamii47

Agreed With Sean.

One or more parameter may have empty name/value pair.

U have debug it using FireBug or fiddler

# re: What the AJAX Sys.ParameterCountException: Parameter count mismatch error?

Wednesday, September 10, 2008 5:42 AM by Valliappan

I set the ScriptMode property to Release for the ScriptManager control, and the problem got solved.

Refer: www.asp.net/.../ASPNETAJAXDebuggingAndTracingOverview.aspx

Thanks.

# re: What the AJAX Sys.ParameterCountException: Parameter count mismatch error?

Wednesday, June 17, 2009 11:00 AM by Sam

Who on earth would go to cuil.com to search for an error message, obviously you are trying to get them some links.

Epic fail.

# re: What the AJAX Sys.ParameterCountException: Parameter count mismatch error?

Saturday, April 02, 2011 5:53 AM by weblogs.asp.net

What the ajax sys parametercountexception parameter count mismatch error.. Ho-o-o-o-t :)

# re: What the AJAX Sys.ParameterCountException: Parameter count mismatch error?

Thursday, April 28, 2011 7:04 PM by weblogs.asp.net

What the ajax sys parametercountexception parameter count mismatch error.. Great! :)

# re: What the AJAX Sys.ParameterCountException: Parameter count mismatch error?

Saturday, June 11, 2011 7:37 PM by weblogs.asp.net

What the ajax sys parametercountexception parameter count mismatch error.. Outstanding :)

# re: What the AJAX Sys.ParameterCountException: Parameter count mismatch error?

Wednesday, September 07, 2011 3:11 PM by Daragust

I discovered in my striving to fix this issue that another cause can be attempting to send an array of different types. In my case, I had 1 int and some others that had been cast as decimals. When the compiler attempted to send this, it couldn't convert the remaining pairs to strings and errored out.

# re: What the AJAX Sys.ParameterCountException: Parameter count mismatch error?

Thursday, January 12, 2012 3:56 PM by Howie

I was getting this error and was able to fix the problem.

It took me a long time to figure out.

I was coding dsOutParams.addParameter with SqlDbType.Bit.ToString, length = 1

for a bit db field.

I changed this to

SqlDbType.Int.ToString, length = 4

and the error went away.

# re: What the AJAX Sys.ParameterCountException: Parameter count mismatch error?

Thursday, February 02, 2012 1:33 AM by Joya

thanks, Valliappan. I got my problem solved by following your suggestion

# re: What the AJAX Sys.ParameterCountException: Parameter count mismatch error?

Tuesday, February 14, 2012 12:41 PM by Mick

Oh Yes! Thankyou. I had this error when I upgraded from VS2008 to 2010 and moved to Win 7 at the same time. All was working OK before, but after the upgrade I got this error more or less every time I launched a page from my main menu page. Sometimes it would launch OK the first time then give the error the next time.

Setting the ScriptManager scriptmode to 'release' appears to have solved it :)

Thanks again!

# re: What the AJAX Sys.ParameterCountException: Parameter count mismatch error?

Friday, March 23, 2012 10:48 AM by Obike C. Onyebuchim

Setting the ScriptManager scriptmode to 'release' worked for me too.

It seems to be best way out

Leave a Comment

(required) 
(required) 
(optional)
(required)