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
12
votes
2 answers

How to Configure Network Tracing Dotnet core for HttpClient calls?

As per reference document at https://learn.microsoft.com/en-us/dotnet/framework/network-programming/how-to-configure-network-tracing We can setup this in web.config or any other configuration file and we get detailed system.net traces, packets…
12
votes
2 answers

How to include user friendly timestamp in traces

I am trying to understand the difference between Trace.Write vs Trace.TraceInformation and which one should be used. I tried to configure traceOutputOptions for timestamp/datetime. I just need an add timestamp with each message that I am writing.…
imak
  • 6,489
  • 7
  • 50
  • 73
12
votes
1 answer

Process.Start a file without Extension

We already know how System.Diagnostics.Process.Start("C:\filename.png") works, but what if the file name doesn't end with an extension? How can I run a filename without an extension, using the default program that is associated with, for example,…
Amin Darvand
  • 367
  • 2
  • 19
12
votes
1 answer

When can Process.Start() return null?

I have some code that starts a process by using Process.Start(ProcessStartInfo). I see from the documentation that this method can return null if an existing process is reused. [Returns a] new Process component that is associated with the process …
fractor
  • 1,534
  • 2
  • 15
  • 30
11
votes
4 answers

Calling dism.exe from System.Diagnostics.Process Fails

For enabling Microsoft-Hyper-V and Microsoft-Hyper-V-Management in Windows 2008 R2 Server(64bit), I'm calling dism.exe as a process. The command I've used is Dism.exe /online /Get-FeatureInfo /FeatureName:Microsoft-Hyper-V Dism.exe /online…
11
votes
2 answers

Is CorrelationManager.LogicalOperationStack compatible with Parallel.For, Tasks, Threads, etc

Please see this question for background information: How do Tasks in the Task Parallel Library affect ActivityID? That question asks how Tasks affect Trace.CorrelationManager.ActivityId. @Greg Samson answered his own question with a test program…
wageoghe
  • 27,390
  • 13
  • 88
  • 116
11
votes
6 answers

Open Windows' Calculator in my C# Win Application?

I know I can open Windows Calculator with the following code : System.Diagnostics.Process.Start("calc"); But I wanna open it in my C# Win Application, i.e : I don't want to open it in the independent window, I wanna open it in my window. How can I…
Mohammad Dayyan
  • 21,578
  • 41
  • 164
  • 232
11
votes
2 answers

Application Insights TraceListener is not collecting traces?

I have the following configuration in place, but no traces are going into Application Insights (otherwise Application Insights is working fine for other logging and the Azure diagnostics listener is also working and capturing the traces). Am I doing…
11
votes
2 answers

What should I identify with the id argument in TraceSource.TraceEvent method?

I use the TraceSource class for logging in my .NET projects. However a point that has never been clear to me is, what the intent of the id parameter in the TraceEvent method. Currently, I always set it to 0. But what is the expected or typical…
Jean Hominal
  • 16,518
  • 5
  • 56
  • 90
10
votes
5 answers

Windows Azure Worker Role not getting past first line of code

I have a worker role that works perfectly in development but doesn't work when deployed. "Doesn't work" is rather vague, but that's really all I have to go on as I'm not seeing any errors or anything (in the event log anyway - maybe there is…
s1mm0t
  • 6,035
  • 4
  • 38
  • 45
10
votes
2 answers

System.Diaganostics.Process.Id Isn't the Same Process Id Shown in Task Manager. Why?

I'm using C#'s System.Diagnostic.Process object. One of its properties is Id. The Id this produces is not the same as the PID, shown in Windows Task Manager. Why is this? You see, once this process is started. It launches two other unmanaged…
Lonnie Best
  • 9,936
  • 10
  • 57
  • 97
10
votes
3 answers

What's the difference between creating a new instance with "new() and ".StartNew()"?

Coming from my "answer" to question "Stopwatch in a Task seems to be additive across all tasks, want to measure just task interval" What are the possible differences between creating a new Stopwatch instance as: Stopwatch timer =…
9
votes
6 answers

Check if a process is running on a remote system using C#

I am trying to check if a process is running on a remote system. I am using the following code: string procSearc = "notepad"; string remoteSystem = "remoteSystemName"; Process[] proce = System.Diagnostics.Process.GetProcessesByName(procSearch,…
Chris
9
votes
7 answers

Can Process.Start() take the system PATH into account?

I've been searching and experimenting for a while with this, but I have had no luck. I am trying to make a console program to automate some tasks that I couldn't quite do with a BAT file. I want to call "signcode.exe" from the Windows SDK, the bin…
drew010
  • 68,777
  • 11
  • 134
  • 162
9
votes
1 answer

.NET Process Start Process Error using credentials (The handle is invalid)

I have an Windows Form application that supplies the User Name, Domain, and Password to the StartInfo, and it throws this: System.ComponentModel.Win32Exception: The handle is invalid at…
Cyberherbalist
  • 12,061
  • 17
  • 83
  • 121
1 2
3
44 45