This is a glossary of all the common issues in Microsoft - VS Code
  • 09-Jan-2023
Lightrun Team
Author Lightrun Team
Share
This is a glossary of all the common issues in Microsoft - VS Code

Troubleshooting Common Issues in Microsoft – VS Code

Lightrun Team
Lightrun Team
09-Jan-2023

Project Description

 

Visual Studio Code (VS Code) is a free, open-source code editor developed by Microsoft for Windows, Linux, and macOS. It is a powerful and flexible development tool that can be used for a wide range of development tasks, including web development, data science, and writing and editing code.

VS Code includes a number of features that make it easier for developers to write and debug code. These features include code completion, which suggests possible completions for code as you type, and debugging, which allows you to find and fix errors in your code. It also includes support for version control systems like Git, which makes it easier to track changes to your code and collaborate with other developers.

VS Code can be extended with a wide range of plugins that add additional functionality. These plugins can be developed by third parties or by the VS Code team, and they can add features such as support for new languages, integration with other tools, and customization of the editor’s appearance and behavior. This extensibility makes VS Code a popular choice for developers, as it allows them to tailor the editor to their specific needs and workflow.

 

Troubleshooting Microsoft – VS Code with the Lightrun Developer Observability Platform

 

Getting a sense of what’s actually happening inside a live application is a frustrating experience, one that relies mostly on querying and observing whatever logs were written during development.
Lightrun is a Developer Observability Platform, allowing developers to add telemetry to live applications in real-time, on-demand, and right from the IDE.
  • Instantly add logs to, set metrics in, and take snapshots of live applications
  • Insights delivered straight to your IDE or CLI
  • Works where you do: dev, QA, staging, CI/CD, and production

The most common issues for Microsoft – VS Code are:

 

Failed to connect to the remote extension host server (Error: Cannot resolve authority)

 

This can happen for a number of reasons, including network issues, firewall restrictions, or issues with the VS Code installation.

To troubleshoot this issue, you can try the following steps:

  1. Make sure that you are connected to a network and that the network is stable.
  2. Check your firewall settings to make sure that VS Code is allowed to connect to the internet.
  3. If you are using a VPN, try disabling it to see if that resolves the issue.
  4. Make sure that you have the latest version of VS Code installed. You can check for updates by going to the Help menu and selecting “Check for Updates”.
  5. Try resetting the Remote Extension Host server by going to the Command Palette (Ctrl+Shift+P on Windows or Linux, or Shift+Command+P on macOS) and running the “Remote: Reset Remote Extension Host” command.
  6. If the issue persists, you may need to uninstall and reinstall VS Code. Before doing this, you may want to try deleting the extensions folder in your VS Code installation directory to see if that resolves the issue.

 

rubocop returns empty output! please check configuration.

 

RuboCop is a static code analysis tool for the Ruby programming language that can be used with Visual Studio Code (VS Code). If you are experiencing issues with RuboCop and are seeing an empty output, there are a few things you can try to troubleshoot the problem:

  1. Make sure that RuboCop is correctly installed and configured. You can check the configuration by running rubocop --show-cops from the command line. This will show the default configuration that RuboCop is using. If you have customized the configuration, you can use the --config option to specify the path to your configuration file.
  2. If you are using the RuboCop extension for VS Code, make sure that it is up to date and that it is correctly configured. You can check the extension’s settings by going to the VS Code settings (File > Preferences > Settings or by pressing Ctrl + ,) and searching for “RuboCop”.
  3. Check the syntax of your Ruby code. RuboCop will not be able to analyze code that contains syntax errors, and it will not produce any output in these cases.
  4. Make sure that you are running RuboCop on the correct file or directory. If you are running RuboCop on a file or directory that does not contain any Ruby code, it will not produce any output.
  5. If you have recently updated your version of Ruby or have installed any new gems that may be affecting the behavior of RuboCop, you may want to try uninstalling and reinstalling the tool to see if that resolves the issue.

If none of these steps help, you may need to seek additional assistance, such as consulting the RuboCop documentation or reaching out to the RuboCop support team.

 

