예제 #1
0
 public ModuleState(CorModuleDefFile corModuleDefFile, ModuleDocumentNode moduleNode, HashSet <uint> modifiedTypes, HashSet <uint> loadClassHash)
 {
     CorModuleDefFile = corModuleDefFile;
     ModuleNode       = moduleNode;
     ModifiedTypes    = modifiedTypes;
     LoadClassHash    = loadClassHash;
 }
예제 #2
0
 public ModuleState(CorModuleDefFile corModuleDefFile, AssemblyTreeNode moduleNode, HashSet <uint> modifiedTypes, HashSet <uint> loadClassHash)
 {
     this.CorModuleDefFile = corModuleDefFile;
     this.ModuleNode       = moduleNode;
     this.ModifiedTypes    = modifiedTypes;
     this.LoadClassHash    = loadClassHash;
 }
예제 #3
0
        public static CorModuleDefFile CreateAssembly(List <CorModuleDefFile> files)
        {
            var manifest = files[0];
            var file     = new CorModuleDefFile(manifest.DnModule, false);

            file.files = new List <CorModuleDefFile>(files);
            return(file);
        }
예제 #4
0
		public TreeViewUpdater(CorModuleDefFile cmdf, AssemblyTreeNode node, HashSet<uint> modifiedTypes, HashSet<uint> loadedClassTokens) {
			Debug.Assert(node.DnSpyFile == cmdf);
			this.CorModuleDefFile = cmdf;
			this.ModuleNode = node;
			this.modifiedTypes = new HashSet<uint>(modifiedTypes);
			this.loadedClassTokens = loadedClassTokens;
			this.checkedTypes = new HashSet<TypeDef>();
			this.modNode = node;
		}
예제 #5
0
        IDnSpyFile LoadDynamic(DnModule dnModule, bool canLoadDynFile)
        {
            var file = FindDynamic(dnModule);

            if (file != null)
            {
                return(file);
            }

            if (dnModule.Debugger.ProcessState != DebuggerProcessState.Stopped)
            {
                return(null);
            }
            if (!canLoadDynFile)
            {
                return(null);
            }

            var manifestDnModule = dnModule.Assembly.Modules[0];
            var manifestKey      = CorModuleDefFile.CreateKey(manifestDnModule);
            var manMod           = FindAssemblyByKey(manifestKey);

            Debug.Assert(manMod == null);
            if (manMod != null)
            {
                return(null);
            }

            manMod = FindDynamic(manifestDnModule);
            Debug.Assert(manMod == null);
            if (manMod != null)
            {
                return(null);
            }

            var modules = manifestDnModule.Assembly.Modules;
            var dict    = new Dictionary <ModuleDef, CorModuleDefFile>(modules.Length);
            var files   = new List <CorModuleDefFile>(modules.Length);

            foreach (var module in modules)
            {
                UpdateResolver(module.GetOrCreateCorModuleDef());
                var newFile = new CorModuleDefFile(module, UseDebugSymbols);
                dict.Add(module.GetOrCreateCorModuleDef(), newFile);
                files.Add(newFile);
            }
            Debug.Assert(files.Count != 0);
            Initialize(dnModule.Debugger, dict.Select(a => a.Value.DnModule.CorModuleDef));

            var asmFile   = CorModuleDefFile.CreateAssembly(files);
            var addedFile = fileManager.GetOrAdd(asmFile);

            Debug.Assert(addedFile == asmFile);

            return(dict[dnModule.CorModuleDef]);
        }
예제 #6
0
		public TreeViewUpdater(IDocumentTabService documentTabService, CorModuleDefFile cmdf, ModuleDocumentNode node, HashSet<uint> modifiedTypes, HashSet<uint> loadedClassTokens) {
			Debug.Assert(node.Document == cmdf);
			this.documentTabService = documentTabService;
			CorModuleDefFile = cmdf;
			ModuleNode = node;
			this.modifiedTypes = new HashSet<uint>(modifiedTypes);
			this.loadedClassTokens = loadedClassTokens;
			checkedTypes = new HashSet<TypeDef>();
			modNode = node;
		}
