Phantom Properties

Yet one more interesting Web Service problem reared its head today.  The situation is as follows:

The result of a call to a Web Service method is supposed to be a class. The class contains the elements that, basically, make up a record in a database table.  Because of the way that we structure data access, our data access class returns a DataSet with a matching xsd file.  Once the xsd file had been created, the xsd.exe tool was used to create the class definition.  An instance of the class was then hydrated using the XML format of the DataSet and returned through the web service.

(just for the curious amongst you, our reason for not returning the DataSet itself is that the client is an older version of WebSphere and they don't have easy support for processing returning DataSets.)

Key point coming:  the minOccurs value on at least some of the data elements in the xsd was set to 0.  As a result, for some of the data types (specifically integers, int16 and bytes), additional properties were created.  For example, if there were a property called Status, a public boolean property called StatusSpecified would also be created. 

No problem to this point.  A web method is created with a return value of the class that was generated by xsd.  The method is called and *bam* (picture Emeril at this point), an error gets generated.  The error is the following:

Server was unable to process request. File or assembly name q2k5rmkd.dll, or one of its dependencies, was not found.

The experienced among you will recognize this as a error that occurs when the ASP.NET user doesn't have access to the temporary directory.  But that was not the case here. It is also an error that gets returned when one of the classes used in a web service message has a ReadOnly property.  But a review of the returned class shows that this is not the case either. 

As it turns out, the problem is that the Specified properties (such as StatusSpecified) conflicts with an automatically generated property called, coincidentally, StatusSpecified.  This automatic property is generated when the result set contains a minOccurs clause.  It is used with numeric values to identify those properties that have not been assigned.  It is necessary because numeric variables don't have a 'null' value. But the conflict between the autogen'ed properties and the properties that are created by xsd causes the error message seen above.  The easiest solution is to change the name of the properties included in the xsd.exe generated class to have a name that does not have 'Specified' as the suffix.

Food at PDC

I can't go all week without mentioning the food, here. I took a couple of pictures to get the point across. Check out my pictures. it will help you visualize.

I took a picture of the lunch and breakfast hall. I got as much in as I could with my camera. Imagine seating 8000 for lunch. It's quit amazing to watch, the staff here at the conference centre are great.

All around the conference centre there are tables full of food. There are two pictures of these also. They are always full of muffins, bagels, chips, chocolate bars, granola bars and fruit. There must be 10 of them set up. Next to these are giant coffee urns and barrels full of pop juice and water.

No one is going hungry here!

C# now there's a language

Did I mention msbuild? Microsoft is writing their own NANT. It's XML and everything.

Yesterday was a C# day for me.

I tried to get into Anders Hejlsberg's session on the new features in C#.

  • Generics
  • Iterators
  • Anonymous methods
  • Partial types
  • Property accessors with different accessibility

But it was full. Even the TV outside the room had no space around it. They sometimes re-run popular sessions. Fingers Crossed.

I did however get into a good session called Visual C# "Whidbey" IDE enhancements for the C# developer

Found some things in there to look forward to.

Debugging is easier with regard to DataSets. In Whidbey you can adjust what you want to see in the debugger. You can tell VS what you consider your code and therefore want exposed in the debugger. You can also click on a drop down and see a DataSet Visualizer, which is essentially a list box of DataTables and a grid for the DataRows and DataColumns. It's like a trimmed down version of Barry's DataSet Debugger. In the build I saw, it’s not as good as Barry’s but maybe it will get better.

Here's one Andre will like. They have included IDE support for refactoring code.

Rename - You can rename a method and have it change solution wide.
Extract Method - If you wrote a large method and later decide it would be better split into multiple methods. You can highlight a section of code and select [extract method]. Whidbey will prompt you for a method name. It will figure out what arguments you need the scope and what it returns.
Some others include:

  • Extract Interface
  • Encapsulate Field
  • Reorder parameters
  • Remove Parameters
  • Add Parameters

Expansions are cool too:
You know in VB .net how you type in a property and it fills in the get and set etc. VB had to do this because it's so verbose no one would use it otherwise. :)

Whidbey has something else cool called expansions (C# has it for sure. I have not confirmed VB). Using XML you can define an expansion, which shows up in IntelliSense. Lets say you wanted to create a property expansion. You could type in prop and it could fill in the following. the cursor would be placed on string ready for you to change. You can just tab through the fields (in yellow) to change the names.

private string name;

public string Name {

get { return name;}

set { name = value;} }

That's enough for now. I have to get to another session.

We are going to Universal Studios today whoohoo!

Tonight is universal studios night. Microsoft rented the park for us for a few hours. I can't wait. Shrek 4D here I come.

The network at the hotel sucks. Couldn't get on last night for any longer than a minute or two. We were supposed to be in a web cast with Microsoft today but couldn't get a spot quiet enough with a stable network to do it.

Got an email from Roman this morning. Thanks Roman. Seems the dart team lost last night. Hard luck guys. I was thinking about you.

Right now I'm in a session for the tester in me. “Avalon” UI Automation to improve application testing. It's just starting so I'll be right back.

 

Longhorn, Avalon and XAML oh my.

Yesterday I spent all my time at Longhorn presentations....for the most part. I got a chance to look a close look at XAML.

XAML does for smart client windows forms apps what aspx/HTML does to web apps: separates the UI from the rest of your app. In the wake of infopath, I've told more than one person that I didn't think traditional developers would be coding user interface 5 years from now. XAML makes it a lot easier for that to become true.

But XAML is more. Sure you can mark up your form with XML. But it can be compiled into BAML. Binary XAML. You don't have to use XAML to code up your forms, you can still use the current Windows Forms designer than puts your controls into .NET Code in the “Designer Generated Code” region of your form class. Both techniques get compiled and are the performance equivalents. That's cool. You can further compile (or is it link?) BAML into assemblies.

XAML has 2 (or 3) rendering modes. Fixed Format is like windows forms now. Also like Grid Layout in ASP.NET. You scroll around and stretch stuff - but nothing moves. Flow Format is more like traditional flowing HTML. You resize your browser and stuff changes. The rendering agent takes care of paging so the # of pages changes automagically as you resize. You can even click on the scroll bar to get thumbnail views of the next pages in the whole document.

Adaptive Flow is cool. Imagine a 16:9 wide screen and you resize your document to be full screen. It's tough to read a line that long. They've though of everything. When a line becomes too long to read, the rendering engine flips to the display to 2 columns like a newspaper or DTP style document. Makes it so nice and you can see it happen quickly as you resize a form - bam - two columns.

XAML makes skinning pretty easy. In fact in the “Being a good Windows Citizen” presentation, the Windows User Experience team talked about a technique for designing your UI that MS uses and recommends that we all do it. Create 2 or 3 fictional users for your application whose profiles are based on real or anecdotal evidence. Give them names. Give them photos. When you need to make a decision about how your UI should look or the app should work - ask yourself: How would Toby like this screen? How about Jeff? Ms has 8 fictional people that encompasses the full spectrum of their core windows & office products. Skinning your app is sometimes the only way to create a UI that will satisfy everybody - give them each their own. Not only is this possible with XAML, it can be done after the initial compile of your application and you can deploy BAML after initial release much like localized satellite assemblies. Way cool - so long as you design for this from the get go.

Another cool thing about longhorn is that the UI is all vector based. So you can do things like rotate your buttons and text boxes etc. Pretty cool, not very useful. Being able to zoom in on a part of your text though and still have a pretty (not aliased) image is wonderful. It demonstrates the power of the new graphics subsystem and the dependency on graphics cards in Longhorn. It's fast. The new graphics subsystem is rebuilt from the ground up to provide very fast. It needs to. Resolutions are getting bigger and bigger, and being able to scale a traditional UI to make it bigger is important given the predicted growth of screen sizes. It seems like more of a bell or whistle at this point, but it's going to totally change the user experience.

Data binding is now built into the OS. You can bind to files on your WinFs hard drive. A file can have meta data defined by a schema and any of that information is fair game to be bound into your apps. More to come on this. It's just too far out for me to “make it real” at this point. Data binding is one of those things you just have to get into when you need it. But it looks good.

I thought it was kind of goofy that during the key  note, all developer demos  for Longhorn and Avalon were done with Emacs, Slickedit and VIM. Then I realized they had to be. There is no Visual Studio for Avalon yet. You can still get VS.NET any version to edit the class files, but it's no full developer experience for Longhorn/Avalon. There is no WYSIWYG XAML editor yet.

Get ready to design your screens in FrontPage - Ahhhhh!

Interoperating with WebSphere

I just had the joy of spending a day trying to get my .NET Web Service to interact with a WebSphere client.  Regardless of the changes made, the following error was received on the Java side.

Unable to retrieve PropertyDescriptor for property Xxx

All of the property names matched up.  All of the properties in the Java class had getters and setters. The ultimate solution?  Change the case of the property names.  The problem only occurred if the property name started with a capital letter.  If changed to a camel case format, the problem goes away.  Apparently, this is a problem with the standard BeanSerializer in older versions of WebSphere (version 5.0 and earlier).  According to the notes that I found, it has been corrected at 5.1 and in a patch to 5.0.  Can't vouch for this, as we just swallowed hard and changed the case of our exposed properties.  I hate case sensitivity.

Tuesday Morning at PDC

Good Morning...

Barry said it best, “I woke up this morning needing a nap”.

Had trouble installing Longhorn last night, couldn't get the key from the web site. Barry got his so I can install it later on.

Just had breakfast with Joe Futty, Yeah he's here, he's doing well. It’s good to see him.

Waiting for the general session to start, I forgot my camera this morning. I have to remember to take a picture of the never ending dinning hall. Who is cooking all this food?

I want to try and talk to Paul from the Whidbey presentation yesterday. I'd like to get on the Whidbey Alpha. We need a newer build than the one they gave us. We want to hold a session in December to show clients some of the stuff we've seen this week. I think I'll go to ask the experts tonight. He should be there.

Barry was schmoozing with the infragistics guys last night at the trade show. They don't have anyone who does training for them. Matt? Barry said maybe we could do that for them. ComponentOne was four booths over. :)

For other attendees: Have you been to PDCVIBE and downloaded the PDC Vibe tool. It's pretty nice. Shows all the sessions, lets you filter them. Give feedback on PDC. Download slides. It's very nice.

Almost time for the general session, I better run.

Good turnout to VS.NET tricks bof

I was totally impressed with the 200 or so people turn out at our VS.NET Tips & Tricks bof. More than one bof organizer was a bit concerned about us bringing a projector - but I don't know how you'd fully appreciate some tips without getting to see them on the screen. It worked well. The O# posse showed up with enough tips to fill the 60 minutes, but we didn't really get to use many of them. The crowd involvement was terrific. At one point, I had to tell people to keep it down because the banter was running wild. This is a good problem. This might have been better done as a VS.NET Tips Cocktail Reception, maybe next year.

My favourite tip? Well it's a tip and a best practice from Dave Lloyd. During and after a build, the output window is kind of important, but VS.NET immediately hides it by default with the Tasks window. We tend to look at the first task to see what caused a failed build but it isn't often the right one. You really need to look at the build output, and you really need it to be bigger than a typical docked window. I'm forever resizing that thing up during a build post-mortem - and back down when I'm done. Right click on the output window title bar and uncheck Dockable. Presto! The output window is now in your editor space as another tab. Beautiful.

Whidbey is looking good

Yet another long day, I feel like I have been at this conference for a week already, I'm exhausted.

At this moment I am installing Longhorn on one of the extra laptops we brought for just such an occasion. I hope they don't monitor hydro usage per room because between the wireless router, 2 phones, 3 IPAQ's, and 4 laptops plugged in we must be over our quota.

After I install Longhorn, I'll be installing Whidbey. For those who don't know, Whidbey is the code name for the next release of Visual Studio. I'm a software developer and have been for 20 years. So when presenters are on stage using old editors and compiling on the command line. I'm with them and sometimes feel a little nostalgic. As much as I once loved K-edit I wouldn't trade Visual Studio .net for it now. Like any software VS.net has it's problems. But the development teams at Microsoft have done a wonderful job addressing a lot of the issues. Assuming they deliver what I saw today.

So what did I see today?

  • I saw tools to make interactive development easier. Like smart tags. You can drop a control on a form then right click and make it something else. Maybe it was a textbox at first but them you decide to make it a date time picker. Just right click select DateTimePicker and you’re done.
  • Ever want to try something by coding it? As a result you end up with WindowsApplication1, WindowsApplication2, WindowsApplication3 ... on your machine. Whidbey works like word, your project is not saved until you save it. So you could create a project write some code compile it and run. Then exit without saving and discard the whole thing. (Honest that's what he said.)
  • I saw Paul Yuknewicz create an employee.user.vb. What's that you say? Well it's what Microsoft refers to as a partial class. You can have a class split across multiple files and they will be compiled into one. So the file employee.user.vb goes with employee.vb which goes with employee.xsd. You guessed it. It's an extension of a Typed DataSet. :)
  • The new snap lines for aligning controls are wonderful. If you are adding multiple labels and controls just drag one near another and it shows you lines to tell when it's lined up with the other controls and the labels. It's hard to explain how nice it looks. I'll be happy to demo it when I get back.
  • There is this thing called a DataSource Picker. To bind a control you can simply drag from you DataSource to the control and it binds it.
  • There is this new control called a DataContainer, all I can say is PowerSoft DataWindow. (I'll save the comparison for another Blog)
  • There are some enhancements to the XML editor. Nothing else to see here move along.
  • Actually one really note worthy XML addition. You can set breakpoints in an XSLT file and debug it.
  • Oh yeah I remember this is nice. When you add a datasource to DataBinding in the property window. You can grab the editor and stretch it out to see everything. It's really nice

Enough about Whidbey for now.

The exhibition hall was cooking tonight, must have been the free drinks. We stopped into a few booths, chatted with some folks, did a little shopping in the Microsoft Store. Can't tell you what I bought. My Daughters have been reading along, and it's for them.

It's time to unwind and relax, another long day tomorrow at PDC.

General Session at PDC

So I sit here eating my Chinese food for lunch. Barry went to a session. He's a trooper. I'm thinking about the cool things I saw in the general session. I'm new to blogging and I am not going to try and dump everything I saw here in one entry. I'll leave that to the more serious bloggers and writers out there.

However I will tell you a little about the general session.

  • No bathroom breaks
  • 8000 or so people, watching at least 16 giant screens.
  • Check out the pictures. It was pretty cool just from a logistics point of view.

Some demo highlights while I sip the last of my ice tea here:

  1. XAML (pronounced Zamil) is a new buzz word. From what I can gather it's code behind for windows and web. If you have been trying to peg yourself as a windows or web developer stop, it won't matter soon. XAML is an XML language that lets you write your user interface.
  2. Doing cool graphics is easy. Or at least Don Box and Chris Anderson made it look easy.
  3. Very cool demo by Amazon.com. If you get a chance check out the carousel control, Very cool. If anyone knows where you can see a sample of it let me know.
  4. Another cool demo was paging up and down in a document. If you click on the scroll bar a thumbnail appears that shows you where that is in the document. In the demo that particular section of the document had a video playing. It played in the thumbnail too. :)

There was a lot more and a lot more important that these for example the new file system is very exciting. But I have session in a few minutes and I have to find it. I'll try and get on again later today.