Closed aybe closed 2 years ago
Would the generated project build in VS or in Rider?
Yes, the project builds fine.
I have tried to reproduce with Ubuntu, Unity 2021.2.1f1, Rider package 3.0.7, Rider 2021.3 EAP9, dotnet 6 SDK - everything works just fine for me. https://github.com/van800/MyProject212 https://github.com/van800/ClassLibrary26
Project Generation might be a bit different between Rider package and Visual Studio package. External Editor in Unity should be pointed to Rider package, that would ensure that Rider package is used to generate csproj/sln.
I just tried on a brand new project and I think I've the found the cause :)
Indeed as you said, it works fine, this, until you add the existing project so you can step through it.
Deleting that project from the solution immediately fixes the issue in both, but then you lose the ability to step through it.
https://github.com/aybe/NetStd21AssemblyBug
Note: I ensured to switch the external editor and regenerating both solutions before trying each IDE.
From the Re#/Rider side, it sounds like that having both project reference and assembly reference with netstandard2.1 causes unresolved code. I would have to check and sent a bug report to https://youtrack.jetbrains.com/issues/RSRP
However it is unlikely a Unity support bug. I am not 100% sure for VS, but for Rider integration adding a project to generated solution was never supported out of the box. Do you use a separate sln file for that? Otherwise Unity with Rider package would overwrite sln immediately after any change.
If you just want to debug, you have options. Either can step into compiled code and pdb would help debugger to find the sources. Or you can open the Solution with the ClassLibrary, attach to Unity and debug from there.
Tried to create a sample with project reference and assembly reference with netstandard2.1, but it didn't show the same problem. https://github.com/van800/ClassLibrary26 Your sample from yesterday NetStd21AssemblyBug is no longer available.
Sorry, the sample is back... https://github.com/aybe/NetStd21AssemblyBug
There's nothing custom in it beside projects added to it as VS supports this.
ReSharper recognizes 2.0 but not 2.1, try load the 2.1 project and you'll see the error even though it builds fine.
@aybe would you please add the ClassLib csproj to the sample.
@van800
Sorry, I've completely screwed the example project... I added the missing bits and tested it from scratch.
Summary:
Please make sure you rebuild both libs first so that updated PDBs are put in Assets and R# picks them up, if you don't do that, F12-ing the type in the first library will browse to metadata instead.
@aybe sorry for the delayed responce. Please add ClassLibrary1.csproj and ClassLibrary2.csproj
@van800 I don't understand what you mean, both csproj files are in the repository and visible in the solution?
Thank you, I have messed the repository with my fork, sorry.
Finally, with your help, I have done the report to Re# bug-tracker, which just shows the problem without any Unity specifics. https://youtrack.jetbrains.com/issue/RSRP-487266 Please vote there to see updates.
Done, thank you 🥇
Using the latest non EAP version of both products, VS2019 and both extensions in package manager.
Example:
Now try do the exact same procedure but for a .NET Standard 2.1 library, both products will complain that the namespace isn't recognized, the Unity project building fine however.
Things tried:
Neither of these worked.