Note that there are some explanatory texts on larger screens.

plurals
  1. POProfiling a dynamic pinvoke
    text
    copied!<p>I am working on MSIL profiler and encountered problems with <code>ManagedToUnmanagedTransition</code> and <code>UnmanagedToManagedTransition</code> callbacks of <code>ICorProfilerCallback</code> interface.</p> <p>What I want to retrieve is an information about method being called (name and module name it resides in).</p> <p>So far it was working fine. Until so called dynamic pinvoke occured (described in detail at: <a href="http://blogs.msdn.com/b/jonathanswift/archive/2006/10/03/dynamically-calling-an-unmanaged-dll-from-.net-_2800_c_23002900_.aspx" rel="noreferrer">http://blogs.msdn.com/b/jonathanswift/archive/2006/10/03/dynamically-calling-an-unmanaged-dll-from-.net-_2800_c_23002900_.aspx</a>)</p> <p>In this scenario <code>IMetaDataImport::GetPinvokeMap</code> fails. Also <code>IMetaDataAssemblyImport::GetAssemblyProps</code> returns "dynamic_pinvoke" as a name of the assembly.</p> <pre><code>profiler_1_0-&gt;GetTokenAndMetaDataFromFunction(function_id, IID_IMetaDataImport, (IUnknown**) &amp;imd_import, &amp;md_token); imd_import-&gt;GetPinvokeMap(md_token, &amp;mapping, module_name, buffer_size, &amp;chars_read, &amp;md_module_ref); // here the fail occurs profiler_1_0-&gt;GetTokenAndMetaDataFromFunction(function_id, IID_IMetaDataAssemblyImport, (IUnknown**) &amp;imd_assembly_import, &amp;md_token); imd_assembly_import-&gt;GetAssemblyFromScope(&amp;md_assembly); imd_assembly_import-&gt;GetAssemblyProps(md_assembly, 0, 0, 0, assembly_name, buffer_size, &amp;chars_read, 0, 0); // assembly_name is set to "dynamic_pinvoke" </code></pre> <p>How to obtain a module name (.dll) and a name of function being pinvoked through dynamic pinvoke?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload