I have a VS 2022 ASP.Net solution with some projects in .Net Framework 4.8, some in dotnet 6.0, using multiple startup projects with some hosted in IIS Express.
The projects use Autofac dependency injection.
I’d like to profile it..
When I start Debug / Performance Profiler / tick Instrumentation
- In settings I make sure that Exclude small functions is turned off
- When starting I make sure that all my projects are ticked (to be instrumented)
The solution executes correctly, performance information is collected, but not for most of my code:
- I click around in the solution, making sure that some known code (implementing an MVC controller) is executed
- I stop collection
- In the profiler UI I switch to the Modules view
- The library implementing my controller is listed, however, performance data is only available for a single item (a static property getter), but nothing else (so not for the controller method which I know is executing, or any other code in that library for that matter).
Maybe unrelated, but I found that the debug symbol cache (configured in Tools / Options / Debugging / Symbols / Cache symbols in this directory) is populated with some .pdb symbol files, but not for this project.
I made sure that the project uses a debug build, debug symbols are generated.
I thought it may have something to do with Autofac DI and performance instrumentation clashing, so tried with CPU sampling – the result is similar.
I updated Autofac and Micorsoft.Extensions.DependenyInjection and …Abstractions to latest versions, no change.
I found https://learn.microsoft.com/en-us/visualstudio/profiling/troubleshoot-profiler-errors?view=vs-2022
, and a few others, but they didn’t help.
Can VS Performance Profiler actually work with Autofac DI or DI in general?
Any suggestions?