예제 #7
0
 public TreeViewUpdater(CorModuleDefFile cmdf, AssemblyTreeNode node, HashSet <uint> modifiedTypes, HashSet <uint> loadedClassTokens)
 {
     Debug.Assert(node.DnSpyFile == cmdf);
     this.CorModuleDefFile  = cmdf;
     this.ModuleNode        = node;
     this.modifiedTypes     = new HashSet <uint>(modifiedTypes);
     this.loadedClassTokens = loadedClassTokens;
     this.checkedTypes      = new HashSet <TypeDef>();
     this.modNode           = node;
 }
예제 #8
0
 public TreeViewUpdater(IDocumentTabService documentTabService, CorModuleDefFile cmdf, ModuleDocumentNode node, HashSet <uint> modifiedTypes, HashSet <uint> loadedClassTokens)
 {
     Debug.Assert(node.Document == cmdf);
     this.documentTabService = documentTabService;
     CorModuleDefFile        = cmdf;
     ModuleNode             = node;
     this.modifiedTypes     = new HashSet <uint>(modifiedTypes);
     this.loadedClassTokens = loadedClassTokens;
     checkedTypes           = new HashSet <TypeDef>();
     modNode = node;
 }
예제 #9
0
        DnSpyFile LoadDynamic(DnModule dnModule, bool canLoadDynFile)
        {
            var file = FindDynamic(dnModule);

            if (file != null)
            {
                return(file);
            }

            if (DebugManager.Instance.ProcessState != DebuggerProcessState.Stopped)
            {
                return(null);
            }
            if (!canLoadDynFile)
            {
                return(null);
            }

            var manifestDnModule = dnModule.Assembly.Modules[0];
            var manifestKey      = CorModuleDefFile.CreateKey(manifestDnModule);
            var manMod           = FindAssemblyByKey(manifestKey);

            Debug.Assert(manMod == null);
            if (manMod != null)
            {
                return(null);
            }

            manMod = FindDynamic(manifestDnModule);
            Debug.Assert(manMod == null);
            if (manMod != null)
            {
                return(null);
            }

            var modules = manifestDnModule.Assembly.Modules;
            var dict    = new Dictionary <ModuleDef, CorModuleDefFile>(modules.Length);

            foreach (var module in modules)
            {
                UpdateResolver(module.GetOrCreateCorModuleDef());
                dict.Add(module.GetOrCreateCorModuleDef(), new CorModuleDefFile(dict, module, UseDebugSymbols));
            }
            Initialize(dict.Select(a => a.Value.DnModule.CorModuleDef));

            manMod = dict[manifestDnModule.CorModuleDef];
            DnSpyFileList.AddFile(manMod, true, true, false);

            return(dict[dnModule.CorModuleDef]);
        }
