September 2006 Entries

.NET: Re-throwing exceptions without amnesia

A discussion on the asp.net newsgroup the other day made me realize that our C# guidelines needs an addition. The topic was "Bubbling exception", and the question (originally in VB.NET, but translated here to C#) was: When bubbling some exception up to some interface handlers, what is most recommandable: try { // Do something } catch ( Exception ) { // Do something throw; } or: try { // Do something } catch ( Exception ex ) { // Do something throw ex; } I realized that some programmers don't know ......

Malaysia and Singapore pictures clean-up (ASP.NET PhotoAlbum)

I cleaned up and reposted the Malaysia and Singapore pictures from this summer. Before that I had to correct a few small bugs in my RealSimpleBlog custom control, which is now in version V0.2.2. It's a work in progress, which eventually will allow the user to place a blog-like content on any webpage he wants. Most existing systems nowadays are fullblown blog applications, and are more difficult to integrate smoothly in existing websites. The pictures page display the pictures interpersed with the ......

Sandbox exceptions in XBAP: When are they really thrown?

Many features of WPF are not yet implemented for XBAP applications. For example, opening new windows is not possible when the WPF application runs in the browser host. Also, crossbow (integrating Windows Forms controls in WPF applications) fails when the WPF application runs as XBAP. When such sandbox-forbidden operations are executed, a security exception is thrown. Depending on the permission which is not granted, the type of the exception is different, but the mechanism is always the same. When ......

Crossbow: Integrating Windows Forms controls in XBAP applications fails

Crossbow is the technology (code name) allowing to integrate Windows Forms controls into a WPF application. Mainly, it consists of a control named WindowsFormsHost, which is part of the namespace System.Windows.Forms.Integr... and distributed in the assembly WindowsFormsIntegration.dll. This DLL can be found in Visual Studio 2005, and is also part of the WPF SDK, under Program Files\Reference Assemblies\Microsoft\Framew... (stand June CTP, I didn't check in August CTP if it's still the same). ......

Using C# generics to extract enumerated flags from a numeric value

I posted a new page on my site, demonstrating how to use generics to extract enumerated flag values from an integer value in a generic way. I wrote this utility class, because I wanted a way to execute actions on the server using a URL query parameter sent from the client. Until now, when I wanted to execute an action, I was using a URL like: http://www.galasoft-lb.ch/m... Then I was mapping the value 3 to an enum value, and would execute the corresponding action before rendering ......

Technical blogs and newsgroups I read

A colleague asked me what blogs I read, and I thought it would be interesting to blog about that ;-) My main activities in programming in the moment are .NET, especially ASP.NET, and WPF. ASP.NET also includes a lot of JavaScript programming, which was always one of my favourite subjects anyway. About JavaScript, I don't read blogs, but I can recommend the newsgroup comp.lang.javascript. I learned most of my JavaScript there over the years, and though the tone is sometimes passionate over what may ......

Converting a ASP.NET 2.0 Website to a Web Application Project

Version 1.12 of my PhotoAlbum web application was built using the "New website" menu in Visual Studio 2005. This creates a website project, which I was curious to try, as I didn't have any experience with it. I come from ASP.NET 1.1, where the model is very different. For example, you precompile the website before deploying it (in ASP.NET 2.0, it's not compulsory; you can deploy the ASPX files together with the CS files and it is compiled on demand). Also, in ASP.NET 1.1, you have total control on ......

GalaSoftLb.Web.PhotoAlbum: V1.13 planning

I published V1.12 of the PhotoAlbum web application last week. Now is time for some planning, and preparing the next version. Since the PhotoAlbum uses other controls and utilities, I will coordinate all the versions and release them together with the PhotoAlbum's next version. The next PhotoAlbum release will be V1.13. I think that the one after that will be labeled V2, because most of the old code and the old structures will have been replaced by then. However it's not 100% sure yet. Together with ......

PhotoAlbum V1.12

I just published an important step towards V2 of my PhotoAlbum. Compared to the version I published on the 29th of August, there are no big functionality changes, except that it's now possible to add legends to the rotating headers on top of the main page, and to cycle through them using a "Next header" link. I will pack the code and make a custom control with it, to make it easier to add to a page (not that it's difficult now anyway). However, I made very big changes to the folder structure in the ......