Do .NET 2.0 SP1 Binaries Fail Without SP1?

Do .net 2.0 service pack 1 compiled binaries fail when ran on machines without that service pack?  Developers automatically get force-fed .net 2.0 sp1 when we install VS 2008, which doesn't sound like it should be a big concern typically.  But what about the next time you compile an existing VS 2005 app and deploy on machines without sp1, which would of course be the case for most non-dev machines right now?  I believe I have found a case where this is indeed happening, at least that's the only explanation I can find so far, and it looks like there are a few others reporting things too -- but the details so far are sketchy at best.

I've got an existing .net 2.0 app (written in C#) that calls a 3rd party web service that has always ran just fine.  I needed to make a couple of small updates to my app which did not change anything related to the calling of this web service at all.  Everything works flawlessly on my development pc, which has service pack 1 for .net 2.0, but fails when deployed on my qa server, which does not have service pack 1.  Here are the exception details:

Error type = System.InvalidOperationException
Error Message: There is an error in XML document (5, 2).
Stacktrace:    at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   at ...


I am able to confirm that the 3rd party does receive my call to this web service, and it is sending the expected response, which I have also confirmed with TcpTrace.  So the problem seems to be that the xml deserialization that is needed to parse the web service response is no longer working the same, and code compiled with sp1 cannot be executed without it.

Can anyone confirm this?  Are there any work-arounds, short of compiling without sp1 or deploying sp1?  By the way, I am in the process of setting up a virtual machine that will just have VS 2005 without sp1 to confirm this if no one else can, and assuming I can confirm this then I'll have to determine if I want to start requiring sp1.

Here's a couple related links, which may or may not be the same problem I'm experiencing:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2668654
http://weblogs.asp.net/grobinson/archive/2008/02/13/net-2-0-sp1-shipped.aspx
http://channel9.msdn.com/ShowPost.aspx?PostID=363583
http://blog.jalil.org/2008/01/27/dep-nxcompat-and-changes-in-net-framework-20-sp1

Published Thursday, February 14, 2008 9:09 AM by PaulWilson

Comments

# re: Do .NET 2.0 SP1 Binaries Fail Without SP1?

Yes, if you use VS2008, you must deploy SP1. Anything else is just working with luck and is unsupported.

Thursday, February 14, 2008 10:45 AM by Daniel Moth

# re: Do .NET 2.0 SP1 Binaries Fail Without SP1?

Just to clarify, I'm using VS 2005, not the multi-targeting feature of VS 2008.  I suspect that's still a mute point, but I just wanted to make sure we're all on the same page.

I think its fair to suspect that if you start using VS 2008 to build your 2.0 apps then you probably are knowingly taking some "risks", while I think most of us would never suspect that just putting VS 2008 on our machines now forces us to update all our deployment machines!

Thursday, February 14, 2008 10:52 AM by PaulWilson

# re: Do .NET 2.0 SP1 Binaries Fail Without SP1?

Good idea, but this is where MS hasn't been very kind in their versioning.  They may have kept v1.0, v1.1, and v2.0 separate, but service packs just update the existing version in place so there is no different "version" to reference.  Then by making v3.0 and now v3.5 simply reference v2.0, instead of being a real complete new version, they made it worse since v3.5 ended up requiring a service pack to be made to both v2.0 and v3.0.

Thursday, February 14, 2008 12:40 PM by PaulWilson

# re: Do .NET 2.0 SP1 Binaries Fail Without SP1?

You can use VS 2008 to develop applications that work with .NET 2.0 or .NET 2.0 SP1.

The only trick with targeting .NET 2.0 directly is that you need to make sure you don't use any API introduced with .NET 2.0 SP1.  Otherwise you'll get an exception when you try to call it with vanilla .NET 2.0 (note: this same issue exists with VS 2003 and .NET 1.1 SP1).

We are looking in the future to enable VS to automatically filter intellisense based on SP target to help people avoid this.  I believe there is a FXCOP rule you can use now as a post build step to check.

Also - if there are behavior changes in an API with an SP (which might be what you are running into above), you can run into problems if your old assumption about the behavior has changed.  In general we really try hard to impact people this way (we have a strict breaking changes policy), but since bug fixes are by definition behavior changes (by fixing the bug you are changing the old behavior) sometimes these effect existing applications.  This is true for both VS 2005 and VS 2008.

Hope this helps,

Scott

Thursday, February 14, 2008 12:45 PM by ScottGu

# re: Do .NET 2.0 SP1 Binaries Fail Without SP1?

Simply compiling in the presence of SP1 won't cause problems.  But, the presence of SP1 means you can use new methods/classes introduced in SP1.  HttpServerUtility.TransferRequest (which only applies to ASP.NET applications), for example, doesn't exist in .NET 2.0 prior to SP1; so there's no way you can use it without installing SP1 on your development computer.  Once you install SP1 and use HttpServerUtility.TransferRequest all your clients must then have SP1 too.

See also www.hanselman.com/.../CatchingRedBitsDifferencesInNET20AndNET20SP1.aspx

Thursday, February 14, 2008 4:21 PM by peter ritchie

# re: Do .NET 2.0 SP1 Binaries Fail Without SP1?

Scott and Peter:  If only things were as simple as we're led to expect.

From my point of view, I've done enough today to prove it does matter!  That's right, I built my virtual machine, with VS 2005 but not SP 1 for .net 2.0, and then I ran the very same Nant script that I do on my dev machine, which gets the source, sets the version info, and compiles it all -- and it worked just fine when I deployed it to my QA environment.  No code differences at all, just different machines compiling it, one with SP 1 and one without.

I'll be the first to admit I haven't proved anything, since my dev machine certainly has other things on it that are also not on my new virtual machine.  But the only 3rd party reference in my projects is log4net, so none of those other things should in principle have any chance of messing up my build, while its hard to argue that since SP 1 clearly does change things that it just might.  And I see just enough from others to feel I'm not alone, including:

philiprieck.com/.../933.aspx

discuss.joelonsoftware.com/default.asp

Thursday, February 14, 2008 7:48 PM by PaulWilson

# re: Do .NET 2.0 SP1 Binaries Fail Without SP1?

That is th only reason i am taking cautions to use vs2008 on my development machine.

I have BI,Devices,and webapplication.

I get to know that vs2008 is not for sql server 2005 related business intellegence solution but for sql server 2008.

Also in vs2008 i can't find option to target a device application to use compact framework 1.0

So there should be some page from microsoft for addressing the possible problems.

Friday, February 15, 2008 1:23 AM by Kamran Shahid