Test Discovery fails with ModuleNotFoundError while command is working on console

 

There could be a few different reasons why you might see this error. Some possible causes include:

  • You are trying to import a module in your code that is not installed. Make sure that you have installed all the necessary modules for your project, either using pip or conda.
  • There is a problem with your Python path. Make sure that the correct version of Python is being used, and that the Python executable is in your system path.
  • You have a typo in the name of the module you are trying to import. Double-check the spelling and case of the module name.
  • There is a problem with the module itself. This could be due to a syntax error, or an issue with the module’s code.

 

Setting `python.sortImports.path` to `isort` or setting it to a relative path does not work from within virtual environment

 

To use the isort formatter to automatically sort your Python imports within Visual Studio Code, you can set the python.sortImports.path option to the path of the isort executable.

If you are working within a Python virtual environment, the path to the isort executable may be different than the path outside of the virtual environment.

To find the path to the isort executable within your virtual environment, you can use the following steps:

  1. Activate your virtual environment using the activate command.
  2. Run the command which isort. This will print the path to the isort executable.
  3. Copy this path and set it as the value for the python.sortImports.path setting in Visual Studio Code.

For example, if the output of which isort is /path/to/venv/bin/isort, you would set python.sortImports.path to /path/to/venv/bin/isort.

Alternatively, you can also set python.sortImports.path to a relative path by specifying the path relative to the root of your workspace. For example, if the isort executable is located in the .venv/bin directory within your workspace, you can set python.sortImports.path to ./.venv/bin/isort.

 

Test suite failed to run- Call retries were exceeded

 

There could be several reasons why your test suite is failing to run in Visual Studio Code. Here are a few things you can try to troubleshoot the issue:

  1. Check the output of the test runner for any error messages or stack traces that might indicate the cause of the failure.
  2. Make sure that your test dependencies are installed and available to the test runner. If you are using a test runner extension, make sure it is up to date and compatible with your version of Visual Studio Code.
  3. If you are using a test runner extension that relies on a specific test framework (e.g. PyTest, nose, etc.), make sure that the relevant test framework is installed and configured properly.
  4. If you are using a test runner extension that relies on a specific test runner (e.g. pytest-runner, nose2, etc.), make sure that the relevant test runner is installed and configured properly.
  5. Check the settings of your test runner extension to ensure that it is configured correctly.
  6. If you are running your tests in a remote environment (e.g. via a remote interpreter or a remote development container), make sure that the test runner extension is installed and configured properly in the remote environment.
  7. If you are using a test runner extension that retries failed tests, make sure that the retry settings are not set too high. If the number of retries is set too high, it could cause the test runner to exceed the maximum number of retries and fail.

 

JAVA_HOME is not pointing to a JDK.

 

To fix this problem, you need to ensure that the JAVA_HOME environment variable is set to the path of a valid JDK (Java Development Kit) installation on your system.

Here is how you can do this:

  1. On your keyboard, press the Windows key and the Pause key at the same time to open the System Control Panel.
  2. In the System Properties window, click on the Advanced tab.
  3. Click on the Environment Variables button.
  4. In the Environment Variables window, scroll down to the System Variables section and find the JAVA_HOME variable. If the JAVA_HOME variable is not listed, you will need to create it.
  5. Click on the Edit button to edit the JAVA_HOME variable.
  6. In the Edit Environment Variable window, enter the path of your JDK installation in the Variable value field. For example, if you have installed the JDK in the C:\Program Files\Java\jdk1.8.0_241 directory, you would enter C:\Program Files\Java\jdk1.8.0_241 as the value.
  7. Click OK to save your changes.

Once you have set the JAVA_HOME variable to the correct value, you should be able to use VS Code to develop Java programs without any issues.

 

Disable import sorting for virtualenv

 

In Microsoft Visual Studio Code (VS Code), you can disable import sorting for a specific virtual environment by following these steps:

  1. Open the Command Palette by pressing Ctrl + Shift + P (Windows) or Shift + Command + P (Mac).
  2. Type Python: Select Interpreter in the Command Palette and press Enter.
  3. In the list of available interpreters, select the virtual environment that you want to disable import sorting for.