예제 #10
0
		void OnModuleAdded(DnModule module) {
			// If an assembly is visible in the treeview, and a new netmodule gets added, add a
			// new netmodule node to the assembly in the treeview.

			var manifestModule = module.Assembly.Modules[0];

			// If it's the manifest module, it can't possibly have been inserted in the treeview already
			if (manifestModule == module)
				return;

			// Update a dynamic assembly, if one exists
			{
				var manifestKey = CorModuleDefFile.CreateKey(manifestModule);
				var manifestFile = FindAssemblyByKey(manifestKey);
				var manifestNode = DnSpyFileListTreeNode.FindAssemblyNode(manifestFile);
				if (manifestNode != null) {
					var cmdf = (CorModuleDefFile)manifestFile;
					var moduleKey = CorModuleDefFile.CreateKey(module);
					manifestNode.EnsureChildrenFiltered();
					Debug.Assert(manifestNode.Children.Count >= 1);
					var moduleNode = manifestNode.Children.OfType<AssemblyTreeNode>().FirstOrDefault(a => moduleKey.Equals(a.DnSpyFile.Key));
					Debug.Assert(moduleNode == null);
					if (moduleNode == null) {
						var newFile = new CorModuleDefFile(cmdf.Dictionary, module, UseDebugSymbols);
						UpdateResolver(module.GetOrCreateCorModuleDef());
						cmdf.Dictionary.Add(newFile.ModuleDef, newFile);
						Initialize(new[] { newFile.DnModule.CorModuleDef });
						manifestNode.Children.Add(new AssemblyTreeNode(newFile));
					}
				}
			}

			// Update an in-memory assembly, if one exists
			if (manifestModule.Address != 0 && module.Address != 0) {
				var manifestKey = MemoryModuleDefFile.CreateKey(manifestModule.Process, manifestModule.Address);
				var manifestFile = FindAssemblyByKey(manifestKey);
				var manifestNode = DnSpyFileListTreeNode.FindAssemblyNode(manifestFile);
				if (manifestNode != null) {
					var mmdf = (MemoryModuleDefFile)manifestFile;
					var moduleKey = MemoryModuleDefFile.CreateKey(module.Process, module.Address);
					manifestNode.EnsureChildrenFiltered();
					Debug.Assert(manifestNode.Children.Count >= 1);
					var moduleNode = manifestNode.Children.OfType<AssemblyTreeNode>().FirstOrDefault(a => moduleKey.Equals(a.DnSpyFile.Key));
					Debug.Assert(moduleNode == null);
					if (moduleNode == null) {
						MemoryModuleDefFile newFile = null;
						try {
							newFile = MemoryModuleDefFile.Create(mmdf.Dictionary, module, UseDebugSymbols);
						}
						catch {
						}

						Debug.Assert(newFile != null);
						if (newFile != null) {
							UpdateResolver(newFile.ModuleDef);
							mmdf.Dictionary.Add(newFile.ModuleDef, newFile);
							manifestNode.DnSpyFile.ModuleDef.Assembly.Modules.Add(newFile.ModuleDef);
							manifestNode.Children.Add(new AssemblyTreeNode(newFile));
						}
					}
				}
			}
		}
예제 #11
0
        void OnModuleAdded(DnModule module)
        {
            // If an assembly is visible in the treeview, and a new netmodule gets added, add a
            // new netmodule node to the assembly in the treeview.

            var manifestModule = module.Assembly.Modules[0];

            // If it's the manifest module, it can't possibly have been inserted in the treeview already
            if (manifestModule == module)
            {
                return;
            }

            // Update a dynamic assembly, if one exists
            {
                var manifestKey = CorModuleDefFile.CreateKey(manifestModule);
                var asmFile     = FindAssemblyByKey(manifestKey);
                var asmNode     = fileTreeView.FindNode(asmFile) as IAssemblyFileNode;
                if (asmNode != null)
                {
                    var cmdf      = (CorModuleDefFile)asmNode.DnSpyFile;
                    var moduleKey = CorModuleDefFile.CreateKey(module);
                    asmNode.TreeNode.EnsureChildrenLoaded();
                    Debug.Assert(asmNode.TreeNode.Children.Count >= 1);
                    var moduleNode = asmNode.TreeNode.DataChildren.OfType <IModuleFileNode>().FirstOrDefault(a => moduleKey.Equals(a.DnSpyFile.Key));
                    Debug.Assert(moduleNode == null);
                    if (moduleNode == null)
                    {
                        var newFile = new CorModuleDefFile(module, UseDebugSymbols);
                        UpdateResolver(module.GetOrCreateCorModuleDef());
                        cmdf.Children.Add(newFile);
                        Initialize(module.Debugger, new[] { newFile.DnModule.CorModuleDef });
                        asmNode.TreeNode.Children.Add(fileTreeView.TreeView.Create(fileTreeView.CreateNode(asmNode, newFile)));
                    }
                }
            }

            // Update an in-memory assembly, if one exists
            if (manifestModule.Address != 0 && module.Address != 0)
            {
                var manifestKey = MemoryModuleDefFile.CreateKey(manifestModule.Process, manifestModule.Address);
                var asmFile     = FindAssemblyByKey(manifestKey);
                var asmNode     = fileTreeView.FindNode(asmFile) as IAssemblyFileNode;
                if (asmNode != null)
                {
                    var mmdf      = (MemoryModuleDefFile)asmNode.DnSpyFile;
                    var moduleKey = MemoryModuleDefFile.CreateKey(module.Process, module.Address);
                    asmNode.TreeNode.EnsureChildrenLoaded();
                    Debug.Assert(asmNode.TreeNode.Children.Count >= 1);
                    var moduleNode = asmNode.TreeNode.DataChildren.OfType <IModuleFileNode>().FirstOrDefault(a => moduleKey.Equals(a.DnSpyFile.Key));
                    Debug.Assert(moduleNode == null);
                    if (moduleNode == null)
                    {
                        MemoryModuleDefFile newFile = null;
                        try {
                            newFile = MemoryModuleDefFile.Create(module, UseDebugSymbols);
                        }
                        catch {
                        }

                        Debug.Assert(newFile != null);
                        if (newFile != null)
                        {
                            UpdateResolver(newFile.ModuleDef);
                            mmdf.Children.Add(newFile);
                            asmNode.DnSpyFile.ModuleDef.Assembly.Modules.Add(newFile.ModuleDef);
                            asmNode.TreeNode.Children.Add(fileTreeView.TreeView.Create(fileTreeView.CreateNode(asmNode, newFile)));
                        }
                    }
                }
            }
        }
