Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error [Request textDocument/formatting failed.] - when try save razor ".cshtml" #5668

Open
crmmvio opened this issue May 4, 2023 · 1 comment

Comments

@crmmvio
Copy link

crmmvio commented May 4, 2023

When try saved file .cshtml, the vscode saved the file, but generate message erro "Request textDocument/formatting failed.", my currently version C# OmmiSharp is 1.25.7

I going to come back version 1.25.2 because this work corretly.

Log:
Starting OmniSharp server at 5/4/2023, 10:32:23 AM
Target: c:\Users\moviocr1\Projetos\1859-SGK\SgkUI\SgkUI.sln

OmniSharp server started with .NET 7.0.203
.
Path: c:\Users\moviocr1.vscode\extensions\ms-dotnettools.csharp-1.25.7-win32-x64.omnisharp\1.39.6-net6.0\OmniSharp.dll
PID: 28320

Starting OmniSharp on Windows 10.0.19045.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 7.0.203 17.5.1 - "C:\Program Files\dotnet\sdk\7.0.203"
2: .NET Core SDK 6.0.408 17.3.2 - "C:\Program Files\dotnet\sdk\6.0.408"
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: .NET Core SDK 7.0.203 17.5.1 - "C:\Program Files\dotnet\sdk\7.0.203"
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
info: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in 'c:\Users\moviocr1\Projetos\1859-SGK\SgkUI'.
info: OmniSharp.Cake.CakeProjectSystem
Did not find any Cake files
info: OmniSharp.MSBuild.ProjectSystem
Detecting projects in 'c:\Users\moviocr1\Projetos\1859-SGK\SgkUI\SgkUI.sln'.
info: OmniSharp.MSBuild.ProjectManager
Queue project update for 'c:\Users\moviocr1\Projetos\1859-SGK\SgkUI\src\CBL.Sgk.Application\CBL.Sgk.Application.csproj'
info: OmniSharp.MSBuild.ProjectManager
Queue project update for 'c:\Users\moviocr1\Projetos\1859-SGK\SgkUI\src\CBL.Sgk.Infra.Data\CBL.Sgk.Infra.Data.csproj'
info: OmniSharp.MSBuild.ProjectManager
Queue project update for 'c:\Users\moviocr1\Projetos\1859-SGK\SgkUI\src\CBL.Sgk.Infra.IoC\CBL.Sgk.Infra.IoC.csproj'
info: OmniSharp.MSBuild.ProjectManager
Queue project update for 'c:\Users\moviocr1\Projetos\1859-SGK\SgkUI\src\CBL.Sgk.UI\CBL.Sgk.UI.csproj'
info: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in 'c:\Users\moviocr1\Projetos\1859-SGK\SgkUI'.
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:\Users\moviocr1\Projetos\1859-SGK\SgkUI' on host 23296.
info: OmniSharp.MSBuild.ProjectManager
Loading project: c:\Users\moviocr1\Projetos\1859-SGK\SgkUI\src\CBL.Sgk.Application\CBL.Sgk.Application.csproj
info: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'c:\Users\moviocr1\Projetos\1859-SGK\SgkUI\src\CBL.Sgk.Application\CBL.Sgk.Application.csproj'.
info: OmniSharp.MSBuild.ProjectManager
Adding project 'c:\Users\moviocr1\Projetos\1859-SGK\SgkUI\src\CBL.Sgk.Application\CBL.Sgk.Application.csproj'
[fail]: OmniSharp.MSBuild.ProjectManager
Failed to add project to workspace: 'c:\Users\moviocr1\Projetos\1859-SGK\SgkUI\src\CBL.Sgk.Application\CBL.Sgk.Application.csproj'
info: OmniSharp.MSBuild.ProjectManager
Loading project: c:\Users\moviocr1\Projetos\1859-SGK\SgkUI\src\CBL.Sgk.Infra.Data\CBL.Sgk.Infra.Data.csproj
info: OmniSharp.OmniSharpWorkspace
Miscellaneous file: c:\Users\moviocr1\Projetos\1859-SGK\SgkUI\src\CBL.Sgk.UI\Views\Shared_NavMenu.cshtml__virtual.cs added to workspace
info: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'c:\Users\moviocr1\Projetos\1859-SGK\SgkUI\src\CBL.Sgk.Infra.Data\CBL.Sgk.Infra.Data.csproj'.
info: OmniSharp.MSBuild.ProjectManager
Adding project 'c:\Users\moviocr1\Projetos\1859-SGK\SgkUI\src\CBL.Sgk.Infra.Data\CBL.Sgk.Infra.Data.csproj'
info: OmniSharp.MSBuild.ProjectManager
Loading project: c:\Users\moviocr1\Projetos\1859-SGK\SgkUI\src\CBL.Sgk.Infra.IoC\CBL.Sgk.Infra.IoC.csproj
info: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'c:\Users\moviocr1\Projetos\1859-SGK\SgkUI\src\CBL.Sgk.Infra.IoC\CBL.Sgk.Infra.IoC.csproj'.
info: OmniSharp.MSBuild.ProjectManager
Adding project 'c:\Users\moviocr1\Projetos\1859-SGK\SgkUI\src\CBL.Sgk.Infra.IoC\CBL.Sgk.Infra.IoC.csproj'
info: OmniSharp.MSBuild.ProjectManager
Loading project: c:\Users\moviocr1\Projetos\1859-SGK\SgkUI\src\CBL.Sgk.UI\CBL.Sgk.UI.csproj
info: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'c:\Users\moviocr1\Projetos\1859-SGK\SgkUI\src\CBL.Sgk.UI\CBL.Sgk.UI.csproj'.
info: OmniSharp.MSBuild.ProjectManager
Adding project 'c:\Users\moviocr1\Projetos\1859-SGK\SgkUI\src\CBL.Sgk.UI\CBL.Sgk.UI.csproj'
[fail]: OmniSharp.MSBuild.ProjectManager
Could not locate project in workspace: c:\Users\moviocr1\Projetos\1859-SGK\SgkUI\src\CBL.Sgk.Application\CBL.Sgk.Application.csproj
info: OmniSharp.MSBuild.ProjectManager
Update project: CBL.Sgk.Infra.Data
[fail]: OmniSharp.MSBuild.ProjectManager
Error occurred while processing project updates
System.ArgumentException: "" não é parte do workspace.
at Microsoft.CodeAnalysis.Workspace.CheckProjectIsInSolution(Solution solution, ProjectId projectId)
at Microsoft.CodeAnalysis.Workspace.CheckProjectIsInCurrentSolution(ProjectId projectId)
at Microsoft.CodeAnalysis.Workspace.<>c__DisplayClass58_0.b__0(Solution oldSolution)
at Microsoft.CodeAnalysis.Workspace.<>c.b__26_3(Solution oldSolution, ValueTuple7 data) at Microsoft.CodeAnalysis.Workspace.SetCurrentSolution[TData](Func3 transformation, TData data, Action3 onBeforeUpdate, Action3 onAfterUpdate)
at Microsoft.CodeAnalysis.Workspace.SetCurrentSolution(Func2 transformation, Func3 changeKind, ProjectId projectId, DocumentId documentId, Action2 onBeforeUpdate, Action2 onAfterUpdate)
at Microsoft.CodeAnalysis.Workspace.SetCurrentSolution(Func2 transformation, WorkspaceChangeKind changeKind, ProjectId projectId, DocumentId documentId, Action2 onBeforeUpdate, Action2 onAfterUpdate) at Microsoft.CodeAnalysis.Workspace.OnProjectReferenceAdded(ProjectId projectId, ProjectReference projectReference) at OmniSharp.OmniSharpWorkspace.AddProjectReference(ProjectId projectId, ProjectReference projectReference) in D:\a\1\s\src\OmniSharp.Roslyn\OmniSharpWorkspace.cs:line 122 at OmniSharp.MSBuild.ProjectManager.UpdateProjectReferences(Project project, ImmutableArray1 projectReferencePaths) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectManager.cs:line 816
at OmniSharp.MSBuild.ProjectManager.UpdateProject(String projectFilePath, String changeTriggerFilePath) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectManager.cs:line 482
at OmniSharp.MSBuild.ProjectManager.ProcessQueue(CancellationToken cancellationToken) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectManager.cs:line 268
at OmniSharp.MSBuild.ProjectManager.ProcessLoopAsync(CancellationToken cancellationToken) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectManager.cs:line 185
[warn]: OmniSharp.Stdio.Host
************ Request ************
{
"Type": "request",
"Seq": 23,
"Command": "/close",
"Arguments": {
"FileName": "c:\Users\moviocr1\Projetos\1859-SGK\SgkUI\src\CBL.Sgk.UI\Views\Shared\_NavMenu.cshtml__virtual.cs"
}
}
[fail]: OmniSharp.Stdio.Host
************ Response (18.5763ms) ************
{
"Request_seq": 23,
"Command": "/close",
"Running": true,
"Success": false,
"Message": ""System.ArgumentException: \"_NavMenu.cshtml__virtual.cs\" não está aberto.\r\n at Microsoft.CodeAnalysis.Workspace.CheckDocumentIsOpen(DocumentId documentId)\r\n at Microsoft.CodeAnalysis.Workspace.<>c.b__199_0(Solution oldSolution, ValueTuple4 data)\\r\\n at Microsoft.CodeAnalysis.Workspace.SetCurrentSolution[TData](Func3 transformation, TData data, Action3 onBeforeUpdate, Action3 onAfterUpdate)\r\n at Microsoft.CodeAnalysis.Workspace.OnDocumentClosed(DocumentId documentId, TextLoader reloader, Boolean updateActiveContext)\r\n at OmniSharp.OmniSharpWorkspace.CloseDocument(DocumentId documentId) in D:\\a\\1\\s\\src\\OmniSharp.Roslyn\\OmniSharpWorkspace.cs:line 106\r\n at OmniSharp.Roslyn.CSharp.Services.Files.FileCloseService.Handle(FileCloseRequest request) in D:\\a\\1\\s\\src\\OmniSharp.Roslyn.CSharp\\Services\\Files\\FileCloseService.cs:line 25\r\n at OmniSharp.Endpoint.Exports.RequestHandlerExportHandler2.Handle(TRequest request) in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Host\\\\Endpoint\\\\Exports\\\\RequestHandlerExportHandler.cs:line 29\\r\\n at OmniSharp.Endpoint.EndpointHandler2.AggregateResponsesFromLanguageHandlers(ExportHandler2[] handlers, TRequest request) in D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Host\\\\Endpoint\\\\EndpointHandler.cs:line 165\\r\\n at OmniSharp.Endpoint.EndpointHandler2.HandleRequestForLanguage(String language, TRequest request, RequestPacket packet) in D:\\a\\1\\s\\src\\OmniSharp.Host\\Endpoint\\EndpointHandler.cs:line 226\r\n at OmniSharp.Endpoint.EndpointHandler`2.Process(RequestPacket packet, LanguageModel model, JToken requestObject) in D:\\a\\1\\s\\src\\OmniSharp.Host\\Endpoint\\EndpointHandler.cs:line 130\r\n at OmniSharp.Stdio.Host.HandleRequest(String json, ILogger logger) in D:\\a\\1\\s\\src\\OmniSharp.Stdio\\Host.cs:line 218"",
"Body": null,
"Seq": 1634,
"Type": "response"
}

@tkoenig89
Copy link

tkoenig89 commented May 5, 2023

Hey @crmmvio, this might be a duplicate of #5561 as you might have "format on save" on. Maybe have a look at this issue, as your problem might be tracked there as well.

A PR with a fix has been proposed recently, but a release with the extension seems to be a longer process, so we might need to wait a little longer for a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants