Geeks With Blogs

News Stack Overflow It's the reason my blog posts have trickled off. Blame it!


Lessons Learned Preserved for Posterity
Ok, imagine the following situation:

You are a developer and you want to keep up with the latest technology, so you update Visual Studio 2008 with Service Pack 1, installing .NET 3.5 Service Pack 1 as part of the update. You then proceed to continue with your ASP.NET application, building a nice neat AJAXy application. Everything works fine on your box, it's awesome, the in-your-cube demos go great, everybody's happy. So you build and deploy your new hotness then sit back and wait for the pats on the back.

The pats never come. Instead, you get reports of exceptions being thrown by the application every request. Something has gone horribly wrong. It's always the same exception:
Could not load type 'System.Web.UI.ScriptReferenceBase' from assembly 
'System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35'.
You are stymied. You've never heard of the class; you certainly don't use it in your code. You use ScriptReference, of course; who doesn't? But what's ScriptReferenceBase? Going to the documentation for ScriptReferenceBase, you learn that it is the parent class of ScriptReference and CompositeScriptReference. What? No it isn't! The documentation for ScriptReference clearly indicates that it's parent is System.Object! What's going on here?

Then you notice the Version Information for ScriptReferenceBase: "Supported in: 3.5 SP1". It's a new class for Service Pack 1. It doesn't exist in .NET 3.5 and the documentation for ScriptReference is clearly stale.

Following a hunch, you double-check your server... yep. Due to red tape, SP1 hasn't been installed on the server. It turns out that when you compiled your code with the SP1 ScriptReference, you built a reference to ScriptReferenceBase and that class just isn't on the server. The solution is simple: install SP1 on the server.

Except you can't upgrade to SP1! Internal circumstances (i.e. no time for regression testing) means no upgrade. So no biggie; you return to Visual Studio 2008 and decide to target .NET 3.5 rather than .NET 3.5 SP1.

Except, surprise! You can't. Visual Studio will target .NET 3.0 and 2.0, but it won't let you differentiate between .NET 3.5 and .NET 3.5 SP1. OUCH.

So what do you do? At this point, your options are limited. The best option is to install SP1 on the server, but sometimes internal pressures won't allow that. Other options include uninstalling SP1 from your box and recompiling -- good luck with that one! -- and finding an unadulterated version of VS 2008 somewhere (a co-worker's box, maybe a virtual machine) and compiling there.

So why am I writing about this hypothetical situation? Because it happened to me, of course! I learned an important lesson. Maybe you can too. Posted on Thursday, August 21, 2008 10:15 AM | Back to top


Comments on this post: Hidden Surprises in .NET 3.5 Service Pack 1

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
I had a similar issue when I installed the original 3.5 with VS 2008 because that puts SP1 for 2.0 and 3.0 on your machine -- and surprise, there's at least one potential case I found where the IL for 2.0 was different with SP1 than without it. We chose to create a VM with just 2.0 for building since there is no way to target 2.0 without SP1 if you have SP1.
Left by Paul Wilson on Aug 21, 2008 1:38 PM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
Your not the only one in the situation, I "got around" it by reading my js files and RegisterStartScript'ing them, but its a messy hack that shouldn't need to be there.
Left by Jason Baginski on Aug 21, 2008 1:41 PM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
I was able to correct the problem by rolling back to the previous version of the AJAX control toolkit that I was publishing with my project. I rolled back to version 3.0.20229 from 3.0.20820. This is the only change that I had to revert back to. I still have SP1 on my pc but the server does not. I republished and got the site to work again.
Left by John Oswalt on Sep 11, 2008 9:09 AM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
Excellent, thanks for the workarounds, guys!
Left by Randolpho on Sep 11, 2008 9:15 AM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
Thanks for the post. I just ran into this with WebHost4Life when I deployed a new application. This is how their tech support replied:

"Hi, as there’s a bug(or new security setting) in asp.net version 3.5sp1 causing some 3rd party asp.net assemblies run into error, we are hold off all .net upgrade to 3.5sp1. We are waiting the latest update from Microsoft official. We are apologetic for any inconvenience."
Left by Martillo on Sep 15, 2008 10:54 AM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
I also tried rolling back to version 3.0.20229 of the AJAX Control Toolkit and this seems to have worked so far.

My hosting service (WebHost4Life) says they don't have a way to inform me when they finally upgrade the server to SP1. Does anybody know of a way that I can determine programatically from within my ASP.Net application if SP1 is installed on the server?
Left by Martillo on Sep 17, 2008 2:01 PM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
I've posted this as an issue on the ACT Codeplex sie
Left by Martillo on Sep 17, 2008 2:12 PM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
This will happen with any dll that uses ScriptReference and that was compiled against SP1. The Control Toolkit can be recompiled against 3.5 to work around the issue if the server can't be upgraded.
Left by Bertrand Le Roy on Sep 23, 2008 1:41 PM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
Betrand's comment helps explain another aspect of this issue that I just encountered...