예제 #12
0
        HashSet <uint> GetModifiedTypesList(CorModuleDefFile cmdf)
        {
            var hash = new HashSet <uint>();

            var oldLastValid = cmdf.UpdateLastValidRids();
            var lastValid    = cmdf.LastValidRids;

            if (oldLastValid.Equals(lastValid))
            {
                return(hash);
            }

            const uint TYPEDEF_TOKEN = 0x02000000;

            // Optimization if we loaded a big file
            if (oldLastValid.TypeDefRid == 0)
            {
                for (uint rid = 1; rid <= lastValid.TypeDefRid; rid++)
                {
                    hash.Add(TYPEDEF_TOKEN + rid);
                }
                return(hash);
            }

            var cmd = cmdf.DnModule.CorModuleDef;

            Debug.Assert(cmd != null);

            var methodRids = new HashSet <uint>();
            var gpRids     = new HashSet <uint>();

            for (uint rid = oldLastValid.TypeDefRid + 1; rid <= lastValid.TypeDefRid; rid++)
            {
                hash.Add(TYPEDEF_TOKEN + rid);
            }
            for (uint rid = oldLastValid.FieldRid + 1; rid <= lastValid.FieldRid; rid++)
            {
                var typeOwner = cmd.GetFieldOwnerToken(rid);
                if (typeOwner.Rid != 0)
                {
                    hash.Add(typeOwner.Raw);
                }
            }
            for (uint rid = oldLastValid.MethodRid + 1; rid <= lastValid.MethodRid; rid++)
            {
                methodRids.Add(rid);
                var typeOwner = cmd.GetMethodOwnerToken(rid);
                if (typeOwner.Rid != 0)
                {
                    hash.Add(typeOwner.Raw);
                }
            }
            for (uint rid = oldLastValid.ParamRid + 1; rid <= lastValid.ParamRid; rid++)
            {
                var methodOwner = cmd.GetParamOwnerToken(rid);
                if (methodRids.Contains(methodOwner.Rid))
                {
                    continue;
                }
                var typeOwner = cmd.GetMethodOwnerToken(methodOwner.Rid);
                if (typeOwner.Rid != 0)
                {
                    hash.Add(typeOwner.Raw);
                }
            }
            for (uint rid = oldLastValid.EventRid + 1; rid <= lastValid.EventRid; rid++)
            {
                var typeOwner = cmd.GetEventOwnerToken(rid);
                if (typeOwner.Rid != 0)
                {
                    hash.Add(typeOwner.Raw);
                }
            }
            for (uint rid = oldLastValid.PropertyRid + 1; rid <= lastValid.PropertyRid; rid++)
            {
                var typeOwner = cmd.GetPropertyOwnerToken(rid);
                if (typeOwner.Rid != 0)
                {
                    hash.Add(typeOwner.Raw);
                }
            }
            for (uint rid = oldLastValid.GenericParamRid + 1; rid <= lastValid.GenericParamRid; rid++)
            {
                gpRids.Add(rid);
                var     ownerToken = cmd.GetGenericParamOwnerToken(rid);
                MDToken typeOwner;
                if (ownerToken.Table == Table.TypeDef)
                {
                    typeOwner = ownerToken;
                }
                else if (ownerToken.Table == Table.Method)
                {
                    if (methodRids.Contains(ownerToken.Rid))
                    {
                        continue;
                    }
                    typeOwner = cmd.GetMethodOwnerToken(ownerToken.Rid);
                }
                else
                {
                    continue;
                }
                if (typeOwner.Rid != 0)
                {
                    hash.Add(typeOwner.Raw);
                }
            }
            for (uint rid = oldLastValid.GenericParamConstraintRid + 1; rid <= lastValid.GenericParamConstraintRid; rid++)
            {
                var gpOwner = cmd.GetGenericParamConstraintOwnerToken(rid);
                if (gpRids.Contains(gpOwner.Rid))
                {
                    continue;
                }
                var     ownerToken = cmd.GetGenericParamOwnerToken(gpOwner.Rid);
                MDToken typeOwner;
                if (ownerToken.Table == Table.TypeDef)
                {
                    typeOwner = ownerToken;
                }
                else if (ownerToken.Table == Table.Method)
                {
                    if (methodRids.Contains(ownerToken.Rid))
                    {
                        continue;
                    }
                    typeOwner = cmd.GetMethodOwnerToken(ownerToken.Rid);
                }
                else
                {
                    continue;
                }
                if (typeOwner.Rid != 0)
                {
                    hash.Add(typeOwner.Raw);
                }
            }

            return(hash);
        }
