Why dotmemory can't collect memory traffic and stack trace info when try to attached to a live process

Solution 1:

It is the restriction of Microsoft profiling api. The flag COR_PRF_ENABLE_OBJECT_ALLOCATED should be set before profiled process starts.

I would recommend you to try JetBrains dotTrace in "timeline" mode if you are not able to launch your application under dotMemory. It uses ETW providers to collect memory traffic statistics, and may help you in your problem.

p.s when you use profiling api do not forget to call MemoryProfiler.EnableAllocations if you want to collect stack traces.

EDIT: Since the version 2021.3 dotMemory also supports gathering allocations data using Windows ETW, so it's possible to get it even in case of attaching the profiler to an already running process.