microsoft / TemplateStudio

Template Studio accelerates the creation of new WinUI 3, WPF, and UWP apps using a wizard-based experience.
Other
2.65k stars 459 forks source link

Intellisense doesn't work in xaml page files generated by TS #4736

Closed JonPerkinsOldGit closed 2 months ago

JonPerkinsOldGit commented 2 months ago

Describe the bug

When creating a new xaml page via Template Studio the intellisense stops working. This seems to be intermittent but it is something that has frequently arisen.

But I've found a solution! I eventually noticed that the line:

?xml version="1.0" encoding="utf-8"? (in angle brackets, had to remove them for this comment)

is not being written at the very top of the file. Once this is manually added everything works as normal. I've lost several hours over this issue cumulatively so I just wanted to document it for others to find, and also to draw it to the attention of the development team (maybe I have configured something incorrectly though?).

To Reproduce

Simply create a new WinUI page via the Template Studio.

Then try writing the text for a new Button. Ideally you will see Intellisense pop up with the combobox selected at the Button entry. If intellisense is not working then the menu will simply consist of:

!-- ![CDATA[ ?

Additional features like the auto-generation of a Click handler also doesn't work. References to named controls within the cs code will contain the red squiggles denoting the reference does not exist, although it does compile and work OK if the xaml and cs manage to reference each other successfully.

Additional context

No response

Applies to the following platforms:

About your setup

JonPerkinsOldGit commented 2 months ago

And suddenly my fix stopped working and intellisense is broken again. Would somebody delete this whole post please.