JetBrains Rider 2022.2 Help

Code inspection and quick-fixes in Visual Basic

Almost all JetBrains Rider's code analysis features available in C# (except for Value tracking) are also supported in VB.NET. You can find the detailed information on these features in the corresponding topics of the Code analysis section.

In this topic, you can find some examples of using code analysis features in VB.NET.

Code Inspection

JetBrains Rider's static code analysis can detect more than 150 different errors and problems in VB.NET code.

The analysis is performed by applying code inspections to the current document or in any specified scope.

JetBrains Rider: Error highlighting in Visual Basic

To look through the list of available inspections for VB.NET, open the Editor | Inspection Severity page of JetBrains Rider settings Ctrl+Alt+S, and then expand the VB.NET node.

Solution-Wide Analysis

JetBrains Rider not only analyzes errors in the current file, but also inspects the whole solution taking the dependencies between files into account. It shows the results of analysis in the All Soluiton Files tab of the Problems window Alt+6. For more information, see Solution-wide analysis.

JetBrains Rider: Visual Basic support. Errors in Solution

Inspect This

Inspect This is a shortcut to several powerful analysis features that allow you to see how values and method calls flow through your code. The list of available features depends on the current context.

JetBrains Rider: Visual Basic support. Inspect This
For more information, see Call tracking, Value tracking.

Examples of Quick-fixes

Remove redundant 'imports'

If none of the symbols from a particular namespace are used, the corresponding Imports directive is considered as redundant.

JetBrains Rider: Remove redundant imports in Visual Basic

JetBrains Rider provides the quick-fix to remove all such directives from a file.

JetBrains Rider: Remove redundant imports in Visual Basic

Import type

If you use a symbol from a namespace that is not imported, JetBrains Rider suggests to import the corresponding namespace and provides the necessary quick-fix.

JetBrains Rider: Import namespace in Visual Basic

Add 'Async' modifier

Asynchronous operations have some advantages over synchronous programming, so ReSharper keeps pace with the times and thoroughly supports the language features for asynchronous programming.

JetBrains Rider: Visual Basic support. Add 'Async' modifier quick-fix
The GetQuotesAsync function contains the await operator, but the function isn't defined as asynchronous. JetBrains Rider detects such a mismatch and prompts you to improve the code using the Add 'Async' modifier quick-fix. After applying the quick-fix, the missing modifier is added to the function declaration.

Change type

If the type of a method's argument doesn't match the type of the corresponding method parameter, JetBrains Rider suggests changing the type of the argument and provides the necessary quick-fix.

JetBrains Rider: Visual Basic support. Change type quick-fix

Initialize auto-property from constructor parameter

If you have a constructor parameter and you want to initialize an existing auto-property with the parameter's value, use this quick-fix.

JetBrains Rider: Visual Basic support. Initialize auto-property from constructor parameter
JetBrains Rider: Visual Basic support. Initialize auto-property from constructor parameter

Create method from usage

If there is a call of a method that does not exist yet, JetBrains Rider provides the necessary quick-fix to create such a method.

JetBrains Rider: Visual Basic support. Create method from usage
JetBrains Rider: Visual Basic support. Create method from usage
Last modified: 02 August 2022