SpacetimeDB icon indicating copy to clipboard operation
SpacetimeDB copied to clipboard

C# intellisense not working

Open volkans80 opened this issue 9 months ago • 11 comments

  1. Installed spacetimedb cli
  2. Installed .net 8.0.407 SDK
  3. Installed wasi-experimental
  4. Created project with spacetime init --lang csharp server
  5. When i open project

Image

  1. Closed VS, saved sln file and reopen project

Image

Image

  1. Installed MSBuild 17.8.3 and still same error

volkans80 avatar Mar 14 '25 16:03 volkans80

Ok my mistake. I saved sln file to the same folder of project file. Some errors because of this. I properly saved the sln file and then all errors gone except this. I checked the project target it is .net 8.0.

Image

volkans80 avatar Mar 14 '25 17:03 volkans80

Interesting we should not use vs build and should use spacetime cli then it builds. But there is no intelli sense code completion in vs 2022.

volkans80 avatar Mar 14 '25 22:03 volkans80

I deleted everything and started again but this time I used vscode then it works and also intelli sense code completion works but when i close vscode and reopen project then intelli sense not working again. Also it gives same error.

Image

volkans80 avatar Mar 16 '25 15:03 volkans80

Thanks for reporting! We're going to try to reproduce this on our end and report back.

bfops avatar Mar 31 '25 19:03 bfops

@volkans80 have you moving the global,json up a level? That got me past VS Code yelling about .Net 9

BenCoden avatar Apr 10 '25 04:04 BenCoden

Yes you are right, it solved the problem. Thanks.

volkans80 avatar Apr 12 '25 10:04 volkans80

Is this issue fully resolved? Is anything else still going wrong with intellisense?

bfops avatar Apr 16 '25 17:04 bfops

@bfops it would be great if when someone runs spacetime init --lang csharp server it puts the global.json in the right spot.

BenCoden avatar Apr 16 '25 18:04 BenCoden

@bfops it would be great if when someone runs spacetime init --lang csharp server it puts the global.json in the right spot.

What's "the right" spot for you? It's definitely in a right spot, but it sounds like it gets confused if you also create a .sln.

What's the final directory structure that works for you?

bfops avatar Apr 16 '25 19:04 bfops

You are probably right about the .sln, I didn't manually create it, though. I thought it came from the init cmd.

BenCoden avatar Apr 18 '25 00:04 BenCoden

You are probably right about the .sln, I didn't manually create it, though. I thought it came from the init cmd.

I think it's created by Visual Studio when it's open the .csproj. spacetime init just creates the .csproj.

bfops avatar Apr 18 '25 16:04 bfops

I think all of the issues in here have been resolved. Feel free to reopen if that's not the case!

bfops avatar May 05 '25 19:05 bfops

For the record, trying to use Visual Studio proper still doesn't work. All of the above errors continue to pop up.

sunkin351 avatar Jun 18 '25 16:06 sunkin351

For the record, trying to use Visual Studio proper still doesn't work. All of the above errors continue to pop up.

Hm, rats.. And that's true for you even after trying the solution here? https://github.com/clockworklabs/SpacetimeDB/issues/2469#issuecomment-2791562030

bfops avatar Jun 18 '25 16:06 bfops

Sadly, yes.

sunkin351 avatar Jun 18 '25 16:06 sunkin351

It's obvious something changed in .NET 9, but I'm having a hard time figuring out what the new method of creating a pure wasm module/binary would be. It would be nice if we could just use the latest stuff.

sunkin351 avatar Jun 18 '25 17:06 sunkin351

...VS Intellisense now works after restarting my machine... I very confused as to why there was a problem to begin with. Maybe it should be a general recommendation to restart after installing everything.

I don't think this is the end of the problem, however. This fix feels fragile, as VS Code still reports similar errors during project restore. (but intellisense works at least.)

2025-06-18 16:19:55.667 [info]   Determining projects to restore...
2025-06-18 16:19:55.751 [info] C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.workload.mono.toolchain.current\9.0.6\WorkloadManifest.Wasi.targets(14,5): error : The 'wasi-experimental' workload is not supported in .NET 9. [E:\SpacetimeDB\Server\StdbModule.csproj]

Yes, the project is still targetting .NET 8

It might have something to do with the fact that downloading wasi-experimental downloads a version that targets .NET 9 for whatever reason (I guess I didn't have 8's SDK installed at the time), but building with the spacetime command seemed to download a different version? Both those things happened, along with installing 8's SDK separately, before restarting.

If those are the reasons why this now works for me, then maybe there needs to be a few more things added to the Quick Start guide.

I'm giving as much information as possible so we can understand the issue.

sunkin351 avatar Jun 18 '25 23:06 sunkin351

Ah thank you for the extra detail. We'll look into adding more clarity into the quick start guide, or a "Common issues" or something like that.

bfops avatar Jun 20 '25 17:06 bfops