JasonWei512 / MicrosoftMvvmToolkitSourceGeneratorBug

Issue: https://github.com/CommunityToolkit/WindowsCommunityToolkit/issues/4225

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Description

Compilation fails If the Microsoft MVVM Toolkit source generator attribute [ObservableProperty] is in a #region block.

For example, when compiling the following code (in MainViewModel.cs), you will get a "CS1038 #endregion directive expected" error:

// Doesn't compile

#region Properties

[ObservableProperty]
private int counter = 0;

#endregion

If you delete the #region Properties and #endregion lines, the code will compile:

// Compiles

// #region Properties

[ObservableProperty]
private int counter = 0;

// #endregion

Environment

  • Microsoft.Toolkit.Mvvm 7.1.0-rc1
  • Visual Studio 2019

About

Issue: https://github.com/CommunityToolkit/WindowsCommunityToolkit/issues/4225


Languages

Language:C# 100.0%