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
3
votes
1 answer

How to create predictable output with a Lazy

I'm working on some internal logging framework and for the sake of performance it seems a good idea to lazily get a StackFrame. I want to use this StackFrame to get the first method outside my logging framework. My initial idea was this: using…
JJoos
  • 587
  • 1
  • 6
  • 17
3
votes
1 answer

How do I measure child process launch time in c#?

How do I measure child process launch time in c#? I am currently using the following code to measure executable launch time and would like to add child process execution launch time, for example CMD running notepad or new tab in Chrome. Here is my…
Itamar Levy
  • 73
  • 1
  • 12
3
votes
3 answers

Launching .exe file without pathing location c#

How I can launch exe file with c# code? So I have this : Process.Start( @"C:\Program Files (x86)\Photoshop\Photoshop.exe"); But the path can be different in other machines. So is there any ideas to run .exe with different way? Thanks!
Doniyor Niazov
  • 1,270
  • 1
  • 10
  • 19
3
votes
3 answers

Running a program with System.Diagnostics.Process.Start causes an Application Error

On my PC DWG files open with: "C:\Program Files\AutoCAD LT 2007\acadlt.exe" "%1" If I run this from the command line: "C:\Program Files\AutoCAD LT 2007\acadlt.exe" "C:\Some Path\Test.dwg" AutoCAD Lite open the DWG file. Similarly if I open a…
Andrew Roberts
  • 990
  • 2
  • 12
  • 26
3
votes
3 answers

Cannot Access with an Instance Reference

While I can do this: System.Diagnostics.Process.Start(@"C:\MyFolder\MyProgram.cmd"); I can't do this: var process = new System.Diagnostics.Process(); process.Start(@"C:\MyFolder\MyProgram.cmd"); Error: Member…
JackTheRipper
  • 99
  • 1
  • 9
3
votes
1 answer

Getting System.InvalidOperation exception while trying to execute command line script using C#

I am trying to execute a command to generate PDF file using phantomjs. If I execute following command using command prompt, everything works fine. C:\phantomjs-2.1.1\bin\phantomjs.exe C:\phantomjs-2.1.1\rasterize.js…
SharpCoder
  • 18,279
  • 43
  • 153
  • 249
3
votes
0 answers

.InvalidOperationException in Process.start

I have the following code foreach (Items it in sortedList) { ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.CreateNoWindow = false; startInfo.UseShellExecute = true; startInfo.FileName = it.filePath; …
Goozo
  • 910
  • 2
  • 11
  • 28
3
votes
0 answers

How to Redirect Trace Information to syslog?

I want to override default trace listener to route trace information to syslog server. I am using Kiwi Syslog server. For now, I am sending message to syslog server using nuget library SyslogNet.Client 0.2.3. var _syslogSender = new…
Manjay_TBAG
  • 2,176
  • 3
  • 23
  • 43
3
votes
2 answers

Process ID of process Started by Process Start

I am trying to kill the process by process ID which I am saving when the process start. But the process ID which I am capturing doesn't exists when I try to kill the process from code behind. This is the code below to start the process and capture…
Amrit Sharma
  • 1,906
  • 8
  • 45
  • 75
3
votes
2 answers

How to run PowerShell script using System.Diagnostics.Process.Start in c#?

I'm writing this: using System.Diagnostics; Process.Start("C:\\CodeProjects\\C#\\WindowsPowerShell\\v1.0\\powershell_ise.exe", "-File .\\mp4_to_flac.ps1"); All this does is open up the script in Windows PowerShell ISE. But I also want it to RUN! So…
Awesome_girl
  • 484
  • 3
  • 9
  • 30
3
votes
0 answers

Add TraceListener for WCF in code

Given the following app.config configuration for trace listeners,
vossad01
  • 11,552
  • 8
  • 56
  • 109
3
votes
1 answer

Unable to log WCF Message body

I'm using a 32bit BizTalk 2013r1 host instance to send an insert request to Oracle via the LOB adapter. I need to trace the message body being sent. I have configured the btsntsvc.exe.config as follows:
Rob Bowman
  • 7,632
  • 22
  • 93
  • 200
3
votes
1 answer

Calling bcp from c#

I am needing to call a bcp utility from c# code. Here is what I've got: var text = "\"EXEC @Date=\"1/1/2013\"\" " + "queryout \"\" -c -t\\0 " + "-S
will
  • 837
  • 3
  • 11
  • 24
3
votes
2 answers

Add Trace methods to System.Diagnostics.TraceListener

I wrote a Log class derived from System.Diagnostics.TraceListener like so public class Log : TraceListener This acts as a wrapper to Log4Net and allows people to use System.Diagnostics Tracing like…
Kenoyer130
  • 6,874
  • 9
  • 51
  • 73
3
votes
2 answers

C# to run cmd netsh

I am trying to create a c# form with 2 buttons. btn1 = disable LAN btn2 = enable LAN I have never done something on this level before. What I want to accomplish is when I click on btn1 I want to disabled the LAN, and btn to enable it again. This is…
s0mePe0ple
  • 39
  • 2
  • 5