This will set the virtual environment as the default interpreter for your VS Code workspace. Any Python files that you open in VS Code will now use the selected virtual environment, and the import sorting feature will be disabled for those files.

Note that this will only disable import sorting for the selected virtual environment. If you switch to a different virtual environment or a global interpreter, the import sorting feature will be re-enabled.

Alternatively, you can disable the import sorting feature globally by following these steps:

  1. Open the User Settings editor by selecting File > Preferences > Settings (Windows) or Code > Preferences > Settings (Mac).
  2. In the Settings editor, search for "python.sortImports.args".
  3. Set the value of "python.sortImports.args" to an empty array ([]). This will disable the import sorting feature for all Python files in VS Code.

 

prisma generate, typings not updating in VSCode unless IDE is restarted.

 

There are a few things you can try to fix this issue:

  1. Make sure that you have the latest version of the @prisma/cli package installed. Updating the package might fix the issue.
  2. If you are using a third-party plugin for type checking or linting, try disabling the plugin temporarily to see if it is causing the issue.
  3. Try invalidating the VS Code cache by selecting Help > Toggle Developer Tools and then selecting Application > Clear Storage > Clear site data.
  4. If none of the above solutions work, you can try deleting the node_modules directory in your project and then running npm install again to reinstall all the dependencies.

 

Jupyter over remote ssh sometimes becomes slow and/or unresponsive

 

There are a few potential causes for this issue:

  1. Network latency: If the network connection between your local machine and the remote server is slow or unstable, it can cause Jupyter notebooks to become slow or unresponsive.
  2. Insufficient memory or CPU resources: If the remote server does not have enough memory or CPU resources available, it can cause Jupyter notebooks to become slow or unresponsive.
  3. Other processes on the remote server: If there are other processes running on the remote server that are using a lot of memory or CPU resources, it can cause Jupyter notebooks to become slow or unresponsive.

To troubleshoot this issue, you can try the following:

  1. Check the network connection between your local machine and the remote server to ensure that it is stable and fast.
  2. Check the memory and CPU usage on the remote server to ensure that there are sufficient resources available.
  3. Check for other processes running on the remote server that might be using a lot of memory or CPU resources.
  4. Try increasing the memory and CPU resources available to the remote server, if possible.

 

jaxws-maven-plugin not picked up for generating sources

 

There are a few potential causes for this issue:

  1. The jaxws-maven-plugin is not properly configured in your pom.xml file. Make sure that the plugin is correctly configured and that all of the required dependencies are specified.
  2. The jaxws-maven-plugin is not being executed during the build process. Make sure that the plugin is included in the appropriate build phase in your pom.xml file.
  3. There may be an issue with the Maven installation on your system. Try running mvn -v from the command line to check the version of Maven that is being used. If the version is incorrect or if Maven is not installed at all, this could cause the plugin to be ignored.
  4. There may be an issue with the Java Development Kit (JDK) that is being used. Make sure that you have a valid JDK installed and that it is properly configured in VS Code.

 

VS Code freezes regularly on macOS 12.3 with Apple M1

 

There could be a number of reasons why this is happening. Some possible causes could be:

  • Outdated software: Make sure that you are running the latest version of VS Code, as well as the latest version of macOS.
  • Insufficient resources: If your Mac does not have enough available memory (RAM) or CPU resources, it could cause VS Code to freeze. You can check your Mac’s resource usage by opening the “Activity Monitor” application. If you see that your Mac is running low on resources, you may need to close some other applications or increase the amount of RAM in your Mac.
  • Corrupted installation: If the installation of VS Code is corrupted, it could cause the application to freeze. In this case, you may need to uninstall and reinstall VS Code.
  • Extension issues: If you have installed any extensions in VS Code, one of them could be causing the issue. You can try disabling or uninstalling extensions to see if this resolves the issue.

 

Pytest running doesn’t take into consideration env.

 

