Bug 12202 - compile using CSharpCodeProvider - missing temp directory
Summary: compile using CSharpCodeProvider - missing temp directory
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
Depends on:
Reported: 2013-05-10 18:22 UTC by achimdahlhoff
Modified: 2013-10-10 05:55 UTC (History)
2 users (show)

Tags: CSharpCodeProvider compiler GenerateInMemory
Is this bug a regression?: ---
Last known good build:

small source to reproduce bug about missing temp dirs. (2.64 KB, application/octet-stream)
2013-05-10 18:22 UTC, achimdahlhoff

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description achimdahlhoff 2013-05-10 18:22:18 UTC
Created attachment 3949 [details]
small source to reproduce bug about missing temp dirs.

When compiling Code into memory using the Microsoft.CSharp.CSharpCodeProvider class, 
the compiler either fails to create a temp dir or deletes it too early.

Small demo as attachment. The program creates a tiny class source, compiles it as in-memory assembly, runs it, then changes the classname and compiles it again.

(Needed as basis for an application which will regenerate classes over and over again.)

The program keeps generating new classnames 'Blaeh0', 'Blaeh1', ...

The first works, on the second, it fails complaining about a temp dir.

Works fine on MS environment with VS2005 and the 2.0 compiler.

Error message from compiler:

error CS0016: Could not write to file `1c7f9e1b', cause: Could not find a part of the path "/tmp/1f28ac7c/1c7f9e1b.dll".

To reproduce:

save file attached, compile using  dmcs testcsc.cs   ,   start. Fails on second loop.

Build same on Microsoft VS2005, run, it works.
Comment 1 achimdahlhoff 2013-05-10 18:25:11 UTC
Forgot version info:

dmcs version

mono version

debian7 wheezy, kernel 3.8.8, x86_64
Comment 2 Marek Safar 2013-10-10 05:55:12 UTC
Fixed in master