Why is my visual studio code not displaying my errors or intellisense? - visual-studio-code

No matter what c# script i boot up, no errors are displayed and neither is IntelliSense.
I've reinstalled vsc, reinstalled some extensions, made sure errors are turned on but nothing seems to work.
They work fine in regular vs but not vsc.

VScode by default only support web technologies if you want to use it for other programming languages you have to install microsoft dedicated extension for that technology like - C# for VScode

Related

Problems with save operation in Visual Studio VSIX custom editor and .Net 6.0 Web application projects

We have built a Visual Studio Extension (VSIX). It is a custom editor for editing a special file that contains definitions for the datamodel in our CMS.
We are porting our CMS to .Net 6.0 from .Net 4.8 ( framework -> core ), however we are struggling getting the editor to work in .Net 6.0 projects. It works fine in web applications written in .Net 4.8, but not in .Net 6.0 web application projects.
Whenever we click the save button in Visual Studio, we get a very general and non specific error message that says: "The operation could not be completed. Unspecified error"
We run the extension with source code in debug mode using the Visual Studio SDK, and there is no exception that is picked up by Visual Studio. ( We use one Visual Studio instance to start another instance of Visual Studio in debug mode, as normal with VSIX projects). Breakpoints etc. work, and we have activated all exceptions in the debugger. When we click save in Visual Studio projects, we get the error message before any method is called in our code. We do not even enter the "IVsPersistDocData2.SaveDocData" method of the "WindowPane" class. The plugin is written in C#. Apart from save, everything works fine. The editor loads fine and function as normal in both types of projects.
There must be some difference in the way the extension integrates with Visual Studio that differ between .Net4.8 projects and .Net6.0 projects. Of course, there are differences in file paths etc in these projects, but I do not see how this is the root of the problem as we do not even get to the stage where any method is called in our editor source code.
As a test I created a very simple extension with only the bare minimum to enable a WindowPane extension, and I get the same error message when saving in 6.0 projects
We created the first version of the plugin back in 2013, using templates from Microsoft and have been updating it for every new version of Visual Studio. There have been some changes in the documentation and projects templates for VSIX, but unfortunately, there is no longer any C# template for custom editors, only C++. (https://learn.microsoft.com/en-us/visualstudio/extensibility/walkthrough-creating-a-custom-editor?view=vs-2022) Pherhaps someone knows any workings examples of custom editors written in c#?
So, we are a little stuck, the error message does not give us any clue to what is wrong. I have not found any documentation that could explain differences in Net 4.8 and Net 6.0 web projects that could cause this.
Anyone had a similar problem? Or perhaps a clue to what is causing this.
(BTW, we are using the latest version of Visual Studio 2022 Community and Windows 11)
After opening a support incident with Microsoft, further investigation and live debugging pointed to problems with VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.SaveItem and a possible internal bug in Visual Studio.
A temporary workaround suggested by Microsoft support, was to add the definition of IPersistFileFormat to the WindowPane implementation. ( None of the methods needed to be implemented. )
This solved the problem for us. The definition of our working WindowPane is now:
public sealed class OntologyDesignerEditorPane : WindowPane, IVsPersistDocData2, IPersistFileFormat, IVsFileChangeEvents

Multi-threaded Debugging in Visual Studio Code

I've been working on a Powershell script that was handed to me. Never having dealt with powershell scritps before, I have a lot to learn. I have been using Visual Studio Code to run/debug it up until this point. It has been working well however, I'm running into an issue in a particular area that deals with multiple threads. I am unable to pause the Powershell script on specific breakpoints.
After looking all over the past couple of days and it seems that threading is something that can be worked on within Visual Studio. I downloaded Visual Studio Community 2019 and have tried to install the "Powershell Tools for Visual Studio" suite. According to the package manager, it has installed without issue. However, I am unable to create a Powershell project (which I should be able to do) and I cannot see it within the extension manager in Visual Studio 2019. To make sure it wasn't an error on my part, I've attempted the installation several different times and with different methods.
I've also looked at Windows built-in Powershell ISE for debugging but run into the same issue that Visual Studio Code has. This is rendering me unable to properly debug in the specific spots that I need to looking at. I have used Write-Host throughout most of the script however, as this is a script that was handed to me, I'd much rather be able to pause and look at all variables in a given state without having to print them all.
Is there any way to easily debug multi-threaded apps within Visual Studio Code? If there isn't, what would be some recommendations besides adding Write-Host,Write-Debug or similar cmdlets.
You are confusing tools and use case and this is due to your misunderstanding of PowerShell and the tools to deal with that, and that would be expected if you've never done this before.
If you have no PowerShell experience, its best to get ramped up first. Jumping into a tool for a language you've never used or understand is not prudent. Jump on Youtube and search for 'Beginning PowerShell' and view some of those before moving any further.
This is not a PowerShell code issue, which is what we are here to help with.
Your question is 'How do I configure VSCode and/or Visual Studio for Powershell development?, and thus off-topic for StackOverflow, and more a question for SuperUsers or StackExchange.
How do I ask a good question? - Help Center - Stack Overflow
Yet since you are here and I use this addon, let me provide some edification.
VSCode has an extension from Microsoft for PowerShell development, but that is just the Microsoft PowerShell extension.
The PowerShell Pro Tools for Visual Studio /VSCode is not a free tool and not from Microsoft. You have to pay for it to enable all
its features. You only need one copy/license of PowerShell Pro Tools
to use in Visual Studio/VSCode.
PowerShell Pro Tools Suite
https://ironmansoftware.com/powershell-pro-tools
PowerShell Pro Tools
PowerShell Pro Tools adds script packaging, a Windows Form Designer,
code conversion and a Universal Dashboard previewer to VS Code.
PowerShell Pro Tools provides Visual Studio integration through
the PowerShell Tools for Visual Studio. The Visual Studio integration
provides the following features. Packaging as executables including
command line utilities and services Windows Forms Designer WPF
Designer Integration Code Conversion
You can view how to use the tool buy view the docs from Ironman software the author of the product or on Youtube. Just search for it.
'powershell pro tools for VSCode'
'powershell pro tools for vscode projects'
'powershell pro tools for Visual Studio'
'powershell pro tools for visual studio projects'
I know this is relatively old, but it is worth noting if this shows in future search results. What VSCode can do, vs what you can do with PowerShell in VSCode.
I have done multithread in C# with VS Code debugging, but I am not aware of a good process for this in PowerShell. I assume that this is a question of support by the extension, but also the complication, of the various ways that PowerShell avoids or hides literal threading.
PowerShell abstracts async different than other languages.
Jobs can be threads, or process
Events may trigger and queue into the primary thread
Runspaces are whole environments on another thread, which can interact with each other.
Someone may be able to give a better summary on these, but "It is complicated"
I've decided the answer to this is no...
It should be as easy as put the breakpoint, hit the breakpoint, until ms supports this, its way behind any other decent scripting language. I'm thinking to unthread my application to make my life easier which is pretty sad state of affairs. Might try spinning up full visual studio to see if its better first.