예제 #13
0
		IDnSpyFile LoadDynamic(DnModule dnModule, bool canLoadDynFile) {
			var file = FindDynamic(dnModule);
			if (file != null)
				return file;

			if (dnModule.Debugger.ProcessState != DebuggerProcessState.Paused)
				return null;
			if (!canLoadDynFile)
				return null;

			var manifestDnModule = dnModule.Assembly.Modules[0];
			var manifestKey = CorModuleDefFile.CreateKey(manifestDnModule);
			var manMod = FindAssemblyByKey(manifestKey);
			Debug.Assert(manMod == null);
			if (manMod != null)
				return null;

			manMod = FindDynamic(manifestDnModule);
			Debug.Assert(manMod == null);
			if (manMod != null)
				return null;

			var modules = manifestDnModule.Assembly.Modules;
			var dict = new Dictionary<ModuleDef, CorModuleDefFile>(modules.Length);
			var files = new List<CorModuleDefFile>(modules.Length);
			foreach (var module in modules) {
				UpdateResolver(module.GetOrCreateCorModuleDef());
				var newFile = new CorModuleDefFile(module, UseDebugSymbols);
				dict.Add(module.GetOrCreateCorModuleDef(), newFile);
				files.Add(newFile);
			}
			Debug.Assert(files.Count != 0);
			Initialize(dnModule.Debugger, dict.Select(a => a.Value.DnModule.CorModuleDef));

			var asmFile = CorModuleDefFile.CreateAssembly(files);
			var addedFile = fileManager.GetOrAdd(asmFile);
			Debug.Assert(addedFile == asmFile);

			return dict[dnModule.CorModuleDef];
		}
예제 #14
0
			public ModuleState(CorModuleDefFile corModuleDefFile, ModuleDocumentNode moduleNode, HashSet<uint> modifiedTypes, HashSet<uint> loadClassHash) {
				CorModuleDefFile = corModuleDefFile;
				ModuleNode = moduleNode;
				ModifiedTypes = modifiedTypes;
				LoadClassHash = loadClassHash;
			}
