Lessons Learned

Preserved for Posterity
posts - 8, comments - 24, trackbacks - 0

My Links

News

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

Archives

Post Categories

Links and Stuff

Hidden Surprises in .NET 3.5 Service Pack 1

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.

Print | posted on Thursday, August 21, 2008 10:15 AM | Filed Under [ Miscellanea Lessons Learned ]

Feedback

Gravatar

# re: Hidden Surprises in .NET 3.5 Service Pack 1

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.
8/21/2008 1:38 PM | Paul Wilson
Gravatar

# re: Hidden Surprises in .NET 3.5 Service Pack 1

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.
8/21/2008 1:41 PM | Jason Baginski
Gravatar

# re: Hidden Surprises in .NET 3.5 Service Pack 1

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.
9/11/2008 9:09 AM | John Oswalt
Gravatar

# re: Hidden Surprises in .NET 3.5 Service Pack 1

Excellent, thanks for the workarounds, guys!
9/11/2008 9:15 AM | Randolpho
Gravatar

# re: Hidden Surprises in .NET 3.5 Service Pack 1

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."
9/15/2008 10:54 AM | Martillo
Gravatar

# re: Hidden Surprises in .NET 3.5 Service Pack 1

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?
9/17/2008 2:01 PM | Martillo
Gravatar

# re: Hidden Surprises in .NET 3.5 Service Pack 1

I've posted this as an issue on the ACT Codeplex sie
9/17/2008 2:12 PM | Martillo
Gravatar

# re: Hidden Surprises in .NET 3.5 Service Pack 1

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.
9/23/2008 1:41 PM | Bertrand Le Roy
Gravatar

# re: Hidden Surprises in .NET 3.5 Service Pack 1

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.
10/14/2008 10:41 PM | Martillo
Gravatar

# re: Hidden Surprises in .NET 3.5 Service Pack 1

Sounds like DLL Hell is back! I am struggling with this one as well.
10/23/2008 10:51 AM | Tom van Stiphout
Gravatar

# re: Hidden Surprises in .NET 3.5 Service Pack 1

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.
4/30/2009 1:18 PM | Bob
Gravatar

# re: Hidden Surprises in .NET 3.5 Service Pack 1

@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.
4/30/2009 11:25 PM | Randolpho
Gravatar

# re: Hidden Surprises in .NET 3.5 Service Pack 1

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'”.
6/29/2009 4:21 AM | Mayank

Post Comment

Title  
Name  
Email
Url
Comment   

Powered by: