title: CSharpCodeProvider, CompilerParameters.GenerateInMemory and CompilerResults.PathToAssembly: odd behaviour
body: <p>I have the following code running in a Windows Service that's been working for years without problems even under heavy concurrency:</p>
  
  <pre><code>CSharpCodeProvider codeProvider = new CSharpCodeProvider();           
  
  CompilerParameters parameters = new CompilerParameters();
  parameters.GenerateExecutable = false;
  parameters.GenerateInMemory = true;
  parameters.OutputAssembly = outputAssemblyFile;    
  
  CompilerResults results = codeProvider.CompileAssemblyFromFile(parameters, "file.cs");
  
  if (results.Errors.Count &gt; 0)
  {
      Console.WriteLine("Compile ERROR");
  }
  else
  {
      Console.WriteLine("Compile OK");        
      Console.WriteLine("Assembly Path:" + results.PathToAssembly);
      Console.WriteLine("Assembly Name:" + results.CompiledAssembly.FullName);        
  }
  </code></pre>
  
  <p>Usually, when the code is successfully compiled, since parameters.GenerateInMemory is set to true, the results.PathToAssembly is null (as specified in the MSDN)</p>
  
  <p>One of these days I started having an issue where sometimes the code was being successfully compiled but results.PathToAssembly was NOT null. Additionally, CompiledAssembly was returning a FileNotFoundException but when I checked the path indicated by results.PathToAssembly the assembly was actually there. I could not, however, make sure it was there at that specific moment.</p>
  
  <p>I restarted the service and everything was back on track.</p>
  
  <p>Is there any obvious reason for this to happen?</p>
  
  <p>Thinking this could be some permission issue I tried to reproduce the issue by having the assembly already created and setting the file read-only, but that caused the compilation to fail.</p>