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

Application Insights Not showing Trace.TraceInformation messages

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 when I am debugging, but after I deploy, I am not…
5
votes
2 answers

Mocking a TraceListener with Moq

Why does the Moq Verify fail with a "Moq.MockException : Invocation was not performed on the mock"? var mock = new Mock(); var ts = new TraceSource("traceSourceName", SourceLevels.Verbose); ts.Listeners.Add(mock.Object); var message…
Lybecker
  • 618
  • 5
  • 16
5
votes
1 answer

How to differentiate between Trace and Debug calls in a custom trace listener?

Trace.Listeners and Debug.Listeners are sharing the same internal collection thus I cannot add a trace listener to Trace.Listeners and a debug listener to Debug.Listeners to differentiate between them. How can I achieve this? Edit: Why I want to do…
Marcus
  • 1,866
  • 1
  • 20
  • 33
5
votes
1 answer

can't understand .net 2010 tracing and app.config

In my app.config I want to set 3 tracing levels (switches?): verbose, warning and none. In the debug version of the code, I want the verbose switch to be active, in the release I want warning. In special cases my application users can modify the…
vulkanino
  • 9,074
  • 7
  • 44
  • 71
5
votes
1 answer

Win32Exception: Access is denied in System.Diagnostics.ProcessManager.OpenProcess()

Firstly, I am a naive developer and have no much indepth understanding of these codes. I am getting access denied in the code block which tries to get the version number of one of the application. Scenario : There is no issue while running the code…
Avishekh Bharati
  • 1,858
  • 4
  • 27
  • 44
5
votes
6 answers

Problem launching a System.Diagnostics.Process under Windows 7

I’m trying to launch an application (Operating System, My Application and the application I want to launch are all 32 bits), from .NET 3.51. The code that launches the Process is used for other applications, but there’s one that is giving us a…
Martin Marconcini
  • 26,875
  • 19
  • 106
  • 144
5
votes
1 answer

Which trace source is used by System.Diagnostics.Trace.WriteLine?

As far as I can see, there are two ways to create trace messages in .NET. The static methods of System.Diagnostics.Trace: Trace.WriteLine("Something happened"); The instance methods of System.Diagnostics.TraceSource: var ts = new…
Heinzi
  • 167,459
  • 57
  • 363
  • 519
5
votes
1 answer

Azure Application Logging not working for my Web App

I'm having trouble getting Azure Application Logging to work with my Web app. I can successfully publish and use my web app. When I go to look at the logs, however, the "application" folder is empty. I can successfully see messages I write to the…
5
votes
1 answer

PerformanceCounter.NextValue hangs on some machines

I don't know why, but many computers hangs on following operation: void Init() { net1 = new List(); net2 = new List(); foreach (string instance in new PerformanceCounterCategory("Network…
Poma
  • 8,174
  • 18
  • 82
  • 144
5
votes
1 answer

System.Diagnostics.Tracing in Mono

I am trying to create an application in MonoDevelop 4.2.3 using assemblies I created with Visual Studio for .NET 4.5, but I get this warning: /usr/lib/mono/4.5/Microsoft.Common.targets: Warning: Reference 'System.Diagnostics.Tracing,…
vtortola
  • 34,709
  • 29
  • 161
  • 263
5
votes
0 answers

ManagementObjectSearcher.Get() throws exception

When executing the following code, the searcher.Get() throws an exception "Not Supported". Even when running as admin the problem persists. This is compiled with VS 2010. The exception happens on XP, Win7 and Win8.1. Any ideas?? …
edtheprogrammerguy
  • 5,957
  • 6
  • 28
  • 47
5
votes
4 answers

FileVersionInfo.GetVersionInfo() incorrect in Console Application

I'm getting some serious weirdness using FileVersionInfo.GetVersionInfo() and was hoping somebody might be able to help. The basics of the issue is that I am iterating through all the files in a folder calling GetVersionInfo() on each. There are…
5
votes
2 answers

C# prevent ctrl-c to child processes

I have a console application (lets call it the host) that manages several applications using System.Diagnostics.Process. The host controls the starting and stopping of these external processes. When Ctrl+C (SIGINT) is issued to the console the host…
denver
  • 2,863
  • 2
  • 31
  • 45
5
votes
1 answer

How can I attach an EventListener to an EventSource in another process?

I'm trying to attach a listener to a running process which uses an EventSource to trace processing events. I've gotten as far as creating my own listener by inheriting from EventListener and (presumably) need to call EnableEvents to begin receiving…
Paul Turner
  • 38,949
  • 15
  • 102
  • 166
5
votes
2 answers

Event Logging IPAddress does not always resolve

I am hooking the Security event log with System.Diagnostics.Eventing.Reader.EventLogWatcher class, and I am watching Event ID 4625 on a 2008 server box, for incoming failed logins (RDP, specifically). The log capturing is working fine, and I am…
asteroid
  • 755
  • 3
  • 9
  • 20