dotnet / dotnet/vscode-csharp

OmniSharp crashes with System.AccessViolationException

Open
#5,251 1 comment 0 reactions 0 assignees View on GitHub
OmniSharp Razor
Dominant language
TypeScript
Stars
3.1k
Forks
737
Avg merge
17h 56m
Merged PRs (30d)
21

Description

## Issue Description ##
OmniSharp crashes with System.AccessViolationException

## Steps to Reproduce ##
Opened my .Net 6 solution folder (containing a Razor Pages project, Razor Class Library, several other class libraries and xunit projects)
Hit F5 to start debugging

## Expected Behavior ##
OmniSharp doesn't crash

## Actual Behavior ##
OmniSharp crashes with a System.AccessViolationException

## Logs ##

### OmniSharp log ###
Starting OmniSharp server at 6/4/2022, 1:19:21 AM
Target: c:\source\client\MyProjectAdminCore\MyProjectAdminCore.sln

OmniSharp server started with .NET 6.0.300
.
Path: c:\Users\burto\.vscode\extensions\ms-dotnettools.csharp-1.25.0-win32-x64\.omnisharp\1.39.0-net6.0\OmniSharp.dll
PID: 35000

[info]: OmniSharp.Stdio.Host
Starting OmniSharp on Windows 10.0.22621.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
[info]: OmniSharp.Services.DotNetCliService
Using the 'dotnet' on the PATH.
[info]: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 2 MSBuild instance(s)
1: .NET Core SDK 6.0.300 17.2.0 - "C:\Program Files\dotnet\sdk\6.0.300\"
2: .NET Core SDK 6.0.100 17.0.0 - "C:\Program Files\dotnet\sdk\6.0.100-preview.7.21379.14\"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: .NET Core SDK 6.0.300 17.2.0 - "C:\Program Files\dotnet\sdk\6.0.300\"
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.MSBuild.ProjectSystem
Detecting projects in 'c:\source\client\MyProjectAdminCore\MyProjectAdminCore.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for 'c:\source\client\MyProjectAdminCore\MyProjectAdminCore\MyProjectAdminCore.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for 'c:\source\client\MyProjectAdminCore\MyProjectTemplate\MyProjectTemplate.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for 'c:\source\client\MyProjectAdminCore\MyProject.Identity\MyProject.Identity.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for 'c:\source\client\MyProjectAdminCore\MyProject.Identity.Tests\MyProject.Identity.Tests.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for 'c:\source\client\MyProjectAdminCore\MyProjectAdminCore.Tests\MyProjectAdminCore.Tests.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for 'c:\source\client\MyProjectAdminCore\MyProjectAdmin.Common\MyProjectAdmin.Common.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for 'c:\source\client\MyProjectAdminCore\MyProjectAdmin.Common.Tests\MyProjectAdmin.Common.Tests.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in 'c:\source\client\MyProjectAdminCore'.
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: c:\source\client\MyProjectAdminCore\MyProjectAdminCore\MyProjectAdminCore.csproj
[info]: OmniSharp.Script.ScriptProjectSystem
Did not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
Configuration finished.
[info]: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location 'c:\source\client\MyProjectAdminCore' on host 23888.
[info]: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'c:\source\client\MyProjectAdminCore\MyProjectAdminCore\MyProjectAdminCore.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
Adding project 'c:\source\client\MyProjectAdminCore\MyProjectAdminCore\MyProjectAdminCore.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: c:\source\client\MyProjectAdminCore\MyProjectTemplate\MyProjectTemplate.csproj
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for 'c:\source\client\MyProjectAdminCore\MyProjectAdminCore\MyProjectAdminCore.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'c:\source\client\MyProjectAdminCore\MyProjectTemplate\MyProjectTemplate.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
Adding project 'c:\source\client\MyProjectAdminCore\MyProjectTemplate\MyProjectTemplate.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: c:\source\client\MyProjectAdminCore\MyProject.Identity\MyProject.Identity.csproj
[info]: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'c:\source\client\MyProjectAdminCore\MyProject.Identity\MyProject.Identity.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
Adding project 'c:\source\client\MyProjectAdminCore\MyProject.Identity\MyProject.Identity.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: c:\source\client\MyProjectAdminCore\MyProject.Identity.Tests\MyProject.Identity.Tests.csproj
[info]: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'c:\source\client\MyProjectAdminCore\MyProject.Identity.Tests\MyProject.Identity.Tests.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
Adding project 'c:\source\client\MyProjectAdminCore\MyProject.Identity.Tests\MyProject.Identity.Tests.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: c:\source\client\MyProjectAdminCore\MyProjectAdminCore.Tests\MyProjectAdminCore.Tests.csproj
[info]: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'c:\source\client\MyProjectAdminCore\MyProjectAdminCore.Tests\MyProjectAdminCore.Tests.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
Adding project 'c:\source\client\MyProjectAdminCore\MyProjectAdminCore.Tests\MyProjectAdminCore.Tests.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: c:\source\client\MyProjectAdminCore\MyProjectAdmin.Common\MyProjectAdmin.Common.csproj
[info]: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'c:\source\client\MyProjectAdminCore\MyProjectAdmin.Common\MyProjectAdmin.Common.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
Adding project 'c:\source\client\MyProjectAdminCore\MyProjectAdmin.Common\MyProjectAdmin.Common.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: c:\source\client\MyProjectAdminCore\MyProjectAdmin.Common.Tests\MyProjectAdmin.Common.Tests.csproj
[info]: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'c:\source\client\MyProjectAdminCore\MyProjectAdmin.Common.Tests\MyProjectAdmin.Common.Tests.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
Adding project 'c:\source\client\MyProjectAdminCore\MyProjectAdmin.Common.Tests\MyProjectAdmin.Common.Tests.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Update project: MyProjectAdminCore
[info]: OmniSharp.MSBuild.ProjectManager
Update project: MyProjectTemplate
[info]: OmniSharp.MSBuild.ProjectManager
Update project: MyProject.Identity
[info]: OmniSharp.MSBuild.ProjectManager
Update project: MyProject.Identity.Tests
[info]: OmniSharp.MSBuild.ProjectManager
Update project: MyProjectAdminCore.Tests
[info]: OmniSharp.MSBuild.ProjectManager
Update project: MyProjectAdmin.Common
[info]: OmniSharp.MSBuild.ProjectManager
Update project: MyProjectAdmin.Common.Tests
[info]: OmniSharp.Roslyn.CSharp.Services.Diagnostics.CSharpDiagnosticWorkerWithAnalyzers
Solution initialized -> queue all documents for code analysis. Initial document count: 413.
[info]: OmniSharp.OmniSharpWorkspace
Miscellaneous file: c:\source\client\MyProjectAdminCore\MyProjectAdminCore\obj\Debug\net6.0\MyProjectAdminCore.MvcApplicationPartsAssemblyInfo.cs added to workspace
Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at Newtonsoft.Json.Utilities.JavaScriptUtils.WriteEscapedJavaScriptString(System.IO.TextWriter, System.String, Char, Boolean, Boolean[], Newtonsoft.Json.StringEscapeHandling, Newtonsoft.Json.IArrayPool`1, Char[] ByRef)
at Newtonsoft.Json.JsonTextWriter.WritePropertyName(System.String)
at Microsoft.CodeAnalysis.Razor.Serialization.TagHelperDescriptorJsonConverter.WriteBoundAttribute(Newtonsoft.Json.JsonWriter, Microsoft.AspNetCore.Razor.Language.BoundAttributeDescriptor, Newtonsoft.Json.JsonSerializer)
at Microsoft.CodeAnalysis.Razor.Serialization.TagHelperDescriptorJsonConverter.WriteJson(Newtonsoft.Json.JsonWriter, System.Object, Newtonsoft.Json.JsonSerializer)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeConvertable(Newtonsoft.Json.JsonWriter, Newtonsoft.Json.JsonConverter, System.Object, Newtonsoft.Json.Serialization.JsonContract, Newtonsoft.Json.Serialization.JsonContainerContract, Newtonsoft.Json.Serialization.JsonProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(Newtonsoft.Json.JsonWriter, System.Collections.IEnumerable, Newtonsoft.Json.Serialization.JsonArrayContract, Newtonsoft.Json.Serialization.JsonProperty, Newtonsoft.Json.Serialization.JsonContainerContract, Newtonsoft.Json.Serialization.JsonProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(Newtonsoft.Json.JsonWriter, System.Object, Newtonsoft.Json.Serialization.JsonObjectContract, Newtonsoft.Json.Serialization.JsonProperty, Newtonsoft.Json.Serialization.JsonContainerContract, Newtonsoft.Json.Serialization.JsonProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(Newtonsoft.Json.JsonWriter, System.Object, System.Type)
at Newtonsoft.Json.Serialization.JsonSerializerProxy.SerializeInternal(Newtonsoft.Json.JsonWriter, System.Object, System.Type)
at Newtonsoft.Json.JsonSerializer.Serialize(Newtonsoft.Json.JsonWriter, System.Object)
at Microsoft.CodeAnalysis.Razor.Workspaces.Serialization.FullProjectSnapshotHandleJsonConverter.WriteJson(Newtonsoft.Json.JsonWriter, System.Object, Newtonsoft.Json.JsonSerializer)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeConvertable(Newtonsoft.Json.JsonWriter, Newtonsoft.Json.JsonConverter, System.Object, Newtonsoft.Json.Serialization.JsonContract, Newtonsoft.Json.Serialization.JsonContainerContract, Newtonsoft.Json.Serialization.JsonProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(Newtonsoft.Json.JsonWriter, System.Object, System.Type)
at Newtonsoft.Json.Serialization.JsonSerializerProxy.SerializeInternal(Newtonsoft.Json.JsonWriter, System.Object, System.Type)
at Newtonsoft.Json.JsonSerializer.Serialize(Newtonsoft.Json.JsonWriter, System.Object)
at Microsoft.AspNetCore.Razor.OmniSharpPlugin.StrongNamed.Serialization.OmniSharpProjectSnapshotHandleJsonConverter.WriteJson(Newtonsoft.Json.JsonWriter, System.Object, Newtonsoft.Json.JsonSerializer)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeConvertable(Newtonsoft.Json.JsonWriter, Newtonsoft.Json.JsonConverter, System.Object, Newtonsoft.Json.Serialization.JsonContract, Newtonsoft.Json.Serialization.JsonContainerContract, Newtonsoft.Json.Serialization.JsonProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(Newtonsoft.Json.JsonWriter, System.Object, System.Type)
at Newtonsoft.Json.JsonSerializer.SerializeInternal(Newtonsoft.Json.JsonWriter, System.Object, System.Type)
at Newtonsoft.Json.JsonSerializer.Serialize(System.IO.TextWriter, System.Object)
at Microsoft.AspNetCore.Razor.OmniSharpPlugin.DefaultProjectChangePublisher.SerializeToFile(Microsoft.AspNetCore.Razor.OmniSharpPlugin.OmniSharpProjectSnapshot, System.String)
at Microsoft.AspNetCore.Razor.OmniSharpPlugin.DefaultProjectChangePublisher.Publish(Microsoft.AspNetCore.Razor.OmniSharpPlugin.OmniSharpProjectSnapshot)
at Microsoft.AspNetCore.Razor.OmniSharpPlugin.DefaultProjectChangePublisher+d__20.MoveNext()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.AspNetCore.Razor.OmniSharpPlugin.DefaultProjectChangePublisher+d__20, Microsoft.AspNetCore.Razor.OmniSharpPlugin, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].ExecutionContextCallback(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.AspNetCore.Razor.OmniSharpPlugin.DefaultProjectChangePublisher+d__20, Microsoft.AspNetCore.Razor.OmniSharpPlugin, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext(System.Threading.Thread)
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[[System.Threading.Tasks.VoidTaskResult, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Microsoft.AspNetCore.Razor.OmniSharpPlugin.DefaultProjectChangePublisher+d__20, Microsoft.AspNetCore.Razor.OmniSharpPlugin, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext()
at System.Threading.Tasks.TaskSchedulerAwaitTaskContinuation+<>c.b__2_0(System.Object)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef, System.Threading.Thread)
at System.Threading.Tasks.TaskScheduler.TryExecuteTask(System.Threading.Tasks.Task)
at Microsoft.CodeAnalysis.Razor.Workspaces.DefaultForegroundDispatcher+ForegroundTaskScheduler.ThreadStart()
at System.Threading.Thread.StartCallback()

### C# log ###
C# log is empty

## Environment information ##

**VSCode version**: 1.67.2
**C# Extension**: 1.25.0

Dotnet Information
.NET SDK (reflecting any global.json):
Version: 6.0.300
Commit: 8473146e7d

Runtime Environment:
OS Name: Windows
OS Version: 10.0.22621
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.300\

Host (useful for support):
Version: 6.0.5
Commit: 70ae3df4a6

.NET SDKs installed:
5.0.200-preview.20601.7 [C:\Program Files\dotnet\sdk]
6.0.100-preview.7.21379.14 [C:\Program Files\dotnet\sdk]
6.0.300 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.7.21378.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-preview.7.21377.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 5.0.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.0-preview.7.21378.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download

Visual Studio Code Extensions

|Extension|Author|Version|
|---|---|---|
|auto-rename-tag|formulahendry|0.1.10|
|azure-account|ms-vscode|0.10.1|
|azurerm-vscode-tools|msazurermtools|0.15.7|
|blazorwasm-companion|ms-dotnettools|1.1.0|
|code-spell-checker|streetsidesoftware|2.2.0|
|csharp|ms-dotnettools|1.25.0|
|debugger-for-chrome|msjsdiag|4.13.0|
|debugger-for-edge|msjsdiag|1.0.15|
|dotnet-test-explorer|formulahendry|0.7.7|
|dotnetwatchattach|Trottero|0.2.1|
|EditorConfig|EditorConfig|0.16.4|
|gitlens|eamodio|12.0.7|
|libman|adrianwilczynski|1.0.1|
|powershell|ms-vscode|2022.5.1|
|prettier-vscode|esbenp|9.5.0|
|remote-containers|ms-vscode-remote|0.234.0|
|remote-ssh|ms-vscode-remote|0.80.0|
|remote-ssh-edit|ms-vscode-remote|0.80.0|
|remote-wsl|ms-vscode-remote|0.66.3|
|test-adapter-converter|ms-vscode|0.1.6|
|vscode-azureresourcegroups|ms-azuretools|0.5.2|
|vscode-azurestorage|ms-azuretools|0.14.1|
|vscode-docker|ms-azuretools|1.22.0|
|vscode-dotnet-runtime|ms-dotnettools|1.5.0|
|vscode-edge-devtools|ms-edgedevtools|2.0.0|
|vscode-eslint|dbaeumer|2.2.2|
|vscode-icons|vscode-icons-team|11.12.0|
|vscode-jest|Orta|4.6.0|
|vscode-sqlite|alexcvzz|0.14.0|
|vsliveshare|ms-vsliveshare|1.0.5597|;

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.