Questions tagged [system.diagnostics]

System.Diagnostics is a namespace of the .NET framework. It provides classes that allow you to interact with system processes, event logs, and performance counters.

System.Diagnostics is a namespace of the .NET framework. It provides classes that allow you to interact with system processes, event logs, and performance counters.

References

670 questions
7
votes
1 answer

How can I get the current Trace Switch programatically?

In my web.config I have: Is there a way that I could call, for example: System.Diagnostics.TraceSwitch["logLevelSwitch"]to get the…
balexandre
  • 73,608
  • 45
  • 233
  • 342
6
votes
1 answer

What do time fields in CounterSample mean?

I have an instance of PerformanceCounter, I call NextSample() on it and get a CounterSample. In it, there are several time-related fields: CounterFrequency, SystemFrequency, CounterTimeStamp, Timestamp and TimeStamp100nSec. The MSDN page for…
Jonathan
  • 6,939
  • 4
  • 44
  • 61
6
votes
2 answers

AverageTimer32 counter value becomes zero

I have written a piece of code like this below: For testing i call the method ComputeAndLog and in the performance monitor i can see the non-zero average value. However as soon as i end my testing, the average performance counter value drops to…
6
votes
5 answers

C# Process.exited doesnt get called until after window is closed

So I am writing an application that monitors a console application that was written by another developer. The console application is prone to crashing and because it runs all night i need my application to restart it. Unfortunaltey when the console…
6
votes
2 answers

Encoding issue when capturing console application output in a test

I'm trying to capture output from a console application by running it in a test using System.Diagnostics.Process. I'm having trouble with character encoding. "£" is showing up as "œ" in the test, but when I run the console application it displays…
JontyMC
  • 6,038
  • 6
  • 38
  • 39
6
votes
4 answers

Using Microsoft.VisualBasic.Logging.FileLogTraceListener with ASP.NET MVC 3

I am trying to use Microsoft.VisualBasic.Logging.FileLogTraceListener in my ASP.NET MVC 3 app (vb.net). It works in my dev PC but throws an error when run from an IIS 6 server. Here is the web.config that I use:
Endy Tjahjono
  • 24,120
  • 23
  • 83
  • 123
6
votes
1 answer

Track System.Diagnostics.Trace logs in Azure portal

In my web application, I use System.Diagnostics.Trace.WriteLine(...); for diagnostics. The application is published to an Azure deployment slot. I am wondering where I can find these logs in the Azure Portal (or Visual Studio's cloud explorer).
6
votes
2 answers

"File not found" error launching system32\winsat.exe using Process.Start()

I'm trying to run the Windows System Assessment Tool (winsat.exe) using the following code: System.Diagnostics.Process WinSPro = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo WinSSInfo = new…
Rex Hsu
  • 73
  • 1
  • 5
6
votes
1 answer

System.Diagnostics Traces wildcard for source name

I have my Logging set up to use a different TraceSource for each Class. Is it possible to Configure a wildcard that writes events for all Sources?
Jos Vinke
  • 2,704
  • 3
  • 26
  • 45
6
votes
2 answers

Can I turn off tracing for a single assembly that my code references?

I have a certain framework of code, and I have a TraceListener defined for two reasons: Back-compatibility with a lot of the old logging that was done via Trace.Write until we update it, and It's nice to be able to instrument the other assemblies…
RJ Cantrell
  • 161
  • 3
  • 20
6
votes
4 answers

Best way to read csv file in C# to improve time efficiency

I have the following code to read in a large file, say with over a million rows. I am using Parallel and Linq approaches. Is there a better way to do it? If yes, then how? private static void ReadFile() { float…
5
votes
1 answer

I'm getting an ConfigurationErrorsException "Couldn't find constructor for class CustomListener"

This is related to custom a Systems.Diagnostics.TraceListener
MatthewMartin
  • 32,326
  • 33
  • 105
  • 164
5
votes
2 answers

How to start a IIS process with specific username & password

I'm trying to run an application from our internal website. When I use Process.Start("notepad"); I can see that notepad process started in our web server with default identity mentioned in the app pool setting. But I have to start the process…
Pritam Karmakar
  • 2,773
  • 5
  • 30
  • 49
5
votes
2 answers

ASP.NET and System.Diagnostics tracing - have I missed something, or is this a bad idea?

For various common reasons I wanted to use tracing for my ASP.NET application. Especially since I found out about the possibility to use the Service Trace Viewer tool which allows you to examine your traces in a powerful way. Since I had never used…
Vilx-
  • 104,512
  • 87
  • 279
  • 422
5
votes
3 answers

Unable to set Process.StartInfo.WorkingDirectory to call exe from c#

I'm trying to call chrome.exe inside a C# program by using System.Diagnostics.Process namespace. my chrome.exe is located inside path C:\Program Files (x86)\Google\Chrome\Application if I call RunProc function by passing bellow parameters - (keep…
Arkil Shaikh
  • 342
  • 3
  • 9