system.diagnostics Questions

5

I want to log all HTTP requests in a dotnet core 2.1 application. Logging should include HTTP headers, body and the host address. I need to bind my logging code globally without changing the existi...
Snowfield asked 9/7, 2019 at 8:22

2

Solved

I want to connect to REST Api, but it keeps returning status code 400 (Bad Request) no matter how I build the request. HttpResponseMessage response = client.PostAsync(url, content).Result; respons...

18

Solved

When logging in C#, how can I learn the name of the method that called the current method? I know all about System.Reflection.MethodBase.GetCurrentMethod(), but I want to go one step beneath this i...
Bicentennial asked 5/10, 2008 at 13:28

1

I might have missed it in the documentation, but I just can't find a way to do it. I'm looking for a way to globally set some tags/labels that will be added to all metrics in my service. Motivation...
Dwinnell asked 23/4, 2023 at 10:39

3

Solved

I've been using C# System.Diagnostics.Process to monitor the output of a command line utility. The process I'm monitoring "internally" launches a second process, and as soon as it does, I receive...
Racon asked 18/1, 2010 at 22:13

13

Solved

Of late, I'm becoming more health oriented when constructing my program, I have observed that most of programs take 2 or 3 minutes to execute and when I check on the task scheduler, I see that they...
Upcountry asked 12/6, 2009 at 22:7

2

Solved

I haven't find the way to make activitySource.StartActivity return non-null activity, which is different comparing to DiagnosticSource.StartActivity behavior. Is it expected? Am I'missing something...
Bores asked 22/11, 2020 at 16:7

2

I have a class: public abstract class InvestorAccount { public bool IsRegistered => ...; } And a subclass: public class PrivateInvestorAccount : InvestorAccount { public Person? Holder { get;...
Kannada asked 13/5, 2022 at 15:38

2

This article, https://devblogs.microsoft.com/aspnet/improvements-in-net-core-3-0-for-troubleshooting-and-monitoring-distributed-apps/, tells me that the field TraceId is available as a correlation ...
Fungistat asked 10/2, 2020 at 7:41

2

Solved

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 d...
Blakeslee asked 1/4, 2020 at 12:4

4

Solved

When I run msbuild at the command line it shows pretty colours in the console. However when I run it from C# with Process.Start, the output appears in black and white. How can I keep the colours? ...
Dialysis asked 5/7, 2013 at 16:25

2

Solved

I'm trying to dtruss a process in Mac OSX Catalina, however dtrace is reporting an error. $ sudo dtruss whoami dtrace: system integrity protection is on, some features will not be available dtra...
Zsa asked 29/3, 2020 at 0:31

4

Solved

What's the difference between Debugger.Launch(); Debugger.Break(); ?
Patronage asked 21/9, 2010 at 10:17

3

Solved

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 Ru...
Tremml asked 15/11, 2018 at 10:57

2

I have a System.Diagnostics.Process object in a program targeted at the .Net framework 3.5 I have redirected both StandardOutput and StandardError pipes and I'm receiving data from them asynchrono...
Basrhin asked 15/9, 2008 at 14:17

3

Solved

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 Stopwa...
Transact asked 28/4, 2013 at 3:56

3

Solved

I'm using NLog for our logging. I am trying to set up a way of getting it to output stuff to System.Diagnostics.Trace(), so I set up the NLog.config file as follows: <targets> <targe...
Grania asked 28/9, 2012 at 11:18

3

Solved

How can I use System.Diagnostics.PerformanceCounter to track the memory and CPU usage for a process?
Pegmatite asked 5/8, 2010 at 4:43

2

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 fil...

3

Solved

I am using the Process class to run an exe. The exe is a 3rd party console application that I do not control. I wish to know whether the process is waiting for input on the command line. Should ...
Leonoreleonsis asked 10/11, 2009 at 0:3

3

Say you have C# trace messages all over an application. Something like: Trace.TraceInformation("Service Started"); How do you automatically log this to an nLog target without having to add cod...
Adventitia asked 6/11, 2012 at 22:48

6

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.Di...
Marital asked 14/5, 2009 at 20:2

4

Solved

In .NET Process.GetProcessById throws an exception if the process with this ID is not running. How to safely call this method so that it won't throw an exception? I am thinking something like if(P...
Slut asked 20/2, 2013 at 8:58

1

Solved

I've been using the System.Diagnostics.DebuggerStepThrough attribute to skip code when working in Visual Studio Debugger. However, there are times when I want it to also skip any methods that are c...
Calvin asked 31/12, 2018 at 18:17

2

I have a .net core web api project. I am simply trying to get my trace statements like below to appear in app insights: Trace.TraceInformation("Hello World!"); I see the log in my output window ...

© 2022 - 2024 — McMap. All rights reserved.