JetBrains / resharper-unity

Unity support for both ReSharper and Rider
Apache License 2.0
1.21k stars 133 forks source link

Cannot resolve symbol 'void'... until Unity Editor is opened #2456

Open LouisIngenthron opened 1 month ago

LouisIngenthron commented 1 month ago

Description of problem:

From a clean boot, when I open Rider without opening Unity, and I open a unity project in Rider, Rider is unable to resolve any symbols, even built-in language keywords like "void". As soon as the project is opened in the Unity Editor, the problem vanishes.

Expected behaviour:

Rider should be able to resolve symbols and allow the user to work on the code regardless of whether or not the Unity Editor is also running.

Reproduction Steps

  1. Have a pre-existing Unity project available on your drive that uses C# and has csproj's generated
  2. Reboot the computer
  3. Open JetBrains Rider. Open the Unity Project's solution.
  4. Open any code file. See errors throughout.

Known Workaround

Opening the Unity Editor to the same project resolves the issues, but this is not always ideal.

System Specs

Fedora 40 JetBrains Rider 2024.1.5#RD-241.18968.19 Rider Unity Support Plugin bundled 241.18968.19 Unity 2022.3.7f1

van800 commented 1 month ago

Hi! It is not a common issue. Should be somehow specific for your setup. Please attach Rider logs. Either here or create a new issue with Help->Report a Bug, agree to attach logs.

My first idea is that csproj files somehow become invalid after the reboot and Unity updates them on opening the project. So please try the following:

  1. After the reboot, when Rider shows red code, open the Problems view, check if something is wrong with the toolset.
  2. make a backup of one of the csproj files, which contains a cs file with errors
  3. start Unity, compare csproj with the backup.