Home > Software design >  Visual Studio 2022 .Net MAUI Project Intellisense not working for some XAML files
Visual Studio 2022 .Net MAUI Project Intellisense not working for some XAML files

Time:10-12

I have a very simple .Net MAUI project with three (XAML) pages. The project compiles and runs without any errors or warnings.

When I edit one of the XAML pages and type a < character, the following intellisense pop-up is displayed:

Intellisense options missing

NOTE: The pop-up is missing several XAML statements that should be present.

When I edit a different XAML page, the following intellisense pop-up is displayed:

enter image description here

This time, the pop-up contains ALL of the XAML statements that one would expect.

In two of the three XAML pages, the pop-up works correctly (all statements displayed), but on one page, XAML statements are always missing -- I cannot figure out why.

Initially, I thought it may have been contextual in nature, that is, showing only those XAML statements that would be valid at the insertion point. However, in each file, my insertion point was directly below a ScrollView statement.

Any ideas why intellisense works with some XAML pages and not others? Is this a known bug in Visual Studio?

Thanks in advance.

Update: 19-Sep-2022

I think I have confirmed why this is happening -- on XAML pages WITHOUT any comments between the following lines:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage ...

... intellisense works just fine. For example, when I hover my cursor over the ContentPage node, the following is displayed:

Intellisense works

... and when I try to insert other nodes, intellisense is present (all options are present in the pop-up).

However, on a page that intellisenses does NOT work, I have a large comment block between the two lines above, for example:

<?xml version="1.0" encoding="utf-8" ?>
<!--
  Large comment block (approximately 90 lines.
-->
<ContentPage ...

When this comment block is present, intellisense stops working, that is, if I hover my cursor over the ContentPage node, nothing is displayed and when I try to insert other nodes, the following popup (which is missing all options) is displayed:

Intellisense not working

The only way around this (so far) is to remove the comment block, or move the comment block to the bottom of the page, after the closing ContentPage node.

Environment (copied from Help -> About Microsoft Visual Studio):

Microsoft Visual Studio Community 2022
Version 17.3.4
VisualStudio.17.Release/17.3.4 32901.215
Microsoft .NET Framework
Version 4.8.04084

Installed Version: Community

ADL Tools Service Provider   1.0
This package contains services used by Data Lake tools

ASA Service Provider   1.0

ASP.NET and Web Tools   17.3.376.3011
ASP.NET and Web Tools

Azure App Service Tools v3.0.0   17.3.376.3011
Azure App Service Tools v3.0.0

Azure Data Lake Tools for Visual Studio   2.6.5000.0
Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools   17.3.376.3011
Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio   2.6.5000.0
Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools   4.3.0-3.22423.10 b35bb0baca1071d50cc4f8cf5a1a89e7cc112461
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus   1.2.6 (master@34d6af2)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Microsoft Azure Hive Query Language Service   2.6.5000.0
Language service for Hive query

Microsoft Azure Stream Analytics Language Service   2.6.5000.0
Language service for Azure Stream Analytics

Microsoft Azure Tools for Visual Studio   2.9
Support for Azure Cloud Services projects

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Mono Debugging for Visual Studio   17.3.20 (3f4cb00)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   6.3.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Razor (ASP.NET Core)   17.0.0.2232702 e1d654e792aa2fe6646a6935bcca80ff0aff4387
Provides languages services for ASP.NET Core Razor.

SQL Server Data Tools   17.0.62207.04100
Microsoft SQL Server Data Tools

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TypeScript Tools   17.0.10701.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   4.3.0-3.22423.10 b35bb0baca1071d50cc4f8cf5a1a89e7cc112461
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools   17.1.0-beta.22363.4 1b94f89d4d1f41f20f9be73c76f4b229d4e49078
Microsoft Visual F# Tools

Visual Studio IntelliCode   2.2
AI-assisted development for Visual Studio.

VisualStudio.DeviceLog   1.0
Information about my package

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

VSPackage Extension   1.0
VSPackage Visual Studio Extension Detailed Info

Xamarin   17.3.0.296 (d17-3@a0ff24b)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   17.3.0.208 (remotes/origin/d17-3@e4f67afef)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates   17.2.28 (9b3d244)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK   13.0.0.0 (d17-3/030cd63)
Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: dffa5ab
    Java.Interop: xamarin/java.interop/d17-3@7716ae53
    SQLite: xamarin/sqlite/3.38.5@df4deab
    Xamarin.Android Tools: xamarin/xamarin-android-tools/main@14076a6


Xamarin.iOS and Xamarin.Mac SDK   15.12.0.2 (87f98a75e)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

CodePudding user response:

I compared the intellisense in Visual Studio Community 2022(17.3.4) with Visual Studio Community 2019, the intellisense works properly for the latter version even though with long comment block. It looks like it's a potential issue for the Visual Studio, you can report a problem with the Visual Studio product via this link.

  • Related