Exception Loading the System.Web.Extension assembly

Feb 6, 2008 at 7:18 PM
Edited Feb 6, 2008 at 8:38 PM
I am attempting to use this control in one of my applications. I was using version 1 and it worked great. However, it needed quite a few of the features offered in v2.5, so here I am. When I upgraded my source using this one, I ran into a problem that only happened on specific user controls/pages. I would get the following exception:

The type initializer for 'Artem.WebControls.UI.Controls.ClientScriptHelper' threw an exception.

The stack trace led me to line 30 in ClientScriptHelper.cs. It is currently this:

Type scriptManagerType = Type.GetType("System.Web.UI.ScriptManager, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35", false) ??
Type.GetType("System.Web.UI.ScriptManager, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35", false);

When I switched it to this, everything worked again:

Type scriptManagerType = null;
try
{
scriptManagerType = Type.GetType("System.Web.UI.ScriptManager, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35", false);
}
catch
{
scriptManagerType = Type.GetType("System.Web.UI.ScriptManager, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35", false);
}

In the original code, the second part of the evaluation would never be reached.
Coordinator
Feb 7, 2008 at 6:00 AM
Hi,
Nice catch. You are absolutly right.
I'll fix this by tomorrow.
Thanks a lot.

Regards,
Velio
Coordinator
Feb 7, 2008 at 6:02 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.