DapperTheDawg
DapperTheDawg

Reputation: 29

VS2015 crashes when opening .cs file

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.

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()

Upvotes: 0

Views: 823

Answers (5)

toha
toha

Reputation: 5507

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

Upvotes: 1

Metin Atalay
Metin Atalay

Reputation: 1517

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.

Upvotes: 0

Sudet
Sudet

Reputation: 98

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

Upvotes: 0

DapperTheDawg
DapperTheDawg

Reputation: 29

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.

Upvotes: 1

ajawad987
ajawad987

Reputation: 4672

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}

Upvotes: 0

Related Questions