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

WPF Using .Net 3.1 - Process.Start Excel File Error: "The specified executable is not a valid application for this OS platform."

I am trying to open an Excel file (.xlsx) within a WPF .NET Core 3.1 app. Using Winforms, I am able to do process.start("Resources/test.xlsx") and the file will open. In the WPF application doing the same thing results in an error The specified…
Jakxna360
  • 857
  • 2
  • 9
  • 31
2
votes
2 answers

Application not running from production web server

I have to run a tool from our internal website. There are few inputs that user will provide from UI and then I want to run the tool with user credential. My code works fine when I run it from my local machine, but when I deploy it to production…
Pritam Karmakar
  • 2,773
  • 5
  • 30
  • 49
2
votes
0 answers

How to get list of TraceSource's or retrieve a TraceSource by name?

I would like to change some trace settings dynamically in code. But I get stopped at the first step: How do I get an existing TraceSource object? Is there a way to retrieve a TraceSource by name? Or to get a list of all the existing TraceSource's?…
Jay
  • 26,876
  • 10
  • 61
  • 112
2
votes
1 answer

unable to run the command using c#

I need to run below TXL command using C#. basically i just run a command and store the output in temp.grm. If I run this command in cmd it works fine which means there is no error with the command. The problem is when I try to run this command using…
2
votes
1 answer

Process.Start() open URL throws Win32Exception sometimes?

I have the following code to open a URL in default browser: string url; //... Process.Start(url); But it will fail and throws a Win32Exception with some URL, for…
Dia
  • 851
  • 1
  • 15
  • 35
2
votes
0 answers

How to implement computaion expression with custom operations and statements execution

I'm trying to implement diagnostics computation expression to log activities and and events using System.Diagnostics.DiagnosticSource NuGet. But I can't figure out how my computation expression can execute regular statements between calls to custom…
Andrii
  • 1,081
  • 1
  • 11
  • 24
2
votes
1 answer

Duplicate process start doesn't react as expected

i'm trying to open a process with c# and react to it, when it's been closed. This work's for me: private void StartProc() { var process = new System.Diagnostics.Process { StartInfo = { FileName = "PathTo.exe" } }; …
user10172226
2
votes
1 answer

How to Dispose a process, where you don't want to wait for exit

I have a process p in my application, which will be closed by the user at some point while my application is still running. But I want my application to run on while p is running. How do I then dispose p after p were closed by the user?
2
votes
1 answer

c# tracing system.diagnostics

I am using a sync service to sync between compact database and server. In web.config, i am diagnosing the sync and logging in the file like this:
Tarun
  • 393
  • 1
  • 6
  • 22
2
votes
1 answer

Updating parent process GUI on receiving Process.Exited event - WPF

I am trying to launch a process within an application. The code below simply starts notepad on clicking the button of the main GUI. Now when the notepad is launched the button is disabled. I have subscribed to the Process.Exited even to receive…
K Singh
  • 1,710
  • 1
  • 17
  • 32
2
votes
4 answers

Calculating server uptime gives "The network path was not found"

For the following code, I am getting System.ComponentModel.Win32Exception: The network path was not found Can anyone help? PerformanceCounter pc = new PerformanceCounter("System", "System Up Time"); pc.MachineName =…
genericuser
  • 1,430
  • 4
  • 22
  • 40
2
votes
0 answers

No log file created by Microsoft.OWIN

I am experiencing an intermittent problem between my application, Identity Server, and the Microsoft.OWIN layer. The issue is probably something I am doing wrong, but may actually be a bug in Microsoft.OWIN. In order to better understand the root…
Dave Shine
  • 51
  • 4
2
votes
1 answer

Using EventFlow to monitor ETW event on local machine

I am trying to set up a simple ETW and EventFlow example that allows specific ETW providers to be monitored. In this case the Service Control Manager ETW provider to monitor when Service Start and Stop messages are issued. I have the following…
Adrian Russell
  • 3,995
  • 5
  • 25
  • 26
2
votes
1 answer

Is there an alternative to AzureDriveTraceListener to get TraceSource events to appear in Azure web site streaming logs?

I've instrumented my Azure app service web application (.Net 4.6.1) using custom TraceSources with trace switches so that I can have granular control over my tracing volume at run time. After publishing to my Azure web site, none of the trace…
2
votes
2 answers

Retrieve order of open windows as ordered in the Alt-Tab list?

This is the entire code of my C# application, with a simple goal. I want to retrieve the open windows on the system, ordered by how they were recently opened, just like in the Alt-Tab list. The Alt-Tab list lists programs as they were last opened,…
Sam Weaver
  • 1,027
  • 16
  • 30