0

There is a system composed of an ASP.NET web application, .NET windows services and shared .NET libraries. It has large number of classes, each containing multiple methods.

How to conveniently collect runtime data about execution of methods without having to modify each single class and method? The goal is to register execution of all the methods that are part of the system (except .NET Framework classes). The purpose of collecting this data is to learn what features of the system are never used by the users. We already performed static code analysis as well as eliminated pages that were never displayed based on IIS logs.

  • Sounds like you're looking for a profiler. Check out: [this](https://learn.microsoft.com/en-us/visualstudio/profiling/beginners-guide-to-performance-profiling?view=vs-2017) and [this](https://stackoverflow.com/questions/3927/what-are-some-good-net-profilers). I like [dotTrace](https://www.jetbrains.com/profiler/) – Christo Feb 07 '19 at 22:15

1 Answers1

0

You could use post-compilation tools to instrument your code with the necessary logging mechanisms in order to collect necessary data. There are existing tools that you could use such as PostSharp or Fody.Tracer.

Alternatively, if those tools are for some reason not the exact what you need, you could write your own post-compilation weaver. This can be done by using Mono.Cecil library. With this library you would be able to take your compiled assemblies, instrument them with the logging code only in places you think is necessary and then collect and analyse the logs.

Paweł Łukasik
  • 3,893
  • 1
  • 24
  • 36