Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / December 2003

Tip: Looking for answers? Try searching our database.

ICodeCompiler Leaking File Handles in 1.1 FW?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Phil Wilson - 25 Nov 2003 18:43 GMT
This code (in a containing class which is re-instantiated for the second
compile) results in a generated executable that is stuck "in use" (can't be
removed etc) until the process itself terminates. I've tried several detours,
none of which help. Any suggestions, or is it a FW bug?

public bool  CompileFile (string filename, string Executable)
 {
  VBCodeProvider codeProvider = new VBCodeProvider();
  ICodeCompiler icc = codeProvider.CreateCompiler();
  string Output = Executable;
  System.CodeDom.Compiler.CompilerParameters parameters = new
CompilerParameters();
  parameters.ReferencedAssemblies.Add ("System.dll");
  parameters.ReferencedAssemblies.Add ("System.Web.dll");
  parameters.ReferencedAssemblies.Add ("System.Management.Dll");
  parameters.ReferencedAssemblies.Add ("System.Windows.Forms.Dll");
  parameters.ReferencedAssemblies.Add ("Microsoft.VisualBasic.Dll");
  parameters.GenerateInMemory = false;
  //Make sure we generate an EXE, not a DLL
  parameters.GenerateExecutable = true;
  parameters.OutputAssembly = Output;
  CompilerResults results = icc.CompileAssemblyFromFile (parameters, filename);
  codeProvider.Dispose();
.....
}
Signature

Phil Wilson [MVP Windows Installer]
----

Matt Gertz - 04 Dec 2003 18:31 GMT
Phil,
 Thanks for the notification on this.  I'm going to do some investigation
on this today & try debugging through the problem, and I'll get back to you
either this afternoon or tomorrow morning.  (My response will be posted in
languages\vb, since this is likely to be a VB issue -- I'll drop a copy of
this post over there.)

Thanks,
 --Matt Gertz--*
 VB Compiler Dev Lead

--------------------
>This code (in a containing class which is re-instantiated for the second
>compile) results in a generated executable that is stuck "in use" (can't be
[quoted text clipped - 21 lines]
>.....
>}
Alexandre Moura - 05 Dec 2003 01:41 GMT
I'm doing some investigation on behalf of Matt - I've been trying to repro
this, but having some problems - if I just attempt to compile a file twice,
it seems to be able to do it - also removing or altering the generated .exe
between two compilations in the same process seems to work fine - are you
actually running the generated .exe and attempting to recompile before it
terminates executing?

--------------------
>Reply-To: "Phil Wilson" <phil.wilson@unisys.spamcom>
>From: "Phil Wilson" <phil.wilson@unisys.spamcom>
[quoted text clipped - 9 lines]
>NNTP-Posting-Host: 192.59.186.207
>Path:
cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGXA06.phx.gbl!TK2MSFTNGXA0
5.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
>Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.clr:8789
>X-Tomcat-NG: microsoft.public.dotnet.framework.clr
[quoted text clipped - 24 lines]
>.....
>}
Matt Gertz - 05 Dec 2003 16:43 GMT
Sorry, this should have gone to the VB newsgroup -- bit of confusion on our
side.  I'll add this over there.
--------------------
>X-Tomcat-ID: 53859294
>References: <uCdYXQ4sDHA.2340@TK2MSFTNGP12.phx.gbl>
[quoted text clipped - 66 lines]
>>.....
>>}

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.