Welcome to Windows Communication Foundation (WCF)
Top Tasks :

WCF Community Bloggers

Friday, June 01, 2007 - Posts

  • WCF NetDataContractSerializer and SecurityException

    The WCF NetDataContractSerializer is an almost, but not quite perfect, replacement for the BinaryFormatter. The NDCS is very important, because without it WCF could never be viewed as a logical upgrade path for either Remoting or Enterprise Services users. Both Remoting and Enterprise Services use the BinaryFormatter to serialize objects and data for movement across AppDomain, process or network boundaries. Very clearly, since WCF is the upgrade path for these core technologies, it had to include a serialization technology that was functionally equivalent to the BinaryFormatter, and that is the NDCS. The NDCS is very cool, because it honors both the Serializable model and the DataContract model, and even allows you to mix them within a single object graph. Unfortunately I have run into a serious issue, where the NDCS is not able to serialize the System.Security.SecurityException type, while the BinaryFormatter has no issue with it. The issue shows up in CSLA in the data portal, because it is quite possible for the server to throw a SecurityException. You'd like to get that detail back on the client so you can tell the user why the server call failed, but instead you get a "connection unexpectedly closed" exception instead. The reason is that WCF itself blew up when trying to serialize the SecurityException to return it to the client. So rather than getting any meaningful result, the client gets this vague and nearly useless exception instead. By the way, if you want to see the failure, just run this code: Dim buffer As New System.IO.MemoryStream Dim formatter As New System.Runtime.Serialization.NetDataContractSerializer Dim ex As New System.Security.SecurityException("a test") formatter.Serialize(buffer, ex) And if you want to see it not fail run this code: Dim buffer As New System.IO.MemoryStream Dim formatter As New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter Dim ex As New System.Security.SecurityException("a test") formatter.Serialize(buffer, ex) I've been doing a lot of work with the NDCS over the past several months. And this is the first time I've encountered a single case where NDCS didn't mirror the behavior of the BinaryFormatter - which is why I do think this is a WCF bug. Now just to get it acknowledged by someone at Microsoft so it can hopefully get fixed in the future... The immediate issue I face is that I'm not entirely sure how to resolve this issue in the data portal. One (somewhat ugly) solution is to catch all exceptions Read More...
  • Open Positions

    There are a few positions open in my group. My manager (James Conard) has posted some info here . These positions are related to technologies on the near horizon, but there is sure to be quite a bit of new technologies to follow. I am a newbie to Microsoft, Read More...
  • More on the Ruby .NET thing

    A fellow Magenicon has also blogged in response to Fowler's comments about the .NET world. For more information go to www.lhotka.net . Read More...
  • Strangeloop

    Strangeloop is one of the coolest products I've seen (not as cool as Surface, but that's hard to top :) ). This product is an ASP.NET-aware device that does intelligent caching for web sites. It can do things that seem virtually impossible - it is that cool! Here's Richard Campbell's blog entry with more background. If you have the need for a nearly transparent boost in performance for your ASP.NET web site, Strangeloop is something you should look at! For more information go to www.lhotka.net . Read More...
  • BizTalk RFID Training

    In case you missed Jon's announcement yesterday , we are excited to announce our new Applied BizTalk RFID training course (3 days). BizTalk RFID is a new technology offering from Microsoft that is being packaged under the "BizTalk" umbrella brand, but doesn't actually require BizTalk Server in any way (you can use it standalone). However, when you purchase BizTalk Server 2006 R2 , you'll also get a license to BizTalk RFID. Jon is at the helm of this one and as a result, it will be outstanding training. We'll be scheduling some open enrollments for later this fall, but if you're interested in an onsite, let us know . Read More...
  • Using Google Offline: Google Gears

    I've been waiting for this to happen, and it's finally here: Google Gears . Simply install Google Gears and then you can start using Google Reader through the same Web interface but against a local relational database. Once you have Gears installed, you'll see an "offline" button (green down arrow) in the upper-right-hand link menu. When you click the button, Gears downloads all of your feeds to the local database and while it's doing it you'll see something like this: Once it's down synchronizing, you can disconnect from the network and read your feeds on the airplane like you've wanted to. Right now, Google Reader is the only app that currently supports Gears but I expect that to change soon. I hear GMail, Google Calendar, and Google Docs will all support the same offline mechanism soon. Read More...

Copyright © 2006 Microsoft Corporation. All Rights Reserved. | Terms of Use | Privacy Statement | Contact Us