I decided to precompile my app before deploying to the remote server (that doesn't have SP1 installed) and the error resurfaced, apparently because pages within the app that use ScriptReference were compiled into DLLs on my dev workstation, which has SP1 installed, whereas in my previous workaround they were compiled by the remote server when first requested, which is why simply deploying the earlier version of the Control Toolkit had resolved the problem.
Left by Martillo on Oct 14, 2008 10:41 PM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
Sounds like DLL Hell is back! I am struggling with this one as well.
Left by Tom van Stiphout on Oct 23, 2008 10:51 AM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
Not exactly what I wanted to deal with right out of the box as I am trying to learn AJAX. I recently purchased the Standard Edition of VS 2008 so I could have it at home to play with. Not sure if it's SP1 or not. Then I downloaded the only version available of the ToolKit yesterday, and now I get this error running any of the samples from within VS. Other than changing that Script tag 100s of times, is there something I can do? I don't see any previous versions of the ToolKit and it does not appear that I can roll SP1 back in VS.
Left by Bob on Apr 30, 2009 1:18 PM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
@Bob: In your case, it looks like you *don't* have SP1 installed and the Toolkit is compiled against SP1. If you install SP1 you should be fine.
Left by Randolpho on Apr 30, 2009 11:25 PM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
Hey, I am using a third party asp tools. I think the controls are complied with .net sp1 beta, my system has .net 3.5 (NOT SP1), so I am facing the same problem, at page load it is showing me error “Could not load type 'System.Web.UI.ScriptReferenceBase'”.
Left by Mayank on Jun 29, 2009 4:21 AM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
Yeah im on release Sept 2009 and its still happening. Man these guyz are oblivious to issues and implementing the fix.

Looks like the Microsoft product of push out with problems and start the process of patching the problem to the patch of the problem to the patch model. Cant wait till someone comes out with a product like Windows and offer it 80% bug-free instead of 30% bug-free.
Left by John Wood on Oct 21, 2009 10:54 AM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
This blog saved my project just in time, installing SP1 on the server worked just fine for us. THANKS !
Left by JS Nathan on Feb 04, 2010 8:12 AM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
Please help me on this. When i am publishinh it on Win 2003 server it giving following error:


Server Error in '/Surveys/CartoonContestPoll' Application.
--------------------------------------------------------------------------------

Could not load type 'System.Web.UI.ScriptReferenceBase' from assembly 'System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.TypeLoadException: Could not load type 'System.Web.UI.ScriptReferenceBase' from assembly 'System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[TypeLoadException: Could not load type 'System.Web.UI.ScriptReferenceBase' from assembly 'System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.]
AjaxControlToolkit.ToolkitScriptManager.OnResolveScriptReference(ScriptReferenceEventArgs e) in C:\AjaxBuild\Ajax\Server\AjaxControlToolkit\ToolkitScriptManager\ToolkitScriptManager.cs:238
System.Web.UI.ScriptManager.RegisterScripts() +154
System.Web.UI.ScriptManager.OnPagePreRenderComplete(Object sender, EventArgs e) +109
System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +107
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4917




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053
Left by Anupam Dwivedi on Feb 11, 2010 3:52 AM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
Hi I am Ajeet and i was so happy when i was created my ajax enable website and there was a cause behind my happiness that my website was run so well on my system but when i tried to run that website on another computer suddendy this error happens and i m searching the solution of this problem when i'll got i'll publish soon. and pls any got answer before me pls mail me.
thannks....
Left by Ajeet Kumar Prabhakar on Apr 30, 2010 7:54 AM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
ThAnKs Friend.

U Save Me.

I like to Provide to all here to download 3.5 SP 1

http://www.microsoft.com/downloads/details.aspx?familyid=27673c47-b3b5-4c67-bd99-84e525b5ce61&displaylang=en
Left by Aniruddha on May 26, 2010 1:42 PM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
Change Toolkit Scriptmanager to Regular scriptmanager. This will solve the problem. http://techdotnets.blogspot.com
Left by Nike on May 27, 2010 6:18 AM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
Thanks, had the same problem after converting a project to visual studio 2010.
Installing SP1 on the server worked for my.

Greetings,
Marco
Left by Marco on Jun 01, 2010 8:26 AM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
Thanks,had the same problem after converting a project to VS 2008 .could you powered me lots of download about SP1?
Thanks very much!
Left by Tony on Jun 04, 2010 10:45 PM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
thank for this topic. I've solved that problem by installing .NET Framework 3.5 Service Pack 1. Keep up your good topic.
Left by tannew on Jul 09, 2010 11:23 PM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
I also rolled back to version 3.0.20229 of the AJAX Control Toolkit and it appears to be working. Thanks!
Left by Tim on Jul 14, 2010 11:57 AM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
As a freelancer be careful with this type of errrrrr.

Thanks guys !

Becoz you I overcome this !

Thanks & Regards !
Nilesh
Left by Nilesh Mohite India on Sep 13, 2010 12:03 PM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
thanks
Ihave same problem.
Left by coder99 on Sep 16, 2010 4:34 AM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
how to install .net framework sp1 on the server
Left by meet on Dec 15, 2010 3:44 AM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
added to the Script Manager and everything worked fine without installing SP1 and I am using RadScriptManager
EnableScriptCombine="false" LoadScriptsBeforeUI="true"
Left by Chetan on Feb 17, 2011 9:35 AM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
Rolling back to version 3.0.20229.23022 of the AjaxToolkit.dll solved my issue.
Left by Kagisho on Apr 14, 2011 11:29 AM

# re: Hidden Surprises in .NET 3.5 Service Pack 1
Requesting Gravatar...
Great post. Thanks for letting us know. Lesson learned. -Kyle Thomas Glasser
Left by Kyle Thomas Glasser on Dec 16, 2011 2:17 AM

Your comment:
 (will show your gravatar)


Copyright © Randolpho St. John | Powered by: GeeksWithBlogs.net | Join free