How to dump memory in .net?

How do you get a memory dump from a given memory address in the format:

  Address   |           Hexadecimal representation              | ASCII representation
---------------------------------------------------------------------------------------
0x637132687 | 00 00 00 00 00 00 00 00   45 21 65 78 32 F5 12 6C |  ....... ahsnfdas
0x637132703 | 00 00 00 00 00 00 00 00   45 21 65 78 32 F5 12 6C |  ....... ahsnfdas
0x637132719 | 00 00 00 00 00 00 00 00   45 21 65 78 32 F5 12 6C |  ....... ahsnfdas
0x637132735 | 00 00 00 00 00 00 00 00   45 21 65 78 32 F5 12 6C |  ....... ahsnfdas

      

Do you know any API / framework / tool to work with?

+2


a source to share


2 answers


You will need Marshal.CopyMemory () and this code . P / Invoking VirtualQueryEx () to ensure that the memory addresses are correct, it would be a good idea to avoid exceptions.



+2


a source


This can be done using WinDbg. To be honest, I'm not a master using it, but Microsoft's Tess Ferrandes also has a great blog on using WinDbg to debug .NET applications.



You just seem to want to view a normal memory dump, it should be pretty simple. If you want to learn anything else (regarding .net), you should use the SOS extensions for WinDbg.

+1


a source







All Articles