If you are using the Pytest framework for Python testing in Visual Studio Code (VS Code), and you are experiencing issues where the environment variables are not being recognized, there could be a few possible causes:

  • The environment variables are not being set properly in your system or in your code. Make sure that you are setting the variables correctly and that they are being exported in your terminal or command prompt before running Pytest.
  • You are not activating the correct environment in VS Code. If you are using virtual environments or conda environments, make sure that you have activated the correct environment in VS Code before running Pytest.
  • The environment variables are not being passed to Pytest correctly. You can try using the -E flag when running Pytest to ensure that the environment variables are passed to the test runner. For example: pytest -E MY_ENV_VAR=value

 

Stuck while trying to install plugins in WSL using corporate proxy

 

If you are using Visual Studio Code (VS Code) in Windows Subsystem for Linux (WSL) and you are unable to install extensions or plugins due to a corporate proxy, there are a few things you can try:

  • Configure the proxy in VS Code: You can configure the proxy settings in VS Code by going to File > Preferences > Settings (or by pressing Ctrl + ,). In the search box, type “HTTP” and you should see the “http.proxy” and “http.proxyStrictSSL” settings. Set these values to the URL and port number of your corporate proxy.
  • Configure the proxy in your WSL environment: You can also try configuring the proxy in your WSL environment by setting the http_proxy and https_proxy environment variables. For example:
export http_proxy=http://proxy.example.com:8080
export https_proxy=http://proxy.example.com:8080

Use a third-party tool to tunnel your traffic through the corporate proxy: If the above methods do not work, you can try using a tool like “cntlm” to tunnel your traffic through the corporate proxy. You can then set the http_proxy and https_proxy environment variables to point to “localhost” and the port that cntlm is listening on.

 

Error on port 5500. Please try to change the port through settings or report on GitHub.

 

If you are seeing an error message in Visual Studio Code (VS Code) stating that the application is unable to bind to port 5500, it could be because the port is already in use by another process. Here are a few things you can try to resolve the issue:

  • Change the port in VS Code: You can try changing the port that VS Code uses by going to File > Preferences > Settings (or by pressing Ctrl + ,). In the search box, type “debug.node.autoAttach” and you should see the “debug.node.autoAttachPipe” setting. Set this value to a different port number.
  • Find and stop the process that is using the port: You can try using the “lsof” command to find the process that is using port 5500. For example:
lsof -i :5500

This will list the process ID (PID) of the process that is using the port. You can then use the “kill” command to stop the process:

kill <PID>

Reset VS Code’s settings: If changing the port or stopping the process that is using the port does not work, you can try resetting VS Code’s settings to the default values. To do this, go to File > Preferences > Settings, and then click the “Edit in settings.json” button. In the JSON file, remove all of the key-value pairs, save the file, and then restart VS Code.

 

Unittest framework : Automatic test discovery not working if test has a relative import

 

If you are using the unittest framework for Python testing in Visual Studio Code (VS Code) and you are experiencing issues with automatic test discovery, it could be because the tests have relative imports that are not being resolved correctly.

Relative imports are imports that use the . notation to specify the location of a module relative to the current module. For example:

from . import foo

VS Code’s test discovery feature relies on the Python interpreter to import and run the test modules. If the interpreter is unable to resolve the relative imports, the tests will not be discovered.

One way to resolve this issue is to use absolute imports instead of relative imports. Absolute imports specify the full package path to the module, and do not use the . notation. For example:

from mypackage import foo

Alternatively, you can try specifying the PYTHONPATH environment variable to include the directories that contain the modules that are being imported. This will allow the Python interpreter to resolve the relative imports.

 

More issues from Microsoft repos

Troubleshooting microsoft-playwright | Troubleshooting-microsoft-nni | Troubleshooting microsoft-azure-pipelines-tasks | Troubleshooting microsoft-qlib

 

 

 

 

Share

It’s Really not that Complicated.

You can actually understand what’s going on inside your live applications.

Try Lightrun’s Playground

Lets Talk!

Looking for more information about Lightrun and debugging?
We’d love to hear from you!
Drop us a line and we’ll get back to you shortly.

By submitting this form, I agree to Lightrun’s Privacy Policy and Terms of Use.