2005 2006 2007 2008 2009 2010 2011 2015 2016 2017 aspnet azure csharp debugging elasticsearch exceptions firefox javascriptajax linux llblgen mongodb powershell projects python security services silverlight training videos wcf wpf xag xhtmlcss

Firefox for ASP.NET 2.0 Developers Video Series

In September I recorded a video series I entitled the Firefox Web Developer Series. I've since renamed it to the Firefox for ASP.NET 2.0 Developers Video Series (clearly because the original title wasn't long enough). I put the project on hold because of the .NET 2.0 course I was teaching, which took almost all my time, but now I'm ready to take the time to get back into videos.

This series is for ASP.NET 2.0 developers who want to enhance their ECMAScript (JavaScript) skills and see how the powerful web development suite known as Firefox as simplify their lives as much as .NET 2.0 Framework does. In the series I use Beta 2 of Visual Web Developer 2005 and Firefox 1.0, but everything should be good for the final version of VWD2005 and for Firefox 1.5.

I will be releasing videos from this series over the next few weeks. For now, here is my introduction.

You can download the first video from the video below. You can download Visual Web Developer 2005 Express and Firefox 1.5 below as well.

trycatch in .NET 2.0 - Note

Here is a comment Joe made about my previous post.

... One additional facet that will probably go (mostly) unnoticed is that you can throw exceptions across assembly boundaries, and the wrapping will occur based on the assembly-level attribute on the assembly whose catch block is being evaluated. This makes interoperability with code that isn't on the wrapping plan, e.g. COBOL or Eiffel, work seamlessly as you would expect.


This comment is rather hidden in how I have my page designed, but I thought it worthy of it's own posting anyhow.

Video 1 (FWD) - "Setting up your Firefox Development Environment"

Finally! Here's the long awaited part 1 of my Firefox for ASP.NET 2.0 Developers Video Series. I will be releasing more parts to the series over the next few weeks.

This video is titled "Setting up your Firefox Development Environment" and contains valuable information on setting up your web development environment for maximizing efficiency. More setup information relating to this video will be mentioned in future videos as the utilities used in future videos of course also require setup.

Furthermore, this video is valuable not only to the professional web developer (as well as the non-professionals who still use tables for layout), but it's also valuable for anyone interested in maximizing their web experience.

Below is the link to part 1 of the Firefox for ASP.NET 2.0 Developers video series. You can download Visual Web Developer 2005 Express and Firefox 1.5 below as well.

Constrainted try with retry mechanism for .NET 2.0

Lately I've been working on building a framework of abstractions and features that I feel are rather missing from my daily life. One of these features is a try/retry. In the past I used gotos and a ton of code to do this...but such extra coding was the nature of .NET 1.x. This is the world of .NET 2.0 and therefore I can take it to the next level! My new ExceptionFramework includes a few items to help me with exceptions and I figured I would share the following bit with the world.

using System;

public static class ExceptionManager
    public static void TryWithRetryConstraints(
        Int32 retryCount,
        Int32 sleepTime,
        ExceptionConstraintCollection constraints,
        ExceptionTryBlock tryBlock,
        ExceptionCatchBlock catchBlock) {
        Int32 n = 0;
        try {
            tryBlock.DynamicInvoke( );
        catch (Exception ex) {
            if (++n < retryCount) {
                foreach (Object constraint in constraints) {
                    if (constraint is Type) {
                        Boolean isException = false;
                        if (((Type)constraint).Name == "Exception") {
                            isException = true;

                        Type parent = ((Type)constraint).BaseType;
                        while (!isException && parent.Name != "Object") {
                            if (parent.Name == "Exception") {
                                isException = true;
                            parent = parent.BaseType;
                        if (isException) {
                            Exception thrownException = ex;
                            while (thrownException != null) {
                                if (thrownException.GetType( ).ToString( ) == constraint.ToString( )) {
                                    goto retry;

                                thrownException = thrownException.InnerException;
                    else if (constraint is String) {
                        if (ex.Message.Contains((String)constraint)) {
                            goto retry;
            else {

Here are some of the support items...

public delegate void ExceptionTryBlock( );
public delegate void ExceptionCatchBlock(Exception ex);

public class ExceptionConstraintCollection : Collection<object>
    public ExceptionConstraintCollection( ) {
        // Always declare default constructors!

    public ExceptionConstraintCollection(params object[] constraintSet) {
        for (int n = 0; n < constraintSet.Length; n++) {

This version allows me to retry only for certain types of failures. There is a simplified version which doesn't take the constraints, but this is one is a bit more useful for my scenarios (I actually think it's a good idea to always constrain it!) I found that the times I wanted to retry involved cases where I either wanted to retry based on a certain type of exception type or based on some text in the string.

Here's is how I use this version of the try/retry in one of my WPF applications. This is my little way of testing my laptop's RAM speed (as well as the CLR speed). I would grab 1GB of ram, free it, and quickly try to get it again (won't work). The below try/retry helps me get a feel or how fast .NET 2.0 can free up the memory and get it again (sometimes it CAN get the 1GB back).

First, I set up the constraints collection which holds the types and strings to which retries will be constrained to. This could of course be inline with the primary call.

ExceptionConstraintCollection constraints = new ExceptionConstraintCollection(

Here is the actual call to the try/retry. I tell the try/retry manager how many times to retry (6), how many milliseconds to wait between each try (1000), what constraints to put on the try/retry (the above constraints collection), the logic to run as the try block (a delegate; anonymous in this case), and the code to run as the catch block (also a delegate; also anonymous in this case) and then let it do all the work for me.

ExceptionManager.TryWithRetryConstraints(6, 1000, constraints,
    delegate {
        group = new MemoryGroup();
    delegate(Exception ex) {
        ExceptionManager.Report("Unable to allocate memory group.", ex);

Now there are some obvious issues with this. The first: speed. Well, that's the nature of abstraction. You get ease of use and simplicity to life, but it costs a bit. The second is...this just seem weird, doesn't it? It just seems like there's a whole new bag of issues associated with this. Actually, this doesn't really bother me either. I'm keeping my code small enough so that I don't break the Ritcher anonymous delegate rule (never more than 3 lines of code in an anonymous block including comments) and I'm keeping in my mind that top level exceptions will really have the text of "Exception has been thrown by the target of an invocation." (which is, of course, true, but this means I better not be doing this stuff straight with COM interop!) As long as I keep that last one in mind I should be fine.

In any case, this has really been helping me out and have been proving to be a very powerful solution to the lack of a try/retry in the CLR.

Video 2 (FWD) - "Introduction to the Firefox JavaScript Console"

Firefox comes with many incredible utilities right out of the box. One of these tools is the JavaScript console. Most developers who have done any web development at all utilizing Firefox has used this great tool, but few know of some of the more powerful features. In this video I touch lightly on a few features that you may have overlooked.

In the next video we will dive hard core into some code to see the Firefox Web Development suite in action.