We had this constantly during a build (during the validation part) of a web application in Visual Studio 2008. I think it occurred just after the machine name changed, but cannot be sure.
We also got the error 'The application domain in which the thread was running has been unloaded'; but only once.
We opened a Microsoft Support case for it - they managed to suppress the error by putting the following in the web.config
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=18.104.22.168, Culture=neutral, PublicKeyToken=B77A5C561934E089" extension=".cs" compilerOptions="/nostdlib /d:DEBUG;TRACE /warnaserror-" warningLevel="0"/>
<!-- /nowarn:0162,0108,0114,0252 -->
We're still waiting on a response from MS Support and we believe it's an MS bug. At least with the above, it's possible to get on with the job!
UPDATE: 25TH JUNE 08:
OK, this bug has been sent via Redmond and I had a response today: "As a follow up to your question below… We investigated this area and it came out to be a known bug which we are fixing in SP1 version of ASP.NET… So do ask Kristan to look forward to it".