Does VSCode have a different view in mac and in windows?

I am beginner programmer and have just installed VSCode. But to way VSCode looks in the tutorials is different from the one I have.
I mean the Left most and the Topmost looks different.
So I cant flow the tutorial and almost all tutorials has the same look.
The links of the sreenshots are down below:
Is my version older or it looks like that on windows or anything else, please explain step-by-step cause I am new to this. Thanks a lot!
Sorry if it is a bad Question!
You installed Visual Studio which is a more powerful IDE from Microsoft. Don't confuse it with the editor Visual Studio Code.
There is an answer explaining the main differences between the environments: https://stackoverflow.com/a/33798601/10770079
Visual Studio (full version) is a "full-featured" and "convenient" development environment.
Visual Studio (free "Express" versions - only until 2017) are feature-centered and simplified versions of the full version. Feature-centered meaning that there are different versions (Visual Studio Web Developer, Visual Studio C#, etc.) depending on your goal.
Visual Studio (free Community edition - since 2015) is a simplified version of the full version and replaces the separated express editions used before 2015.
Visual Studio Code (VSCode) is a cross-platform (Linux, Mac OS, Windows) editor that can be extended with plugins to your needs.
You downloaded Visual Studio the IDE.
Visual Studio Code is a pseudo-IDE style text editor.
Be sure you look up specifically Visual Studio Code Download for [ insert operating system here ].

Using VSCode Extensions in Visual Studio

Today I found a VSCode extension that I would very much love to use in Visual Studio 2017 (Pro or Enterprise). I'm not at all familiar with VSCode. Are the platforms entirely different, or is there some hope that I could somehow modify the extension and "port it over"?
Are the platforms entirely different [...]
Yes, they are - VSCode extensions run in a JavaScript engine (and are usually written with TypeScript), while Visual Studio extensions seem to run on .NET (usually C#). They also have different extension APIs:
Visual Studio 2017 SDK
Visual Studio Code Extension API
That doesn't mean that extension couldn't be ported over of course, provided Visual Studio has equivalents for all the required APIs, but it would essentially be a rewrite.
Now, there's an exception to this with language servers, using Microsoft's Language Server Protocol. It is designed to be IDE-independent and servers can be written in basically whatever language you prefer. There's LSP clients implementations for both VSCode (built-in) and Visual Studio. The extension you linked doesn't fall under that though.

Target users of Visual Studio Code?

I've been developing on Visual Studio, and here comes Visual Studio Code which is described as a source code editor that supports multiple platforms. For me, I find it promising considering it's a lightweight editor compared to Visual Studio.
Since Visual Studio Code is still a baby, is it safe to say as time passes by and this baby becomes mature, this will be the new Visual Studio considering it can run on multiple platform?
Does Visual Studio Code has a roadmap on the upcoming features?
Visual Studio Code will not replace the regular Visual Studio, if that's what you're asking. VSCode is intended to be a very lightweight, code-focused IDE. There are a plethora of features present in Visual Studio that I don't expect we'll ever see in VSCode simply because they are not within the scope of the project. For example, I don't think you'll ever see the designer in VSCode, which is something you would sorely miss if you were developing a WPF or WinForms application.
Right now VSCode seems to be mostly targeting web application developers using ASP.NET 5 and node.js.
As for what's ahead for VSCode, I'm not sure if a roadmap has been laid out anywhere but I do know that a plugin/extension system is in the works, along with ES6/7 support and a few other things.
If you want to follow the development of VSCode, check out their blog, Twitter, and UserVoice.