예제 #15
0
		public static CorModuleDefFile CreateAssembly(List<CorModuleDefFile> files) {
			var manifest = files[0];
			var file = new CorModuleDefFile(manifest.DnModule, false);
			file.files = new List<CorModuleDefFile>(files);
			return file;
		}
예제 #16
0
		HashSet<uint> GetModifiedTypesList(CorModuleDefFile cmdf) {
			var hash = new HashSet<uint>();

			var oldLastValid = cmdf.UpdateLastValidRids();
			var lastValid = cmdf.LastValidRids;
			if (oldLastValid.Equals(lastValid))
				return hash;

			const uint TYPEDEF_TOKEN = 0x02000000;

			// Optimization if we loaded a big file
			if (oldLastValid.TypeDefRid == 0) {
				for (uint rid = 1; rid <= lastValid.TypeDefRid; rid++)
					hash.Add(TYPEDEF_TOKEN + rid);
				return hash;
			}

			var cmd = cmdf.DnModule.CorModuleDef;
			Debug.Assert(cmd != null);

			var methodRids = new HashSet<uint>();
			var gpRids = new HashSet<uint>();
			for (uint rid = oldLastValid.TypeDefRid + 1; rid <= lastValid.TypeDefRid; rid++)
				hash.Add(TYPEDEF_TOKEN + rid);
			for (uint rid = oldLastValid.FieldRid + 1; rid <= lastValid.FieldRid; rid++) {
				var typeOwner = cmd.GetFieldOwnerToken(rid);
				if (typeOwner.Rid != 0)
					hash.Add(typeOwner.Raw);
			}
			for (uint rid = oldLastValid.MethodRid + 1; rid <= lastValid.MethodRid; rid++) {
				methodRids.Add(rid);
				var typeOwner = cmd.GetMethodOwnerToken(rid);
				if (typeOwner.Rid != 0)
					hash.Add(typeOwner.Raw);
			}
			for (uint rid = oldLastValid.ParamRid + 1; rid <= lastValid.ParamRid; rid++) {
				var methodOwner = cmd.GetParamOwnerToken(rid);
				if (methodRids.Contains(methodOwner.Rid))
					continue;
				var typeOwner = cmd.GetMethodOwnerToken(methodOwner.Rid);
				if (typeOwner.Rid != 0)
					hash.Add(typeOwner.Raw);
			}
			for (uint rid = oldLastValid.EventRid + 1; rid <= lastValid.EventRid; rid++) {
				var typeOwner = cmd.GetEventOwnerToken(rid);
				if (typeOwner.Rid != 0)
					hash.Add(typeOwner.Raw);
			}
			for (uint rid = oldLastValid.PropertyRid + 1; rid <= lastValid.PropertyRid; rid++) {
				var typeOwner = cmd.GetPropertyOwnerToken(rid);
				if (typeOwner.Rid != 0)
					hash.Add(typeOwner.Raw);
			}
			for (uint rid = oldLastValid.GenericParamRid + 1; rid <= lastValid.GenericParamRid; rid++) {
				gpRids.Add(rid);
				var ownerToken = cmd.GetGenericParamOwnerToken(rid);
				MDToken typeOwner;
				if (ownerToken.Table == Table.TypeDef)
					typeOwner = ownerToken;
				else if (ownerToken.Table == Table.Method) {
					if (methodRids.Contains(ownerToken.Rid))
						continue;
					typeOwner = cmd.GetMethodOwnerToken(ownerToken.Rid);
				}
				else
					continue;
				if (typeOwner.Rid != 0)
					hash.Add(typeOwner.Raw);
			}
			for (uint rid = oldLastValid.GenericParamConstraintRid + 1; rid <= lastValid.GenericParamConstraintRid; rid++) {
				var gpOwner = cmd.GetGenericParamConstraintOwnerToken(rid);
				if (gpRids.Contains(gpOwner.Rid))
					continue;
				var ownerToken = cmd.GetGenericParamOwnerToken(gpOwner.Rid);
				MDToken typeOwner;
				if (ownerToken.Table == Table.TypeDef)
					typeOwner = ownerToken;
				else if (ownerToken.Table == Table.Method) {
					if (methodRids.Contains(ownerToken.Rid))
						continue;
					typeOwner = cmd.GetMethodOwnerToken(ownerToken.Rid);
				}
				else
					continue;
				if (typeOwner.Rid != 0)
					hash.Add(typeOwner.Raw);
			}

			return hash;
		}
