Missing Photon Pun assembly reference with Visual Studio Code 1.50.1 - unity3d

I am developing Unity game apps on a PC using C#, using Visual Studio Code as the editor. The apps are targeted at PC and Android. Multiplayer uses Photon Pun 2.
The Unity version is 2019.3.14F1 - I don't want to move forward just yet in case of 'unexpected problems'.
The VS Code version was 1.48.3 - and everything was fine, no compile errors, all code working OK etc.
Stupidly, I took Microsoft's advice to update VSC, and VS Code went to 1.50.1. Result of this is that there are all sorts of errors showing up in VS Code relating to the Photon code. All these errors stem back to the 'using Photon.Pun;' line. It says "the type or namespace name 'Pun' does not exist in the namespace 'Photon' (are you missing an assembly reference?)".
The code however does not come up with any compile errors in the Unity editor itself, and it all runs fine, including the Photon parts. The problem is in VS Code.
I realise this is almost certainly as VS Code problem, not Photon, but I am wondering if anyone has met this before and knows how to fix it?
(This is why I do not want to move from 2019.3.14F1 to 2020.whatever at the moment - you never know what might happen).

I had the same problem. Installing different versions of VS Code / VS Community Edition didn't fix anything for me, but this did:
With the project open in VS Code, find all occurrences of
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
in *.csproj files, and replace them with
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>

Tried rebuilding project files, swapping to a different editor (VS Community Edition 2019 - that was fine), but no difference - VSC persisted with the errors. Rest of intellisense working OK.
In the end, totally uninstalled VSC and reinstalled, and that sorted it out. No idea what the actual fault was.

I was wrong.
To-day, the errors are back.
The reason appears to be that in the process of trying to sort this, I installed VS Community Edition 2019 to see if that worked OK (it did). Then went back to VSC, and - that was fine too. Later I uninstalled VS Community Edition 2019 (it is taking about 4GB). It was uninstalling that which brought the errors back into VSC. Reinstalled VS Community Edition 2019, and it is all fine again.
So, VS Community Edition 2019 installs something that VSC needs - but I haven't yet figured out what it is.
UPDATE:
Gave up. Never managed to find out what VSC wanted and wasn't getting. Instead, reinstalled old version of VSC (1.48.2 from code.visualstudio.com/updates) and it is all fine again.

If still having this problem, all you have to do to fix it is by going to Package manager and install "visual studio editor package"
windows>Package Manager> All Packages /or Unity Registry (depeding on your unity version) search of visual studio editor
if it's already installed delete it and reinstall.

Got it FIXED!
Solution (it was a Unity issue):
In Unity, goto Edit > Preferences > External Tools > External Script Editor, and point it to Visual Studio..
Why this was so hard to find, I have no idea. But now my Photon solutions and namespaces properly transfer from Unity to Visual Studio. Hooah!
Also moved the script to where the photon scripts are

Uninstall the Visual studio community and re-install with latest VSC 2022. It will fix the issue

Related

OmniSharp not supporting unity anymore

So I recently started my final year project in Unity, for the code I use visual studio code, but the problem is that i installed the c# extension from omnisharp and it says that it doesn t support unity anymore or something like that. It doesn t show me any errors, doesn’t complete my code, nothing. What should I do?
In VS CODE
untick this option:

visual studio code - couldn't start client language support for java

Visual Studio code was working fine with maven projects, and suddenly stopped after I installed a new extension (Lombok).
I can't seem to get it to work anymore, even if I'm not using Lombok, and have the plugin disabled.
As soon as I start Visual Studio Code, it complains with
Couldn't start client language support for java
How can I fix this?
To solve this, I did the following:
Went to the installed extension (Command Pallette, Extensions: Installed Extensions)
found "Language suppoort for Java(TM) by Red Hat"
Clicked on the drop down arrow by "Uninstall", and chose "Install another version"
Chose a recent version, and restarted Visual Studio Code
it worked - I assume I could upgrade to latest again, but haven't done so yet.
Note: I feel that somehow I broke my settings.json file, and doing this fixed it up.

VS code doesn't detect UnityEngine.UI library - Unity

The issue is VS code doesn't see UnityEngine.UI library.
I had this issue before and I solved like it this:
I changed the code editor in preferences to Visual Studio, regenerated files and launched c# project. On the start, vs created needed .csproj files and then I closed vs and changed it back to vs code and it workeed.
However, now I am working on another project and I encountered same issue, I tried the method I described above but it didn't work.
Any ideas?
So, after days of tinkering and trying different solutions I found on the internet I finally found out how to solve it (all by myself).
Switch to VS and make sure it detects the UnityEngine.UI library. Then don't close VS, switch to VS Code, don't hit "regenerate files", launch c# project, enjoy!
These steps covered several possible issues:
https://stackoverflow.com/a/70977258/6046022
(just an overview, follow the link for the complete steps)
downgrade VSC package
re-install Unity UI
regenerate files

Why do no programs run in visual studio code?

I recently got a new computer and reinstalled visual studio code but I haven't been able to run any of my files. The error has occurred with both python and C++, so I feel as though it is the IDE that is the problem. I have looked online and there are no straight answers as I have tried following some solutions which have resulted in different errors.
The error above comes up when I run (F5) a simple line of code in c++. Does anyone have a solution?
Thanks, Jacob
[EDIT]
For my python files to work I have to manually select 'Python: current file' but for c++ files they still have the same error.
First step, uninstall python from this machine.
Second, reinstall and make sure that you check the box "add to path".
It's pretty easy to miss as it's a small box, and I missed it my first time installing python earlier in the year. Here's the box you may have missed while installing.
It could be your extensions.
I had a similar error message and simply updated all of my extensions and then my SDK. I was then able to run my code within the IDE. I was using VSCode for c++ and also updated my GCC compiler along with the extensions.
Also look into your computer's environment variables, if you have changed the %PATH variables it may be affecting your ability to run/compile programs.

Visual Studio Code OSX Snippets Not Working

I have a MacBook Pro and and iMac, with the same version of Visual Studio Code installed on both. And on both I'm experiencing the same problem. Intellisense stops recognizing my user-made snippets at some point and I have to do a restart (which sometimes doesn't work).
I'm not using an extension for the snippets, but am manually entering them in preferences > user snippets, in the appropriate languages.
Anyone else have this problem?