Take a look here to see what it takes to solve my previous challange. It was extremely hard to get it to work in all scenarios, and I am pretty sure that there are additional edge cases that I have not thought of, but for now, all the tests are green. I also have a 100% repreducable (on several machines) VS crashing bug, which is about the fifth that I know of.
I actually started to put MsgBox.Show() in the code, and had a serious JavaScript deja-vu as a result...
There is probably a bug in Dynamic Proxy that causes it to output overrides to methods in such a way that when you reflect over the generated types, you get two methods for each overriden methods, instead of a single overriden method. I looked into it in detail a while ago, and I couldn't figure out how to make it work like I expect it to. The code that it generate is verifable, so this is something that the CLR supports, but I am not quite sure that I understand what the semantics for this is.
So, what does this have to do with Brail? NHibernate makes extensive use of DynamicProxy in order to increase performance and to defer loading, which meant that any application using NHibernate had this issue. Now, Brail is a dynamically typed langauge (well, not really, but that is close enough), which means that it uses Reflection to resolve properties and methods that are called. Because of Dynamic Proxy generated what is basicaly a duplicate method, that failed.
At the basic level, it meant that a call like this:
Would turn into:
(This is actually very far from how it is wokring but again, that is close enough to make sure you understand the problem.) Now, GetProperty("Name") woudl throw an AmbigiousMatchException, since it actually found two properties called "Name", one of the original class, and the second on the proxied class.
Why am I boring you with this? The fix for this was fairly simple, but it involved simply replacing the way Boo (which is what Brail is using) type system with my own. The fast that I could do that with roughly 350 LoC is quite amazing to me. This also means that I can actually preserve the dynamic nature of Brail, but behind the scene generate strongly typed accessors (think Dynamic Methods), which would elevate any concerns about reflection costs.
The code is in the Castle's trunk now, so you can start using it.
So yesterday I sat down to see what I can about the remaining Rhino Mocks bug, when I was suddenly and viciously attacked by a wild beast. After the inital confusion, it turn out that the mad barking and the slavering wasn't, as I concluded at first, an indication that I am edible, but rather that Rose has found a bug in Dynamic Proxy.
It is not often that I turn to a canine for a bit of advise about runtime IL generation, but Rose is something special. Below you can see her concentrating on the part that handle generic method invocations.
And here is me trying to get a fair share of the keyboard, I believe in Pair Programming, but Rose just won't let go of the keyboard. She has a remarkable words per minute count, although her spelling is a bit off at time (but then again, so odes mine).
I don't blame her for the spelling, she is just a puppy, five months old and still growing. She is a Caucasian Shepherd, which means that she is likely to get much bigger (she is about the size of a full grown German Shepherd now).
Well, if you are reading this I have successfully moved to orcs web.
The transfer was fairly smooth, except they don't support MySQL. That wasn't an issue, as a matter of fact, since I am using Cuyahoga, it was a simple matter to change the config and make it work with SQL Server. I was worried about transferring the data, but it looks like MySQL has fairly strongly export capabilities, including into formats that SQL Server can consume.
Beyond that, it was a breeze...
Now I only have to wait for the DNS records to update.
I am posting this because I am extremely annoyed. I moved from my previous host because of reliability issues, I had to do it fairly quickly, so I didn't have time to really ask around and find out the best host. I went to webhosting4life because it was fast to setup, and I believed that they were big enough to be competent.

I do not have a very big site, or a very complex setup, I run two applications, one needing MySQL, the other needing SQL Server. Neither of which is particularily tasking on the server.
As you can see, I had 6 outages in the last 20 days, some of them lasting mutliply hours. In nearly all cases, the reason that I was given was:
I could accpet it once or twice, but when it go to this level... below is a chat transcript of me and a tech from webhosting4life. It is complete with spelling mistakes and everything. As a result of this, and the evasive answers that I got, I am now on the lookup for a new host.
Notice that the operator simply left the chat when I tried to get additional information about the root cause of the problem. The chat equilent of hanging in my face! They have "Email our CEO" link on the help desk page, which I used to send a question regarding the frequent outages, I never even got a "Thank you for email us".
You can bet that I was a bit surprised when I saw this in the list of heavy methods in dotTrace:

Then I took a look at the number of calls... Did I mention that I don't like temporal data?
BTW, dotTrace rocks!
Scott Hanselman has an amusing post about working with the .Net OpenID library, which is written in Boo. I suggest that you would read it, but a few of notes first:
- I had to go through a similar process when porting Brail from Boo to C#. I have to say that the code afterward has a lot more cruft than before.
- Scott is making a reference to my Boo.Reflector project, I will try to update it to Reflector 5.0, but I can't make any promises. Getting coherent code is not a trivial task, and there are a lot of smarts that went into the C#/VB langauges in Reflector to make it look seemless.
The most important point, though, is about Scott's comment regarding Mono's licensing:
Mono is not GPL'ed. It uses several licenses over several components, but only the compiler itself is GPL'ed. You can see the details here, but basically, the libraries (including Mono.Security) comes freely, with no strings attached (MIT X11 licenses, to whom it may concern).
The guys from Eleutian had done it again, with a post that explains how you can use Windor and Rhino Mocks in order to make it easy to create the tests.
Jacob is raising some concerns about this approach:
Windsor setup is generally fast enough, but doing it per test is probably going to slow the tests down. It certainly makes the tests a lot easier to write.
Oh, and Beta 2 of Rhino Mocks 3.0 should be out later today...
I feel that I gave it too much already, and I am giving up. A workaround is too good for this issue.
Given the following class defination:
public class Dog
{
public static MethodInfo LastCall = null;
public class BarkInvocation<T>
{
public T Bark()
{
LastCall = (MethodInfo)MethodInfo.GetCurrentMethod();
return default(T);
}
}
public T Bark<T>()
{
return new BarkInvocation<T>().Bark();
}
}
Can you make this print true?
public class Program
{
[STAThread]
static void Main(string[] args)
{
Dog d = new Dog();
d.Bark<IList<string>>();
Type returnType = Dog.LastCall.ReturnType;
List<string> strings = new List<string>();
Console.WriteLine(returnType.IsInstanceOfType(strings));
}
}