예제 #17
0
			public ModuleState(CorModuleDefFile corModuleDefFile, AssemblyTreeNode moduleNode, HashSet<uint> modifiedTypes, HashSet<uint> loadClassHash) {
				this.CorModuleDefFile = corModuleDefFile;
				this.ModuleNode = moduleNode;
				this.ModifiedTypes = modifiedTypes;
				this.LoadClassHash = loadClassHash;
			}
예제 #18
0
		void OnModuleAdded(DnModule module) {
			// If an assembly is visible in the treeview, and a new netmodule gets added, add a
			// new netmodule node to the assembly in the treeview.

			var manifestModule = module.Assembly.Modules[0];

			// If it's the manifest module, it can't possibly have been inserted in the treeview already
			if (manifestModule == module)
				return;

			// Update a dynamic assembly, if one exists
			{
				var manifestKey = CorModuleDefFile.CreateKey(manifestModule);
				var asmFile = FindAssemblyByKey(manifestKey);
				var asmNode = documentTreeView.FindNode(asmFile) as AssemblyDocumentNode;
				if (asmNode != null) {
					var cmdf = (CorModuleDefFile)asmNode.Document;
					var moduleKey = CorModuleDefFile.CreateKey(module);
					asmNode.TreeNode.EnsureChildrenLoaded();
					Debug.Assert(asmNode.TreeNode.Children.Count >= 1);
					var moduleNode = asmNode.TreeNode.DataChildren.OfType<ModuleDocumentNode>().FirstOrDefault(a => moduleKey.Equals(a.Document.Key));
					Debug.Assert(moduleNode == null);
					if (moduleNode == null) {
						var newFile = new CorModuleDefFile(module, UseDebugSymbols);
						UpdateResolver(module.GetOrCreateCorModuleDef());
						cmdf.Children.Add(newFile);
						Initialize(module.Debugger, new[] { newFile.DnModule.CorModuleDef });
						asmNode.TreeNode.Children.Add(documentTreeView.TreeView.Create(documentTreeView.CreateNode(asmNode, newFile)));
					}
				}
			}

			// Update an in-memory assembly, if one exists
			if (manifestModule.Address != 0 && module.Address != 0) {
				var manifestKey = MemoryModuleDefFile.CreateKey(manifestModule.Process, manifestModule.Address);
				var asmFile = FindAssemblyByKey(manifestKey);
				var asmNode = documentTreeView.FindNode(asmFile) as AssemblyDocumentNode;
				if (asmNode != null) {
					var mmdf = (MemoryModuleDefFile)asmNode.Document;
					var moduleKey = MemoryModuleDefFile.CreateKey(module.Process, module.Address);
					asmNode.TreeNode.EnsureChildrenLoaded();
					Debug.Assert(asmNode.TreeNode.Children.Count >= 1);
					var moduleNode = asmNode.TreeNode.DataChildren.OfType<ModuleDocumentNode>().FirstOrDefault(a => moduleKey.Equals(a.Document.Key));
					Debug.Assert(moduleNode == null);
					if (moduleNode == null) {
						MemoryModuleDefFile newFile = null;
						try {
							newFile = MemoryModuleDefFile.Create(simpleProcessReader, module, UseDebugSymbols);
						}
						catch {
						}

						Debug.Assert(newFile != null);
						if (newFile != null) {
							UpdateResolver(newFile.ModuleDef);
							mmdf.Children.Add(newFile);
							RemoveFromAssembly(newFile.ModuleDef);
							asmNode.Document.ModuleDef.Assembly.Modules.Add(newFile.ModuleDef);
							asmNode.TreeNode.Children.Add(documentTreeView.TreeView.Create(documentTreeView.CreateNode(asmNode, newFile)));
						}
					}
				}
			}
		}