Monday 17 December 2007

File size limitation problem with XslCompiledTransform

I recently ran into a problem with a reporting feature on a product we're building and was very close to release. The report was being generated by a IHttpHandler in the ASP.NET 2.0 site that would transform an XML data document to RTF using an XSLT transform. We had around 20 reports that were working fine and generating without any problems. One XSLT transform was causing some major problems that even lead to crashing the application pool in IIS 6.0 when it was running.

The handler that was supposed to be returning the report as an attachment in the request was displaying a 'Page cannot be displayed' and the System event log had warnings logged whenever this happened:-

A process serving application pool 'DefaultAppPool' suffered a fatal communication error with the World Wide Web Publishing Service. The process id was '6244'. The data field contains the error number.
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
0000: 8007006d
We couldn't recreate the problem locally in Visual Studio web development server, it only seemed to be for this one report when running in Windows 2003 and IIS 6.0.

The Xslt engine being used was the standard XslCompiledTransform class in the .NET framework, the previous implementation of Xslt transforms XslTransform had been marked as obsolete - so all during development the team was working with XslCompiledTransform. The only difference we could see with the broken report and the working ones (after a while of checking and double checking other probable causes) was that the Xsl file for that report was larger (~480Kb).

The migration guide in MSDN makes no mention of there being a file size limitation when using XslCompileTransform, but we were able to find this forum post that explains the issue we were having. The problem is due to the JIT compiler for Xslt transformation running out space for declaring locals during IL compilation. The suggestion is to split the XSL into smaller transforms, but we took an alternate route and switched back to using XslTransform in the code. The older class handles the large report transformation - it might obsolete, but it works!

Building reports like this way isn't the most elegant solution, but we hit this problem late in the development cycle that it was far too late to consider switching to a different method. It's a little disappointing that MS aren't more explicit about that limitation in the migration guide.

Thursday 5 April 2007

Testing ASP.NET SOAP Web Services

I've been developing some ASP.NET SOAP services for exposing some application logic to an associated application being developed by a colleague using Flash and Flash Media Server.

To test the SOAP calls before deploying the services ready to be consumed by Flash, I needed to test the output from the services under certain conditions.

When running the ASP.NET site from Visual Studio 2005, you can invoke the SOAP call from the browser. This is fine for testing service operations that don't take any parameters, or parameters that primitive types (like strings and integers). If the operation takes a complex type like an instance of a class you've written or complex .NET type like System.Guid - they you can't invoke them this way.

You could write a consumer application for web methods that can't be executed from the browser, but that means there's more code to write - and I'd rather see the service working outside of .NET to assure me that it will do the job for the Flash and Flash Comms Server parts of the application.

soapUI is a free and open source java based SOAP tester that allows you to prod and poke a web service with relative ease. Its available as a standalone java app, or as a plug-in to popular tools like Eclipse. I downloaded and installed the java installer from soapUI SourceForge Project.

To test the service you just need to point soapUI to the WSDL description for the service you want to test. ASP.NET generates that document for you so the URL looks something like http://myServer/myService.asmx?wsdl. soapUI then uses the WSDL to give you a template for a SOAP request where you can fill in the data values you want to test with.






After that's done, hit the Submit option and the response from the service is displayed in the right hand pane. It's complete with the SOAP headers and the data that's been returned. If there's an exception thrown by the service call, then the exception will be displayed instead.









Later on I'll need to set up some unit tests and regression tests for the services, but soapUI is a great tool for doing the ad-hoc testing I need at the moment.

Wednesday 28 March 2007

Wiki Log book

Last week I downloaded and setup MediaWiki on my local development machine. As the MediaWiki site will tell you it runs using PHP extensions for IIS and is powered by MySQL database - both tools that can run along side my .NET development environment without causing conflict. My original reason for downloading and installing it was to evaluate how hard it would be to deploy / adapt for one of our clients that might require a Wiki site later in the year. I have, however, found having a Wiki running locally to be a valuable tool while I develop.

