public virtual IProjectContent GetProjectContentForReference(string itemInclude, string itemFileName) { lock (contents) { IProjectContent pc = GetExistingProjectContent(itemFileName); if (pc != null) { "Loaded Code Completion Reference (from Cache): {0}".debug(itemFileName); return(pc); } //LoggingService.Debug("Loading PC for " + itemInclude); string shortName = itemInclude; int pos = shortName.IndexOf(','); //if (pos > 0) // shortName = shortName.Substring(0, pos); #if DEBUG int time = Environment.TickCount; #endif try { pc = LoadProjectContent(itemInclude, itemFileName); } catch (Exception ex) { HostCallback.ShowAssemblyLoadErrorInternal(itemFileName, itemInclude, "Error loading assembly:\n" + ex.ToString()); ex.log(); } finally { #if DEBUG LoggingService.Debug(string.Format("Loaded {0} in {1}ms", itemInclude, Environment.TickCount - time)); #endif } if (pc != null) { ReflectionProjectContent reflectionProjectContent = pc as ReflectionProjectContent; if (reflectionProjectContent != null) { reflectionProjectContent.InitializeReferences(); if (reflectionProjectContent.AssemblyFullName != null) { contents[reflectionProjectContent.AssemblyFullName] = pc; } } contents[itemInclude] = pc; contents[itemFileName] = pc; "Loaded Code Completion Reference for: {0}".info(itemFileName); } return(pc); } }
public virtual IProjectContent GetProjectContentForReference(string itemInclude, string itemFileName) { lock (contents) { IProjectContent pc = GetExistingProjectContent(itemFileName); if (pc != null) { return(pc); } LoggingService.Debug("Loading PC for " + itemInclude); string shortName = itemInclude; int pos = shortName.IndexOf(','); if (pos > 0) { shortName = shortName.Substring(0, pos); } #if DEBUG int time = Environment.TickCount; #endif try { pc = LoadProjectContent(itemInclude, itemFileName); } catch (BadImageFormatException ex) { HostCallback.ShowAssemblyLoadErrorInternal(itemFileName, itemInclude, ex.Message); } catch (Exception ex) { HostCallback.ShowError("Error loading assembly " + itemFileName, ex); } finally { #if DEBUG LoggingService.Debug(string.Format("Loaded {0} in {1}ms", itemInclude, Environment.TickCount - time)); #endif } if (pc != null) { ReflectionProjectContent reflectionProjectContent = pc as ReflectionProjectContent; if (reflectionProjectContent != null) { reflectionProjectContent.InitializeReferences(); if (reflectionProjectContent.AssemblyFullName != null) { contents[reflectionProjectContent.AssemblyFullName] = pc; } } contents[itemInclude] = pc; contents[itemFileName] = pc; } return(pc); } }