.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Diagnostics.Process cannot be disposed completely

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :WPF

I've had a strange issue for a couple of weeks now and I still can't find a solution.

I'm working on a test tool in C# (using .NET 3.5) for our application that runs on a remote computer. It is able to update source and start VS to build and run our program while monitoring its state and send information about that to a server. All scheduled tasks is done by python scripts, the testtool is responsible only for maintaining a list of scripts and run them using System.Diagnostics.Process. The python scripts can start other programs (svn.exe, devenv.exe). The tool also creates a System.Runtime.Remoting.Channels.Tcp.TcpChannel instance through which it communicates with monitoring clients that runs e.g. on my local computer.

The strange issue is when I close my testtool and it has already run a python script that launched another process (svn or VS). Though I call also Kill() and Dispose() on the running Process and python will stop, the other process started py python keeps running and thats a good thing for me, there's no problem with that. The problem occurs when I want to restart the testtool it sais that it can't create the TcpChannel because there exist already one with that port. I can only manage to restart it after killing svn or VS manually in task manager, and that's bad cause I still want to monitor a running instance of studio.

I don't

View Complete Post

More Related Resource Links

How to process data AFTER page is completely loaded for the user?


I have some logging that has to be done, which are some database update or inserts.

However this logging is of no importance to the user, so I only want to process the data/logs after the page is completed for the user.
As of now, if I process the data while the page is loading, I go from 1.4 to 2.0 speed (server side time processing of code), which is quite a bit comparing it is of no use to the user.

So I want this code only executed after that the page is complete.

I've been checking out Ajax, async pages etc, but the problem is it still gets executed before the page is rendered to the client, which means the client will have to wait longer then it is not being processed.

I've been checking out Threadpool.queueBackgroundWorker, however if I get it correct, this will still be executed before the page is shown to the user, as it has to complete before the prerender.

Then I thought about creating a new thread, and do the processing there, which would not have my page waiting to complete the data/logging.
However when I have 100 or 200 users loading pages at the same time, then that would mean I would be creating 200 threads on those loads, which I doubt will be good for performance. So if I want to solve this, I would have to create my own threadpool and only assign for example a max of 40 threads to it which can pr

Issue on System.Diagnostics.Process output

I am getting the following error message System.InvalidOperationException: StandardOut has not been redirected or the process hasn't started yet. for the below code which has to displays the Output of the command prompt command: Process p = new Process(); string result = ""; p.StartInfo.WorkingDirectory = "C:\\WINDOWS\\system32"; p.StartInfo.FileName = "cmd.exe"; p.StartInfo.UseShellExecute = false; p.StartInfo.CreateNoWindow = true; p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.Arguments = "/C ipconfig"; StreamReader stdOut = p.StandardOutput; p.WaitForExit(); p.Start(); result = stdOut.ReadToEnd(); if (!p.HasExited) { p.Kill(); } stdOut.Close(); p.Close(); Response.Write(result); System.Threading.Thread.Sleep(5000); Please help guys. Is I am doing correct. 

System.Diagnostics.Process.Start not work with IIS, but on ASP.NET Development Server

System.Diagnostics.Process.Start not work with IIS, but on ASP.NET Development Server 

Process (System.Diagnostics.Process) invoked by aspx hangs on iis6 / win2003

Hello all, I've encountered a problem trying to run an external exe from an aspx page. My code works fine when running under visual studio and also when running under iis7 on windows server 2008 SP1. It does not work on iis6 on windows 2003 sp2: 1. The executable is loaded and uses 560k or so of memory 2. The executable does not use any cpu 3. The executable does not appear to enter Main()  4. The invoking code hangs at WaitForExit() I've tried using different executables including a dummy that simply returned and that did not make any difference. I'm pretty sure that the credentials being used for the executable are correct because if I fudge the password, the process reports a login failure. I'm pretty sure that output blocking to the standard out and standard error streams is not the issue as a) it works on iis7 and b) when I first suspected this as the cause, I re-wrote the aspx to launch threads to read the streams. I've tried invoking my exe directly and via cmd.exe and that makes no difference. Anyway, if anyone has any ideas on this, it would be greatly appreciated. I've included a snippet of my code below. Thanks in advance... ...Beau                     // Create a new process to invoke the console app                     usi

System.Diagnostics.Process and Acrobat Reader

If I already have any PDF file being displayed in Adobe Reader, making the call System.Diagnostics.Process proc = Launch(sUniqueName, sPath, true, m_iWaitNone), then immediately examining proc.HasExited would indicate true, although the "sUniqueName" PDF would still be open.  This can't be correct!?

If I don't have any PDF files open before making the call, "sUniqueName" would be open, and examining proc.HasExited would indicate false... which is correct.  This is very repeatable.  Why would proc.HasExited = true when the PDF is still being displayed just because another PDF was opened prior to the call?

Thanks for any insight... this is driving me crazy!   :-P



Code follows:

      #region Launch()
        public System.Diagnostics.Process Launch(string sFilename, string sArgs, bool bCreateWindow, int iWaitMode)
            const int ERROR_FILE_NOT_FOUND = 2;
            const int ERROR_ACCESS_DENIED = 5;

            System.Diagnostics.Process proc =

ASP.NET Architecture - ASP.NET Worker Process - HTTP Pipleline - Http Modules and Handlers

"ASP.NET is a powerful platform for building Web applications, that provides a tremendous amount of flexibility and power for building just about any kind of Web application. Most people are familiar only with the high level frameworks like WebForms and WebServices which sit at the very top level of the ASP.NET hierarchy. In this article I'll describe the lower level aspects of ASP.NET and explain how requests move from Web Server to the ASP.NET runtime and then through the ASP.NET Http Pipeline to process requests.

Performance Tests: Precise Run Time Measurements with System.Diagnostics.Stopwatch

Everybody who does performance optimization stumbles sooner or later over the Stopwatch class in the System.Diagnostics namespace. And everybody has noticed that the measurements of the same function on the same computer can differ 25% -30% in run time. This article shows how single threaded test programs must be designed to get an accuracy of 0.1% - 0.2% out of the Stopwatch class. With this accuracy, algorithms can be tested and compared.

For Multi-Language website which process is better in asp.net


 I want to build multi-language website in asp.net 2008 and asp.net 2010. So, which process is better for building application? Using either Local and Global Resource or New Folder to make separate according to language?


Application performance should be good and also easy manageable.


Please suggest me in which way I will build the application either using resource or folder. If there is any other better solution then please share.

Cloud Diagnostics: Take Control of Logging and Tracing in Windows Azure


It's difficult to troubleshoot any application without a trail of clues to follow, and cloud apps are no different. We look at how logging and tracing are enabled for Windows Azure, and how you can use Windows PowerShell to manage diagnostics for a running service.

Mike Kelly

MSDN Magazine June 2010

CLR Inside Out: Production Diagnostics Improvements in CLR 4


The Common Language Runtime (CLR) 4 includes new APIs that expand diagnostic support toward the production end of the spectrum. We explain how the debugging APIs support dump debugging for application crash and hang scenarios and make it easier to detect when hangs are caused by multi-threading issues.

Jon Langdon

MSDN Magazine May 2010

Thread Diagnostics: Performance Tuning with The Concurrency Visualizer in Visual Studio 2010


Understanding performance bottlenecks in multithreaded apps used to require significant instrumentation and analysis by expert developers. The Concurrency Visualizer in Visual Studio 2010 significantly reduces the burden of parallel performance analysis.

Hazim Shafi

MSDN Magazine March 2010

CLR Inside Out: In-Process Side-by-Side


The new .NET Framework 4.0 maintains backward compatibility while allowing core innovations by using a new feature called In-Process Side-by-Side. Learn about how it works and some problems it didn't solve.

Luiz Fernando Santos, Jesse Kaplan

MSDN Magazine December 2009

Team System: Streamline Team Projects With Process Templates


See how you can streamline your team projects using Process Templates in Visual Studio Team System (VSTS)

Brian A. Randell

MSDN Magazine December 2008

Security Briefs: Threat Models Improve Your Security Process


Using threat models to drive your security engineering process helps prioritize the code review, fuzz testing, and attack surface analysis tasks.

Michael Howard

MSDN Magazine November 2008

Security Briefs: Reinvigorate your Threat Modeling Process


In this column the author outlines some approaches to threat modeling that can be employed by development teams of any size.

Adam Shostack

MSDN Magazine July 2008

CI Server: Redefine Your Build Process with Continuous Integration


Jay Flowers demonstrates how to set up and use a Continuous Integration server using both discrete tools and the more comprehensive CI Factory solution.

Jay Flowers

MSDN Magazine March 2008

Advanced Basics: Monitor Your Apps with System.Diagnostics


It never fails. The application you just deployed ran great on your development machine-but stumbles in production. The problem might show up right away or maybe it creeps up over time. Now what?

Brad McCabe

MSDN Magazine July 2006

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend