Tell us what’s happening:
My Visual Studio Code editor isn’t showing any red squiggly lines under errors. Microsoft’s training asked me to enter the following code to show what happens if you try to access a method incorrectly.
int result = Random.Next();
According to the training there should be a red squiggly line underneath Random.Next but there isn’t, not even with obvious mistakes like forgetting a semicolon:
Console.WriteLine(“Hello”)
How can I activate the squiggly lines?
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Challenge Information:
Create and Run Simple C# Console Applications - Call Methods From the .NET Class Library Using C#
Hi there and welcome to the FCC forum!
it’s likely that the necessary extensions or settings are missing.
Make sure you have the official C# extension from Microsoft installed. This extension provides syntax highlighting, IntelliSense, and error checking for C#.
Go to the Extensions sidebar in VS Code (click the square icon or press Ctrl+Shift+X), search for C#, and install the one by Microsoft.
The C# extension relies on OmniSharp to analyze code and show error squiggles. If it’s disabled, enable it by following these steps: Open Command Palette (Ctrl+Shift+P), type OmniSharp: Restart OmniSharp and select it.
This will start the OmniSharp server if it isn’t already running.
Go to Settings (Ctrl+,) and search for Editor: Quick Suggestions and make sure it’s enabled.
Search for Editor: Code Lens and Editor: Code Actions On Save. Enable both if they are not active.
Ensure you have the .NET SDK installed, as it’s required to compile and analyze C# code. You can download it from dotnet.microsoft.com.
Close and reopen VS Code after making these changes to ensure they take effect.
After these steps, you should see red squiggly lines under syntax and code errors, like Random.Next() without an object instance or missing semicolons.
Hi, thanks for the quick reply!
I can’t seem to find OmniSharp in the Commad Palette. I’ve tried searching it, reinstalling all extensions (C#, C# Dev Kit and IntelliCode for C# Dev Kit) and then restarting vscode and searching again. Is it a separate thing I need to download, or should it be included in the extensions?
I do get predictive code from IntelliCode, so that’s working, just not the squiggly lines.
PS. I used the dotnet --version command to ensure .NET SDK was installed.
1 Like
OmniSharp should indeed come with the C# extension, so it’s unusual not to see it in the Command Palette after installation.
Go to Settings (Ctrl+,) and search for omnisharp. Ensure that OmniSharp: Enable is checked.
Also, check if OmniSharp: Use Global Mono is set to always, as sometimes this can impact OmniSharp’s functioning.
Even if OmniSharp isn’t visible in the Command Palette, it should run in the background if the C# extension is installed.
To check if it’s running, go to the Output panel (select View > Output from the top menu) and choose OmniSharp Logs from the dropdown. Any logs here can indicate issues with OmniSharp’s initialization.
Occasionally, there are conflicts when both C# Dev Kit and the C# extension are installed. Try disabling C# Dev Kit temporarily to see if the C# extension alone allows OmniSharp to function.
If you’re working with a single .cs file, try creating a .csproj file or opening the full folder containing your C# project in VS Code. OmniSharp often activates better within a structured project.
If OmniSharp still doesn’t appear, you can download and run it separately. This is more advanced, but OmniSharp’s GitHub page has details if needed.
1 Like
Thank you! The first step has succeeded. After checking the ‘Dotnet > Server: Use Omnisharp’ box, I can now find OmniSharp in the Command Palette! I’ll continue your recommended steps tomorrow since it’s late here.
1 Like
Okay, it’s been a few days and at first I managed to make it worse after my initial progress. Turns out all I needed to do was completely reset my settings! I tweaked them a bit for a course I started on right before this one, which turned out to be different from what I hoped. Thanks for the help anyway, I appreciate you taking the time to reply in such detail!