One of the core challenges of software development has always been keeping useful and current documentation. It always seems to be one of the first parts of a project that is dropped when a deadline gets tight, if was even included in the first place. With the Wiki running, I can keep it open as I write code so that I can add to my high level documentation as I'm going. Writing documentation as you go is bound to make it more accurate and useful to other developers that might have to pick up your work.

My advice... throw away all those scraps of paper on your desk, and even that notebook (if its like mine it hasn't been touched for a few weeks anyway - who uses pens these days?) .. And install MediaWiki today!

Tuesday 6 February 2007

CasperXP for cloning disk

I've come across a good tool for backing up bootable hard disks - CasperXP [http://www.fssdev.com/products/casperxp/] will create an exact clone of a hard disk partition to another partition of the same size, including boot sectors. What that means is that if your main hard disk partition fails or corrupts then you change the bootable disk in the BIOS, and away you go working with a recent clone of your OS and programs. It costs $50 at my last check, and is worth the price tag if it saves a days work of rebuilding my system.

This could all be achieved by using a RAID array of disks with one of the parity of clone RAID setups. That though would be expensive and wouldn't work on a partition to partition basis like CasperXP does.

Thursday 18 January 2007

WPF/E ... Adobe vs Microsoft?

Microsoft Channel 9 have posted a video interview with Scott Gu where they run through using WPF/E and AJAX, IIS 7.0 and a couple of the other emerging technologies from Microsoft.

Looking through the WPF/E documentation and reading the general buzz about it, first question that entered my head (and it was always going to be). What does WPF/E stand for? WPF is a product that's been bounded around during the development of Vista (previously codenamed "Avalon" I think) and stands for Windows Presentation Foundation ... but where has this new E come from? Apparently it stands for "Everywhere", Microsoft developing something truly cross platform? Surely Not!

I downloaded the CTP release of the WPF/E; Looking through some of the online demos on Mike Harsh's Blog, I couldn't really see anything new to the user experience that wasn't possible using Adobe (formally Macromedia) products like Flash. I think however most of the benefits from using WPF/E will come from the portability of code because it uses XAML, and its integration with AJAX for doing data post backs to webserivces.

WPF is the new UI layer that ships in Vista and is driven by XAML (an XML format for describing user interface designs). XAML itself is a good move away from having to, in code, declare controls and their layout, look and design. It effectively provides that layer of abstraction of UI from UI functionality, like we've been used to with ASP.NET over the last few years.

Recently its becoming clear that Microsoft are Adobe are going head to head in some of their developing product lines for delivering cross platform rich user interfaces over the web.

The WPF/E technology is certainly comparable to Flash Player, or Adobe Flex. That's made a little more evident by there being a tool swfToXAML for converting Flash movies to XAML markup.

Not available in this version of the WPF/E CTP, Scott Gu says that the final release will have better video support, with things like live streaming for things like conferencing. I'm yet to develop anything meaningful in either WPF/E or Flex, but I'm keen to see what benefits / advantages of using them practically.

Tuesday 16 January 2007

SVN and Trac

Since Vista has put an end to me using the Cisco VPN for now, I can't get access to Source Safe in the office for checking source code in and out from my main development machine.

The project I'm working on at the moment does really need checking into the master source safe database for now until I've finished working on it - so it's given me an opportunity to try out some other source control systems.

Dave Griffiths [http://www.davegriffiths.net/] put me onto a system called Trac which gives a web interface for SVN repositories. I signed up for a developer account on www.svnrepository.com, it costs just under $4 for 500Mb of SVN storage, and they run Trac.

To access the repository from my development machine, I've downloaded TortoiseSVN [http://tortoisesvn.tigris.org/] client for windows that allows access to my SVN db from Windows Explorer.

So far I'm impressed with this setup. SVN doesn't need a lock to be gotten (though you could if it was needed) on the file before it can be worked on, and the merging functions are good from what I've seen. Trac also has bug tracking, Wiki, Timeline and Roadmap functionality. I'll be branching out into using these in the next couple of days.

I think SVN works with code generation, code sets are a better way working than labelling. I'm going to try to figure out a way that all this can work that makes sense - Code Generation / Database Deployment / Build Server / Source Control.

Watch this space!

Saturday 13 January 2007

Vista So Far...

I've been using Vista Bussiness for a few days now, so I'd thought I'd report my findings so far.

The postives...

I'm enjoying using Vista so far. It looks better (though I know the novelty will wear off soon enough) and the side bar is great when you get some RSS feeds in there.

I'm using a dual monitor setup, and one of the things that used to annoy me in XP was that videos would stop playing when you moved them from screen to screen in PowerDVD or media player, Vista seems to have it sorted. I think they must have improved dramatically the way the videos are rendered because they even play when your cycling through applications using Alt+Tab and in the little window previews you get when hovering over something in the start bar, something that wasn't possible in XP.

The negatives...

To connect into the office I downloaded and installed the Cisco VPN client beta version for vista from http://vpnclient.clearchannel.com/. I haven't been able to get it running, its not a problem with the networks at either end it worked before using the same hardware and XP on my machine. When the VPN client tries to connect, it site there for a while and then returns the message "The remote peer is no longer responding". I've heard reports of other people using the Vista Cisco VPN client without problems on Vista, so looks like I need to have a dig around to find the fault.

I'm also running VMware to host a couple of virtual images of Windows XP on my machine, the only problem I've had running it in Vista so far has been using the clients with "Bridged Network" mode. When I bring up the Network Settings in the VMware manager, the OK button was disabled. That turned out to be a problem with security in Vista - I got round it my adding the _vmware_ user to the adminsitrators group in Computer Mangement, and running the VMware manager as administrator. When the virtual machine boots up, it just reports the Vmware network connection has limited connectivity. Could be a problem with DCHP and the service that VMware creates to give the Virtual Machines IPs. However, I can still get online using machines in NAT mode, so its not a huge problem for now.

Wednesday 10 January 2007

Taking the vista plunge...

I've just taken the plunge and installed Vista Business on my PC. I do most of my work through VMware virtual machines, so that would reduce the risk of sticking a new operating system on and then not being able to do any work.

After doing triple checks that I'd backed up all my "must have" data, I popped in the install disk that I'd burnt and followed through the install. All in all it was a much painless process than installing XP from fresh (but maybe I'm being blinded by the swish new graphics in the install), and I think it was a little quicker.

The first part that confused me was when I was asked what version I wanted to install. I get a license of Business version through the university so that's what I needed to select. However there was a "BusinessN" version in the list - unsure what it was I avoided it. Reading up on it this morning it sounds like the only difference is the N version ships without Windows Media Player installed - a knock on of the EU legal battle with Microsoft recently I think.

After I had created myself a user account I logged in I was presented with a "Welcome to Vista" screen. The system details listed the system as being a 32-bit intall of Vista, I'd read that there was no separate install disks between 32 and 64 bit version for Vista. My PC's got a AMD 64 X2 4200+, so was hoping that it would have detected it and installed the 64 bit version. I was never asked in the install setup whether I wanted 32 or 64, so maybe my CPU isn't compatable (or marked as compatible in the BIOS)? Something I'm going to look into over the next couple of days.

Had some work to do to get my machine online too. My PC is using a NetGear WG111 54G wireless dongle which has no supported Vista drivers (and as far as I know no plans for Netgear to write any). At the moment I've borrowed my flatmate's WG111v2 and I'm using the Vista Beta driver from Netgear. That dropped in fine after doing a "Have Disk.." driver install through device manager. I've had to put in IPs and DNS server IPs manually, didn't seem to pick them up automatically from the wireless router. Ah well, I can live with that ... it works!

My collegues who had installed Vista had warned that it blocks unsigned drivers from being installed - not something that I've found on my install. Maybe because I'm using Business edition, and I've been doing "Have Disk..." installs for drivers.

My Wacom tablet still needs a bit of work to get it running, looks like Vista ships with drivers for pen tablets which are conflicting with the Wacom drivers. Haven't found a way to set up absolute referencing with the windows ones (where the tablet space maps directly to the screen), so might need to do some turning off and use the Wacome ones exclusively.

That's about it for now - more to come later with my trials and tribulations with Vista (and developing it in)