473,383 Members | 1,788 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

ICodeCompiler Leaking File Handles in 1.1 FW?

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
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();
.....
}
--
Phil Wilson [MVP Windows Installer]
----


Nov 20 '05 #1
1 1438
Phil,
We are still investigating this. One of our testers has a question on
this:

From Alexandre Moura:
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?

--------------------
X-Tomcat-ID: 621056989
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
From: ma****@online.microsoft.com (Matt Gertz)
Organization: Microsoft
Date: Thu, 04 Dec 2003 18:33:46 GMT
Subject: ICodeCompiler Leaking File Handles in 1.1 FW?
X-Tomcat-NG: microsoft.public.dotnet.languages.vb
Message-ID: <KC**************@cpmsftngxa07.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.vb
Lines: 43
Path: cpmsftngxa07.phx.gbl
Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.languages.vb:161397
NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122

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 youeither 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 beremoved 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();
.....
}
--
Phil Wilson [MVP Windows Installer]
----



Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Rohit | last post by:
Hi, Threads in the .NET Framework 1.1 (and possibly in 1.0 also) leak "Event" handles, by Event handles I mean Win32 Event handles which can be monitored using the ProcessExplorer from...
0
by: j jpenney | last post by:
**** Post for FREE via your newsreader at post.usenet.com **** Hello, I'm working on a problem we've been having with an OAS deployed application. We have a W2K3 machine running OAS 10g, with...
0
by: Tim Wallace | last post by:
OK, I'm resolved to the fact that I need to use ICodeCompiler to implement my client scripting feature for my C# 2.0 application, since VSA is going the way of the dodo bird. My question is this: ...
0
by: Frank Lopez | last post by:
My program structure is: 1. 2. 3. => manually does the crt-init and crt-terminate calls 4. -- this is accessed by the unmanaged C++ classes in (3) using LoadLibrary and FreeLibrary
2
by: Eric | last post by:
Good morning, I am trying to compile a DLL on the fly using ICodeCompiler. While I am able to accomplish the task if I use a seperate code file along with CompileAssemblyFromFile, however, when...
0
by: Cayze | last post by:
Hello all, I'm trying to use ICodeCompiler and was wondering if there's a way to pass it a project file (*.csproj, *.sln, *.vbproj, etc) to have it rebuild the project. I don't think there is,...
1
by: Marc Eaddy | last post by:
Hi, I'm trying to create an ICodeCompiler using the following code: CodeDomProvider cdp = new Microsoft.MCpp.MCppCodeProvider(); ICodeCompiler icc = cdp.CreateCompiler(); However,...
3
by: Mike B | last post by:
I've got a forms engine-type app that's very control intensive, and after it runs long enough it gets the "can't create windows handle" message. I don't seem to be able to track down whatever it...
0
by: =?Utf-8?B?RnJlZHJpayBKb2hhbnNzb24=?= | last post by:
Hello, I've asked this before, but I never got a _good_ answer, so here's another shot: - Networks are unreliable, and servers cannot be guaranteed to have 100% uptime. After opening a...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.