I finally found the cause for this problem. The closing of the WCF ServiceHost in the example races with the AppDomainUnload a few lines later. Adding a three second delay after host.Close() in Skel.Stop() Code.cs:~120 gives the ServiceHost enough time to finish and the AppDomainUnloadedException does not occur.
Strangely enough I still cannot reproduce the behaviour without running under NUnit. I do believe though that this constitutes a bug in WCF that is (only) triggered by NUnit.
I finally found the cause for this problem. The closing of the WCF ServiceHost in the example races with the AppDomainUnload a few lines later. Adding a three second delay after host.Close() in Skel.Stop() Code.cs:~120 gives the ServiceHost enough time to finish and the AppDomainUnload edException does not occur.
Strangely enough I still cannot reproduce the behaviour without running under NUnit. I do believe though that this constitutes a bug in WCF that is (only) triggered by NUnit.