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

Malformed o#/projectchanged message when loading C# project in Helix #2594

Open
bendennis opened this issue Jan 12, 2024 · 1 comment
Open

Comments

@bendennis
Copy link

System Details:

MacOS Sonoma
Helix 23.10
Omnisharp 1.39.11 net6.0 build

Overview:

I'm trying to use omnisharp with the helix editor and am experiencing a problem when loading my C# solution. I downloaded and installed the v1.39.11 net6.0 omnisharp build. Omnisharp starts up as expected when I open helix at the root of my solution. Sometimes things load fine and everything is great, but more often things break shortly after omnisharp starts loading the project.

When enabling verbose logging in helix, I see unexpected content in the messages from omnisharp. I think it's the name of the solution file. When that shows up within a message body, it causes json deserialization to fail here. I think helix handles this in a reasonable way, but afterwards omnisharp seems to be unresponsive.

Below is an example of what I'm seeing. There are almost always a few instances where the solution name string shows up in the middle of the file list in the o#/projectchanged message.

{
	"jsonrpc":"2.0",
	"method":"o#/projectchanged",
	"params":{
	   "MsBuildProject":{
	      "ProjectGuid":"00000000-0000-0000-0000-000000000000",
	      "Path":"/Users/username/project-name/src/Project.Name/Project.Name.csproj",
	      "AssemblyName":"Project.Name",
	      "TargetPath":"/Users/username/project-name/src/Project.Name/bin/Debug/net7.0/Project.Name.dll",
	      "TargetFramework":".NETCoreApp,Version=v7.0",
	      "SourceFiles":[
			// ... lots of files
			"/Users/username/project-name/src/Project.Name/FileNaSolution.Name
			Solution.Name
			Solution.Name
			me.cs","Users/username/project-name/src/Project.Name/AnotherFileName.cs",
			// ... more files
	      ],
	      "TargetFrameworks":[
	         {
	            "Name":".NETCoreApp",
	            "FriendlyName":".NETCoreApp",
	            "ShortName":"net7.0"
	         }
	      ],
	      "OutputPath":"bin\\Debug/net7.0/",
	      "IntermediateOutputPath":"obj\\Debug/net7.0/",
	      "Configuration":"Debug",
		  "
		  // ... The json payload ends prematurely because helix is using the Content-Length header to determine how much data to read

Additionally, if I uncomment this line of code in helix, I see quite a few instances of the warning log which appears to indicate that the rogue string is appearing when a header is expected.

2024-01-10T15:32:46.048 helix_lsp::transport [WARN] Failed to parse header: "Solution.Name"

Does this seem like an omnisharp bug, or do you think there's an issue with how helix is interacting with omnisharp?

Thanks!

@bendennis
Copy link
Author

I did a bit more digging in the helix code and it looks like it is closing its LSP server event listener thread when the json parse fails. When I change that to simply ignore the malformed message things seem fine from my perspective.

Still seems like the malformed json payloads may be a defect on the omnisharp side, so I'll leave this issue open.

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

No branches or pull requests

1 participant