system.diagnostics

Can I retrieve hard drive diagnostics on a Linux System?

I am running Linux-2.4 system, and I am attempting to retrieve hard drive diagnostics information, any that might be available. Is there a way that I can retrieve these hard drive statistics? ...

PerformanceCounterCategory.Exists is very slow if category doesn't exists

I have kind of library which uses a bunch of its own perf counters. But I want my library works fine even if that perf counters weren't installed. So I've created wrappers aroung PerformanceCounter and on the first use check if PerfCounter exists or not. If they exists then I'm using native PerformanceCounter instead I'm using a wrapper...

How Can I Find What's Causing My Transaction to Get Promoted?

I have web site which serves web services (a mixture of .asmx and WCF) which is mostly using LINQ to SQL and System.Transactions. Occaisionally we see the transaction get promoted to a distributed transaction which causes problems because our web servers are isolated from our databases in such a way that it is not possible for us to use ...

C# 4.0: Is there a way to check if application not exist in System.Diagnostics.Process.Start

I want to open any file type by using the code below: System.Diagnostics.Process.Start(pathFile); Is there a way to check if system application not exist? for example: pdf, the local machine has no acrobat reader. I created a try catch, however I'm not satisfied with it, I want to imitate the behavior of windows in opening a file. I...

.net Diagnostics best practices?

We initially didn't use any logging or debug tracing but after spending few weeks to trace down some data corruption we decided to put required Debug.Write and Trace for production and Debug.Assert So now question is What is the best practice to use debug and trace logging. I am just looking for some thing generic. public void AddRecto...

Can Stopwatch be used in production code?

Hi, I need an accurate timer, and DateTime.Now seems not accurate enough. From the descriptions I read, System.Diagnostics.Stopwatch seems to be exactly what I want. But I have a phobia. I'm nervous about using anything from System.Diagnostics in actual production code. (I use it extensively for debugging with Asserts and PrintLns etc...

Any libraries out there that extend System.Diagnostics.Trace?

Any there any good libraries out there that extend System.Diagnostics.Trace? Some of the features I am looking for. Rolling logs smtp And "Use log4net" is not an answer. The reason being is that i don't want a reference to any third party assemblies. In response to comments: Because using trace does not pollute the business code. I...

PerformanceCounter.NextValue hangs on some machines.

I don't know why, but many computers hangs on following operation: void Init() { net1 = new List<PerformanceCounter>(); net2 = new List<PerformanceCounter>(); foreach (string instance in new PerformanceCounterCategory("Network Interface").GetInstanceNames()) { net1.Add(new PerformanceCounter("Network Interface", ...

alternatives to System.Diagnostics.Process.Start when command is too long

I have some code which is generating a rather long command that is being sent to System.Diagnostics.Process.Start(). The call fails with a Win32Exception, message "The filename or extension is too long". The path to the program itself is not very long, but the parameters passed in are quite long. I am calling the version where an inst...

Run a method from an exe file

Hi I need to call a method from an exe file ProcessStartInfo startInfo = new ProcessStartInfo(@"exeParser.exe"); startInfo.WindowStyle = ProcessWindowStyle.Normal; startInfo.CreateNoWindow = false; startInfo.RedirectStandardOutput = true; startInfo.UseShellExecute = false; startInfo.Arguments...

Diagnostics Trace: how to trace only one WCF endpoint

Hi, I have a WCF client that connects to multiple endpoints; some net.pipe, some https. The net.pipe endpoints have a fair amount of chatter but they work reliably, so I don't want to trace those, as the log file gets too big and cluttered too quickly. However, the https endpoint is fairly new and I need to trace that one. How do I tra...

Is there a significant problem with not calling Process.Close()?

Is the Close() method required for the System.Diagnostics.Process class? EDIT: The Process is monitoring a console application which terminates almost instantly... Billy3 ...

.NET assembly not creating as backgrouond process using System.Process

Hello, I am trying to launch background processes using System.Diagnostic.Process API . It launches every process e.g notepad.exe, all native processes and all windows form base processes. But this unable to launch pure managed GUI less assemblies. Task Manager not showing those assemblies listed in its list as seperate process. Niether...

System.Diagnostics.Debug namespace vs Other logging solutions (log4net, MS Enterprise Library, etc.)

Hi everyone! I'm currently investigating various logging possibilities for .net projects and I can't decide between System.Diagnostics.Debug/Trace features and third party libraries like log4net, MS Enterprise Library, NLog, etc. At the moment I have found out this: System.Diagnostics is rather difficult to configure and to use since y...

How to solve memory leak caused by System.Diagnostics.PerformanceCounter

Summary I have written a process monitor command-line application that takes as parameters: The process name or process ID A CPU Threshold percent. What the program does, is watches all processes with the passed name or pid, and if their CPU usage gets over the threshold%, it kills them. I have two classes: ProcessMonitor and Proce...

why can't i find process class in my System.Diagnostics silverlight project VS 2010

i wanna use process.getprocesses() but it doesn't seem to be in my diagnostics class, why?!!! ...

WCF auditing/logging

Hi guys, I need to provide non repudiation in my WCF services and want to store all my incomming SOAP requests into a SQL server DB with signature/security data and all the envelope stuff. This way, when a problem occurs, we can tell to the client "Hi, THIS is your signed message" exactly as you wrote it. To do this, I need to store ...

How to use .NET PerformanceCounter to track memory and CPU usage per process?

http://msdn.microsoft.com/en-us/library/system.diagnostics.performancecounter.aspx ...

"Gracefully" killing a process

Right now I am using Process.Kill() to kill a process. Is there a way though, instead of just killing it immediately, that I can like send a message to the process instructing it to close so that it can gracefully clean up and shut down. Basically, I'm looking for the equivlent to just clicking the red X in the upper right hand corner, w...

System.Diagnostics.Trace.TraceListener UnsafeStringCopy exception from ASP.NET

I get an odd intermittent error when trying to write a Diagnostics.Trace message from an assembly used by an ASP.NET application. It's .NET 3.5 on IIS7. The code setup is that when web.config has debug specified I add an instance of HttpResponseTraceListener to System.Diagnostics.Trace.Listeners. I'm doing it that way so in my other a...