Visual Studio 2017在加载解决方案时崩溃

7

我的VS 2017经常崩溃,并在EventViewer中出现以下错误。有什么办法解决吗?

Exception Info: System.InvalidOperationException
   at System.Linq.Enumerable.Single[[System.Byte, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Collections.Generic.IEnumerable`1<Byte>)
   at System.Linq.ImmutableArrayExtensions.SingleOrDefault[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Collections.Immutable.ImmutableArray`1<System.__Canon>, System.Func`2<System.__Canon,Boolean>)
   at Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.VisualStudioProjectTracker.GetOrCreateProjectFromArgumentsAndReferences(Microsoft.VisualStudio.LanguageServices.ProjectSystem.IWorkspaceProjectContextFactory, System.String, System.Collections.Generic.IReadOnlyDictionary`2<System.String,Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.DeferredProjectInformation>, System.Collections.Generic.IReadOnlyDictionary`2<System.String,System.String>)
   at Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.VisualStudioProjectTracker.GetOrCreateProjectFromArgumentsAndReferences(Microsoft.VisualStudio.LanguageServices.ProjectSystem.IWorkspaceProjectContextFactory, System.String, System.Collections.Generic.IReadOnlyDictionary`2<System.String,Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.DeferredProjectInformation>, System.Collections.Generic.IReadOnlyDictionary`2<System.String,System.String>)
   at Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.VisualStudioProjectTracker+<PopulateWorkspaceFromDeferredProjectInfoAsync>d__86.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
   at Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.VisualStudioProjectTracker+<LoadSolutionFromMSBuildAsync>d__79.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
   at Roslyn.Utilities.TaskExtensions+<FireAndForget>d__0.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0(System.Object)
   at Microsoft.VisualStudio.Threading.JoinableTaskFactory+SingleExecuteProtector.TryExecute()
   at Microsoft.VisualStudio.Threading.JoinableTaskFactory+SingleExecuteProtector+<>c.<.cctor>b__20_0(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object)
   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)

你选择安装了哪些功能?Visual Studio 在什么时候崩溃了? - Jimmy
@Jimmy,第一次加载解决方案时它运行得很好。现在每次打开解决方案时都会崩溃。我认为这可能与在启动时打开的WPF文件有关。 - Mayank
1
如果您删除(或重命名)解决方案旁边的.vs文件夹,它应该会忘记上次打开的文件。您可以尝试这样做并查看崩溃是否仍然发生? - Jimmy
@Jimmy 应该把这个变成一个答案。删除 .vs 文件夹解决了我的问题。 - Brad M
@Jimmy,实际上只需删除.vs\SolutionName\v15文件夹即可解决此问题。不过,VS团队应该研究一下这个问题。 - Mayank
1个回答

18

解决方法: 尝试删除与您的解决方案文件相邻的.vs文件夹(默认情况下是隐藏的)。这将使VS忘记该解决方案的任何IDE设置,例如打开的文件或断点位置。如果您不想失去这些设置,请将目录移动/重命名。

提供反馈并帮助改进产品: 在应用解决方法之前,尝试捕获问题的崩溃转储。然后,使用VS中的“报告崩溃”功能或在http://connect.microsoft.com/visualstudio上提交问题。


哇。我在VS开发者社区上记录了我的问题。这个问题出现在我添加了2个.NET Core Web应用程序之后。他们标记为重复,并指向https://developercommunity.visualstudio.com/content/problem/24524/vs2017-rtw-crashing-opening-sln-after-upgrading-nu.html。解决方案是在链接中禁用WIFI,这种方法有点奏效。但我尝试了上面的答案,到目前为止100%有效。而且没有瞎搞。 - Andez
谢谢!这解决了我的问题。我猜问题的原因是因为我重命名了我的解决方案文件,所以.vs文件夹包含了两个配置,导致vs混淆了。 - Nick Dichiaro

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接