Example #1
0
 private static void AssertModuleDoesntContainDomains(IClrModule module, params IClrAppDomain[] domainList)
 {
     foreach (IClrAppDomain domain in domainList)
     {
         Assert.DoesNotContain(module, domain.Modules);
     }
 }
Example #2
0
        /// <summary>
        /// Reads the function name and displacement of the specified code address.
        /// </summary>
        /// <param name="address">The code address</param>
        public Tuple <string, ulong> ReadFunctionNameAndDisplacement(ulong address)
        {
            Microsoft.Diagnostics.Runtime.ClrMethod method = ClrRuntime.GetMethodByAddress(address);
            IClrModule clrModule = Provider.FromClrModule(method.Type.Module);

            return(ClrMdStackFrame.ReadFunctionNameAndDisplacement(clrModule.Module, method, address));
        }
Example #3
0
 private static void AssertModuleContainsDomains(IClrModule module, params IClrAppDomain[] domainList)
 {
     foreach (IClrAppDomain domain in domainList)
     {
         Assert.Contains(module, domain.Modules);
     }
     Assert.Equal(domainList.Length, domainList[0].Runtime.AllAppDomains.Count(ad => ad.Modules.Contains(module)));
 }
Example #4
0
        public void SystemAndSharedLibraryModulesTest()
        {
            IClrRuntime runtime = Process.Current.ClrRuntimes.Single();

            IClrAppDomain systemDomain = runtime.SystemDomain;

            Assert.Empty(systemDomain.Modules);

            IClrAppDomain sharedDomain = runtime.SharedDomain;

            Assert.Single(sharedDomain.Modules);

            IClrModule mscorlib = sharedDomain.Modules.Single();

            Assert.Equal("mscorlib.dll", Path.GetFileName(mscorlib.Module.ImageName), ignoreCase: true);
        }
Example #5
0
        public void ModuleDomainTest()
        {
            IClrRuntime runtime = Process.Current.ClrRuntimes.Single();

            IClrAppDomain appDomainExe = runtime.GetAppDomainByName("AppDomains.exe");
            IClrAppDomain nestedDomain = runtime.GetAppDomainByName("Second AppDomain");

            IClrModule mscorlib = runtime.GetModuleByFileName("mscorlib.dll");

            AssertModuleContainsDomains(mscorlib, runtime.SharedDomain, appDomainExe, nestedDomain);
            AssertModuleDoesntContainDomains(mscorlib, runtime.SystemDomain);

            IClrModule appDomainsExeModule = runtime.GetModuleByFileName("AppDomains.exe");

            AssertModuleContainsDomains(appDomainsExeModule, appDomainExe);
            AssertModuleDoesntContainDomains(appDomainsExeModule, runtime.SystemDomain, runtime.SharedDomain, nestedDomain);

            IClrModule nestedExeModule = runtime.GetModuleByFileName("NestedException.exe");

            AssertModuleContainsDomains(nestedExeModule, nestedDomain);
            AssertModuleDoesntContainDomains(nestedExeModule, runtime.SystemDomain, runtime.SharedDomain, appDomainExe);
        }
 /// <summary>
 ///     To the type of the key.
 /// </summary>
 /// <param name="module">The module.</param>
 /// <returns>DumpModuleKey.</returns>
 public static DumpModuleKey ToKeyType(this IClrModule module) =>
 new DumpModuleKey(module.AssemblyId, module.Name);