Bug in CodeDomCompiler when compiling multiple source strings


When using the CodeDomCompiler to compile multiple source strings (by calling CodeDomCompiler.CompileAssemblyFromSource with more than one source string) the compiler raises an ArgumentException: The file name '[...]\Temp\mwa14bzi.fs' was already in the collection.

This is due to a bug in FSharp.Compiler.CodeDom/codeprovider.fs, in the method FSharpCodeCompiler.CompileAssemblyFromSourceBatch in the fragment
              let files = sources |> Array.map ( fun src -> 
                  let fn = res.TempFiles.AddExtension("fs", false)
                  use wr = new StreamWriter(fn)
This will fail given multiple input sources, since re.TempFiles.AddExtension will return the same name for the a given extension every time - it does not generate new names on every call as the function author presumable expected. (See http://msdn.microsoft.com/en-us/library/84y8d5dc.aspx).


PhoeniXX wrote Jan 9, 2014 at 1:42 PM

I've also suffer because of that issue. CSharp code dom provider uses for to generate temp file for each source file. but this code doesn't do it.

As for me it's not a Low issue.

Please, fix it.

wrote Jan 9, 2014 at 1:42 PM

wrote Jan 9, 2014 at 1:45 PM

sabir123 wrote Apr 15, 2016 at 5:31 AM

The website can be giving iTunes codes that we can now generate free iTunes codes online so that we can get free code generators with such tool.

BillArrington wrote Jul 12, 2016 at 5:26 AM

Composing service are accessible in both online and disconnected from the net. To expend the time the greater part of us favor best essay writing service . Be that as it may, everybody ought to think before selecting request an essay through on the web.