Slow Visual Studio startup time

Use this forum to discuss and/or suggest future improvements of .NET Memory Profiler and to report bugs.

Moderator: SciTech Software

Slow Visual Studio startup time

Postby cvolzke » Mon Mar 12, 2007 2:17 am

I work for ediCargoWise international and we have over 370 dlls in our product.

SCITech Memory Profiler has either an implicit or exlicit dependency on ITypeResolutionService.GetType() which unfortunately makes it take 5 minutes to load Visual Studio. Unrelated to SciTech, we have the same slow performance when designing a form. We've found it's best to avoid calls to ITypeResolutionService for performance reasons.

When pausing, the call stack looks like this:

[Managed to Native Transition]
> mscorlib.dll!System.IO.File.FillAttributeInfo(string path = "C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\Enterprise.ZArchitectureWeb.GUI.exe", ref Microsoft.Win32.Win32Native.WIN32_FILE_ATTRIBUTE_DATA data = {Microsoft.Win32.Win32Native.WIN32_FILE_ATTRIBUTE_DATA}, bool tryagain, bool returnErrorOnNotFound = true) + 0x23a bytes
mscorlib.dll!System.IO.File.InternalExists(string path) + 0x2f bytes
mscorlib.dll!System.IO.File.Exists(string path) + 0x7f bytes
Microsoft.Build.Tasks.dll!Microsoft.Build.Tasks.SystemState.FileExists(string path = "C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\Enterprise.ZArchitectureWeb.GUI.exe") + 0x104 bytes
Microsoft.Build.Tasks.dll!Microsoft.Build.Tasks.Resolver.FileMatchesAssemblyName(Microsoft.Build.Shared.AssemblyNameExtension assemblyName = {Microsoft.Build.Shared.AssemblyNameExtension}, bool isPrimaryProjectReference = true, bool wantSpecificVersion = true, bool allowMismatchBetweenFusionNameAndFileName, string pathToCandidateAssembly = "C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\Enterprise.ZArchitectureWeb.GUI.exe", Microsoft.Build.Tasks.ResolutionSearchLocation searchLocation = {Microsoft.Build.Tasks.ResolutionSearchLocation}) + 0xe5 bytes
Microsoft.Build.Tasks.dll!Microsoft.Build.Tasks.Resolver.ResolveAsFile(string fullPath, Microsoft.Build.Shared.AssemblyNameExtension assemblyName, bool isPrimaryProjectReference, bool wantSpecificVersion, bool allowMismatchBetweenFusionNameAndFileName, System.Collections.ArrayList assembliesConsideredAndRejected = Count = Cannot evaluate expression because a native frame is on top of the call stack.) + 0x52 bytes
Microsoft.Build.Tasks.dll!Microsoft.Build.Tasks.Resolver.ResolveFromDirectory(Microsoft.Build.Shared.AssemblyNameExtension assemblyName = {Microsoft.Build.Shared.AssemblyNameExtension}, bool isPrimaryProjectReference = true, bool wantSpecificVersion = true, string[] executableExtensions = {Dimensions:[2]}, string directory = "C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\", System.Collections.ArrayList assembliesConsideredAndRejected = Count = Cannot evaluate expression because a native frame is on top of the call stack.) + 0x109 bytes
Microsoft.Build.Tasks.dll!Microsoft.Build.Tasks.FrameworkPathResolver.Resolve(Microsoft.Build.Shared.AssemblyNameExtension assemblyName = {Microsoft.Build.Shared.AssemblyNameExtension}, string rawFileNameCandidate, bool isPrimaryProjectReference = true, bool wantSpecificVersion = true, string[] executableExtensions = {Dimensions:[2]}, string hintPath, string assemblyFolderKey, System.Collections.ArrayList assembliesConsideredAndRejected = Count = Cannot evaluate expression because a native frame is on top of the call stack., out string foundPath = null, out bool userRequestedSpecificFile) + 0x4c bytes
Microsoft.Build.Tasks.dll!Microsoft.Build.Tasks.AssemblyResolution.ResolveReference(System.Collections.Generic.IEnumerable<Microsoft.Build.Tasks.Resolver[]> jaggedResolvers, Microsoft.Build.Shared.AssemblyNameExtension assemblyName = {Microsoft.Build.Shared.AssemblyNameExtension}, string rawFileNameCandidate = "Enterprise.ZArchitectureWeb.GUI, Version=2.0.0.0, Culture=neutral, PublicKeyToken=4f570df270576350, processorArchitecture=MSIL", bool isPrimaryProjectReference = true, bool wantSpecificVersion = true, string[] executableExtensions = {Dimensions:[2]}, string hintPath = "", string assemblyFolderKey = "", System.Collections.ArrayList assembliesConsideredAndRejected = Count = Cannot evaluate expression because a native frame is on top of the call stack., out string resolvedSearchPath = "", out bool userRequestedSpecificFile = false) + 0xac bytes
Microsoft.Build.Tasks.dll!Microsoft.Build.Tasks.ReferenceTable.ResolveReference(Microsoft.Build.Shared.AssemblyNameExtension assemblyName = {Microsoft.Build.Shared.AssemblyNameExtension}, string rawFileNameCandidate, Microsoft.Build.Tasks.Reference reference = {Microsoft.Build.Tasks.Reference}) + 0x1eb bytes
Microsoft.Build.Tasks.dll!Microsoft.Build.Tasks.ReferenceTable.SetPrimaryAssemblyReferenceItem(Microsoft.Build.Framework.ITaskItem referenceAssemblyName = {Microsoft.Build.BuildEngine.TaskItem}) + 0x142 bytes
Microsoft.Build.Tasks.dll!Microsoft.Build.Tasks.ReferenceTable.SetPrimaryItems(Microsoft.Build.Framework.ITaskItem[] referenceAssemblyFiles, Microsoft.Build.Framework.ITaskItem[] referenceAssemblyNames = {Dimensions:[81]}, System.Collections.ArrayList exceptions = Count = Cannot evaluate expression because a native frame is on top of the call stack.) + 0x63 bytes
Microsoft.Build.Tasks.dll!Microsoft.Build.Tasks.ResolveAssemblyReference.Execute(Microsoft.Build.Tasks.FileExists fileExists, Microsoft.Build.Tasks.DirectoryExists directoryExists, Microsoft.Build.Tasks.GetDirectories getDirectories, Microsoft.Build.Tasks.GetAssemblyName getAssemblyName, Microsoft.Build.Tasks.GetAssemblyMetadata getAssemblyMetadata, Microsoft.Build.Tasks.GetRegistrySubKeyNames getRegistrySubKeyNames, Microsoft.Build.Tasks.GetRegistrySubKeyDefaultValue getRegistrySubKeyDefaultValue, Microsoft.Build.Tasks.GetLastWriteTime getLastWriteTime) + 0x406 bytes
Microsoft.Build.Tasks.dll!Microsoft.Build.Tasks.ResolveAssemblyReference.Execute() + 0x174 bytes
Microsoft.Build.Engine.dll!Microsoft.Build.BuildEngine.TaskEngine.ExecuteTask(Microsoft.Build.BuildEngine.TaskEngine.ExecutionMode howToExecuteTask = ExecuteTaskAndGatherOutputs, System.Collections.Hashtable projectItemsAvailableToTask, Microsoft.Build.BuildEngine.BuildPropertyGroup projectPropertiesAvailableToTask, out bool taskClassWasFound = true) + 0x2c2 bytes
Microsoft.Build.Engine.dll!Microsoft.Build.BuildEngine.Target.ExecuteAllTasks(Microsoft.Build.BuildEngine.DependencyAnalysisResult howToBuild = FullBuild, System.Collections.Hashtable changedTargetInputs = null, System.Collections.Hashtable upToDateTargetInputs = null, Microsoft.Build.BuildEngine.ItemBucket bucket = {Microsoft.Build.BuildEngine.ItemBucket}, System.Collections.ArrayList taskOutputItems = Count = Cannot evaluate expression because a native frame is on top of the call stack., Microsoft.Build.BuildEngine.BuildPropertyGroup taskOutputProperties = BuildPropertyGroup (Count = Cannot evaluate expression because a native frame is on top of the call stack., Condition = Cannot evaluate expression because a native frame is on top of the call stack.)) + 0x37e bytes
Microsoft.Build.Engine.dll!Microsoft.Build.BuildEngine.Target.ExecuteAllTasks() + 0x18a bytes
Microsoft.Build.Engine.dll!Microsoft.Build.BuildEngine.Target.Build(System.Collections.IDictionary targetOutputs = null) + 0x406 bytes
Microsoft.Build.Engine.dll!Microsoft.Build.BuildEngine.Project.DoBuild(string[] targetNamesToBuild, System.Collections.IDictionary targetOutputs = null, bool fireProjectStartedFinishedEvents = true) + 0x254 bytes
Microsoft.Build.Engine.dll!Microsoft.Build.BuildEngine.Engine.BuildProject(Microsoft.Build.BuildEngine.Project project = {Microsoft.Build.BuildEngine.Project}, string[] targetNames, System.Collections.IDictionary targetOutputs, Microsoft.Build.BuildEngine.BuildSettings buildFlags, bool fireProjectStartedFinishedEvents) + 0x1ec bytes
Microsoft.Build.Engine.dll!Microsoft.Build.BuildEngine.Project.Build(string[] targetNames, System.Collections.IDictionary targetOutputs) + 0x3c bytes
Microsoft.VisualStudio.CommonIDE.dll!Microsoft.VisualStudio.Build.ComInteropWrapper.ProjectShim.BuildTargetList(string targetList, System.Collections.IDictionary targetOutputs) + 0x4c bytes
[Native to Managed Transition]
[Managed to Native Transition]
Microsoft.VisualStudio.Design.dll!Microsoft.VisualStudio.Design.VSTypeResolutionService.EnsurePopulated(bool fPopulateProject) + 0x17d bytes
Microsoft.VisualStudio.Design.dll!Microsoft.VisualStudio.Design.VSTypeResolutionService.SearchNormalEntries(System.Reflection.AssemblyName assemblyName = null, string typeName = "System.MonoType", bool ignoreTypeCase = false, out System.Reflection.Assembly assembly = null) + 0xbf bytes
Microsoft.VisualStudio.Design.dll!Microsoft.VisualStudio.Design.VSTypeResolutionService.SearchEntries(System.Reflection.AssemblyName assemblyName = null, string typeName = "System.MonoType", bool ignoreTypeCase = false, out System.Reflection.Assembly assembly = null) + 0x21 bytes
Microsoft.VisualStudio.Design.dll!Microsoft.VisualStudio.Design.VSTypeResolutionService.System.ComponentModel.Design.ITypeResolutionService.GetType(string typeName = "System.MonoType", bool throwOnError = false, bool ignoreCase) + 0x1e2 bytes
Microsoft.VisualStudio.Design.dll!Microsoft.VisualStudio.Design.VSTypeResolutionService.System.ComponentModel.Design.ITypeResolutionService.GetType(string name) + 0xa bytes
Microsoft.VisualStudio.Design.dll!Microsoft.VisualStudio.Design.VSDynamicTypeService.OnTypeResolve(object sender, System.ResolveEventArgs e) + 0x7d bytes
mscorlib.dll!System.AppDomain.OnTypeResolveEvent(string typeName = "System.MonoType") + 0x85 bytes
[Native to Managed Transition]
[Managed to Native Transition]
mscorlib.dll!System.RuntimeTypeHandle.GetTypeByName(string name, bool throwOnError, bool ignoreCase, bool reflectionOnly, ref System.Threading.StackCrawlMark stackMark) + 0x49 bytes
mscorlib.dll!System.RuntimeType.PrivateGetType(string typeName, bool throwOnError, bool ignoreCase, bool reflectionOnly, ref System.Threading.StackCrawlMark stackMark) + 0x3b bytes
mscorlib.dll!System.Type.GetType(string typeName, bool throwOnError) + 0x3a bytes
NLog.dll!NLog.Internal.PlatformDetector.FindCompatibleFrameworks() + 0x31 bytes
NLog.dll!NLog.Internal.PlatformDetector.PlatformDetector() + 0x43 bytes
[Native to Managed Transition]
[Managed to Native Transition]
NLog.dll!NLog.LayoutRendererFactory.AddLayoutRenderersFromAssembly(System.Reflection.Assembly theAssembly = {System.Reflection.Assembly}, string prefix = "") + 0xc4 bytes
NLog.dll!NLog.LayoutRendererFactory.LayoutRendererFactory() + 0x87 bytes
[Native to Managed Transition]
[Managed to Native Transition]
SciTech.Diagnostics.dll!SciTech.Diagnostics.LoggerManager.Init() + 0x24 bytes
SciTech.Diagnostics.dll!SciTech.Diagnostics.LoggerManager.GetLogger(string name = "SciTech.NetMemProfiler.VsIntegration.MemProfilerVSPackage") + 0x13 bytes
MemProfilerVSPackage.dll!SciTech.NetMemProfiler.VsIntegration.MemProfilerVSPackage.MemProfilerVSPackage() + 0xd bytes
cvolzke
 
Posts: 1
Joined: Mon Mar 12, 2007 2:13 am

Postby Andreas Suurkuusk » Mon Mar 12, 2007 9:12 am

Hi,

The call to ITypeResolutionService.GetType() is caused by a Visual Studio hook in the type resolver. Visual Studio has installed this hook in order to resolve types in the solution itself. While initiating, the profiler tries to resolve some types dynamically, which causes the hook to be called. And if you have a solution with 370 projects, I can imagine that this type resolver runs slowly.

In order to improve the performance in situations like yours, we will try to remove any dynamic type resolving. However, as you mentioned, there are other parts of Visual Studio that also resolves types dynamically (e.g the form designer), so you will probably still have a problem with slow performance in VS.
Best regards,

Andreas Suurkuusk
SciTech Software AB
Andreas Suurkuusk
 
Posts: 977
Joined: Wed Mar 02, 2005 7:53 pm
Location: Sweden


Return to Future Improvements

Who is online

Users browsing this forum: No registered users and 2 guests

SciTech Software logo

© Copyright 2001-2016. SciTech Software AB
All rights reserved.


SciTech Software AB
Kartvägen 21
SE-175 46 Järfälla
Sweden


E-mail: mail@scitech.se

Telephone: +46-706868081

cron