Reputation: 62846
I have an application with dynamic types emitted at run-time. In order to inspect the generated .NET code, we save the dynamically generated assemblies and use the Reflector.
I am wondering whether there is a way to reflect them the Reflector way while the respective process is running, without having to save the dynamic assemblies? In other words to have sort of "Attach to process ..." button in Reflector.
Thanks.
EDIT: The only raison d'etre for the feature is to reflect on dynamically generated assemblies.
Upvotes: 2
Views: 1438
Reputation: 49554
I know that you are probably looking for C# code to come out of Dynamic Assemblies, and that this question is quite old, however...
You can get at the IL of a running dynamic assembly using the Visual Studio Immediate window or using WinDbg. (You must use WinDbg if you are debugging a 64-bit process, since Visual Studio is still a 32-bit product.)
!load SOS.dll
or simply !load SOS
.
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\SOS.dll
~
command and the ~n s
command. Use ~
to list all threads and use ~n s
command to switch. For example, use ~12 s
to switch to thread number 12.!clrstack
!ip2md [address]
0123456
, you would issue the command !ip2md 0123456
.!dumpil [method descriptor]
as the address of the method descriptor, you would issue the command
!dumpil 0A1B2C3D`.That should allow you to see into the Dynamic Assembly, albeit in IL assembly.
Upvotes: 2
Reputation: 20992
There is a running assembly add-in for Reflector (http://weblogs.asp.net/kdente/articles/438539.aspx). However, I suspect that it simply helps retrieve paths for running assemblies, with the assemblies subsequently loaded from disk by Reflector. However, it's probably worth a try. Also, creating reflector add-ins isn't all that difficult, so you might be able to extend the running assembly add-in approach to automatically save the assembly to disk so that it can be loaded by Reflector (assuming the existing add-in doesn't already do this.)
Upvotes: -1