VS2015 crashes when opening .cs file

2019-08-22 20:34发布

I can open a Solution or Project in VS2015 but when I try and open (in my case) a csharp code file (.cs) Visual Studio crashes (and not in a smart way).

This is also the case when creating a new code file, such as a class.

  • Accessing the .log file yielded no errors.
  • Deleting the Component Cache did not help

Here the entry from the Event Log:

Application: devenv.exe Framework Version: v4.0.30319 Description: The application requested process termination through System.Environment.FailFast(string message). Message: System.AggregateException: One or more errors occurred. ---> System.EntryPointNotFoundException: Entry point was not found. at Microsoft.CodeAnalysis.Editor.CSharp.NavigationBar.CSharpNavigationBarItemService.GetTypesInFile(SemanticModel semanticModel, CancellationToken cancellationToken) at Microsoft.CodeAnalysis.Editor.CSharp.NavigationBar.CSharpNavigationBarItemService.d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.CodeAnalysis.Editor.CSharp.NavigationBar.CSharpNavigationBarItemService.d__1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Microsoft.CodeAnalysis.Editor.Implementation.NavigationBar.NavigationBarController.d__29.MoveNext() --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at System.Threading.Tasks.Task1.get_Result() at Microsoft.CodeAnalysis.Editor.Implementation.NavigationBar.NavigationBarController.<>c__DisplayClass32_0.b__0(Task1 t) at Roslyn.Utilities.TaskExtensions.<>c__DisplayClass12_12.b__1(Task _) at Roslyn.Utilities.TaskExtensions.<>c__DisplayClass6_01.<SafeContinueWith>b__0(Task t) ---> (Inner Exception #0) System.EntryPointNotFoundException: Entry point was not found. at Microsoft.CodeAnalysis.Editor.CSharp.NavigationBar.CSharpNavigationBarItemService.GetTypesInFile(SemanticModel semanticModel, CancellationToken cancellationToken) at Microsoft.CodeAnalysis.Editor.CSharp.NavigationBar.CSharpNavigationBarItemService.<GetTypesInFileAsync>d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.CodeAnalysis.Editor.CSharp.NavigationBar.CSharpNavigationBarItemService.<GetItemsAsync>d__1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Microsoft.CodeAnalysis.Editor.Implementation.NavigationBar.NavigationBarController.<ComputeModelAsync>d__29.MoveNext()<--- Stack: at System.Environment.FailFast(System.String, System.Exception) at Microsoft.CodeAnalysis.FailFast.OnFatalException(System.Exception) at Microsoft.CodeAnalysis.ErrorReporting.FatalError.Report(System.Exception, System.Action1) at Microsoft.CodeAnalysis.ErrorReporting.FatalError.ReportUnlessCanceled(System.Exception) at Roslyn.Utilities.TaskExtensions+<>c__DisplayClass6_01[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].<SafeContinueWith>b__0(System.Threading.Tasks.Task) at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean) at System.Threading.Tasks.Task1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].GetResultCore(Boolean) at System.Threading.Tasks.Task1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].get_Result() at Microsoft.CodeAnalysis.Editor.Implementation.NavigationBar.NavigationBarController+<>c__DisplayClass32_0.<StartSelectedItemUpdateTask>b__0(System.Threading.Tasks.Task1) at Roslyn.Utilities.TaskExtensions+<>c__DisplayClass12_12[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].<ContinueWithAfterDelay>b__1(System.Threading.Tasks.Task) at Roslyn.Utilities.TaskExtensions+<>c__DisplayClass6_01[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].b__0(System.Threading.Tasks.Task) at System.Threading.Tasks.ContinuationResultTaskFromTask`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].InnerInvoke() at System.Threading.Tasks.Task.Execute() at System.Threading.Tasks.Task.ExecutionContextCallback(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.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef) at System.Threading.Tasks.Task.ExecuteEntry(Boolean) at System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() at System.Threading.ThreadPoolWorkQueue.Dispatch() at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

5条回答
Ridiculous、
2楼-- · 2019-08-22 20:59

Got it!! I wanted to post my answer to this for anyone else that has this problem. I was using VS2015 Update 3.

The solution was in the Event Log error text, notably "Microsoft.CodeAnalysis.Editor.CSharp.NavigationBar".

I disabled the Navigation Bar using Tools -> Options -> Text Editor -> C# -> General and unchecked the Navigation Bar option. After loading my Solution-Project I could open the code editor.

查看更多
放我归山
3楼-- · 2019-08-22 21:05

Have you tried running the repair option on the Visual Studio 2015 installation? You can launch that from the Windows Programs and Features control panel.

{Edit}

Are you able to launch VS in safe mode? You can do that by finding the devenv.exe in the \Common7\IDE\ sub directory of where VS is installed. Open a command prompt and navigate to that directory, then run the following:

devenv.exe /safemode

If you can load a CS file while in this mode, then it maybe a 3rd party extension that is causing an issue with VS.

{/Edit}

查看更多
我想做一个坏孩纸
4楼-- · 2019-08-22 21:08

I solved this problem by clearing Visual Studio Component Model Cache.

Just delete or rename this folder (copy below url and paste it on windows explorer address path and press enter):

%LocalAppData%\Microsoft\VisualStudio\11.0\ComponentModelCache

or

%LocalAppData%\Microsoft\VPDExpress\11.0\ComponentModelCache

and restart Visual Studio.

The version of Visual Studio you have is specified by the number e.g.

Visual Studio 2012 is 11.0 (as shown above)

Visual Studio 2013 is 12.0

Visual Studio 2015 is 14.0

Visual Studio 2017 is 15.0

For those that don't know: %LocalAppData%\ is the same as C:\Users\{yourUsername}\AppData\Local

查看更多
贼婆χ
5楼-- · 2019-08-22 21:11

Make sure file permissions are consistent. If the bin or obj folders can't be accessed, Visual Studio may crash. Set file ownership and permissions in file properties -> security -> advanced.

查看更多
戒情不戒烟
6楼-- · 2019-08-22 21:19

Is it any .cs file, or specific one? What extensions do you have installed? It might be third party extension which fails.

查看更多
登录 后发表回答