Skip to content

Instantly share code, notes, and snippets.

@Criteo-dotnet-blog
Created April 24, 2017 07:49
Show Gist options
  • Save Criteo-dotnet-blog/06173ca7140a165cd1b1e92dc1fab534 to your computer and use it in GitHub Desktop.
Save Criteo-dotnet-blog/06173ca7140a165cd1b1e92dc1fab534 to your computer and use it in GitHub Desktop.
private ClrModule GetMscorlib(ClrRuntime runtime)
{
    foreach (ClrModule module in runtime.Modules)
        if (module.AssemblyName.Contains("mscorlib.dll"))
            return module;
    // Uh oh, this shouldn't have happened.  Let's look more carefully (slowly).
    foreach (ClrModule module in runtime.Modules)
        if (module.AssemblyName.ToLower().Contains("mscorlib"))
            return module;
    // Ok...not sure why we couldn't find it.
    return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment