├── .editorconfig ├── .gitattributes ├── .github ├── FUNDING.yml ├── stale.yml └── workflows │ └── build.yml ├── .gitignore ├── AnalyzerDemo ├── AnalyzerDemo.csproj ├── ItemViewModel.cs ├── MainWindowViewModel.cs ├── Program.cs └── ViewModelBase.cs ├── LICENSE.TXT ├── MultiTargetingDemo ├── App.axaml ├── App.axaml.cs ├── MainWindow.axaml ├── MainWindow.axaml.cs ├── MultiTargetingDemo.csproj ├── Program.cs ├── ViewModels │ └── ViewModelBase.cs └── app.manifest ├── NuGet.Config ├── README.md ├── ReactiveGenerator.Integration.Tests ├── ObservableAsPropertyHelperIntegrationTests.cs ├── Properties │ └── AssemblyInfo.cs ├── ReactiveGenerator.Integration.Tests.csproj └── ReactiveGeneratorIntegrationTests.cs ├── ReactiveGenerator.Tests ├── AnalyzerTestHelper.cs ├── ModuleInitializer.cs ├── ObservableAsPropertyHelperGenerator │ └── ObservableAsPropertyHelperGeneratorTests.cs ├── Properties │ └── AssemblyInfo.cs ├── ReactiveGenerator.Tests.csproj ├── ReactiveGenerator │ ├── CrossAssemblyTests.cs │ ├── ReactiveGeneratorTests.cs │ └── UseBackingFieldsConfigurationTests.cs ├── ReactivePropertyAnalyzer │ └── ReactivePropertyAnalyzerTests.cs ├── Snapshots │ ├── CrossAssemblyTests.BaseHasNoAttributes_DerivedHasPropertyReactive.verified.txt │ ├── CrossAssemblyTests.BaseHasNoAttributes_DerivedHasReactive.verified.txt │ ├── CrossAssemblyTests.BaseHasPartialReactive_DerivedExtends.verified.txt │ ├── CrossAssemblyTests.BaseHasPropertyReactive_DerivedHasNoAttributes.verified.txt │ ├── CrossAssemblyTests.BaseHasReactive_DerivedHasIgnoreReactive.verified.txt │ ├── CrossAssemblyTests.BaseHasReactive_DerivedHasMixedPropertyAttributes.verified.txt │ ├── CrossAssemblyTests.BaseHasReactive_DerivedHasNoAttributes.verified.txt │ ├── CrossAssemblyTests.ExternalBaseDerivedFromReactiveObject_ThenNoDoubleINPCInDerived.verified.txt │ ├── CrossAssemblyTests.ExternalBaseHasIgnoreReactive_ThenDerivedIgnoresItToo.verified.txt │ ├── CrossAssemblyTests.ExternalBaseHasPropertyLevelReactive_ThenNoExtraINPCInDerived.verified.txt │ ├── CrossAssemblyTests.ExternalBaseHasReactiveClass_ThenNoDoubleINPCInDerived.verified.txt │ ├── CrossAssemblyTests.MultipleInheritanceLevels_MixedReactiveAttributes.verified.txt │ ├── ObservableAsPropertyHelperGeneratorTests.ComplexTypesTest.verified.txt │ ├── ObservableAsPropertyHelperGeneratorTests.DifferentAccessibilityLevelsTest.verified.txt │ ├── ObservableAsPropertyHelperGeneratorTests.GenericClassWithObservableAsPropertyTest.verified.txt │ ├── ObservableAsPropertyHelperGeneratorTests.GenericConstraintsTest.verified.txt │ ├── ObservableAsPropertyHelperGeneratorTests.InheritanceTest.verified.txt │ ├── ObservableAsPropertyHelperGeneratorTests.MixedAttributesTest.verified.txt │ ├── ObservableAsPropertyHelperGeneratorTests.MultiLevelInheritanceTest.verified.txt │ ├── ObservableAsPropertyHelperGeneratorTests.MultipleNamespacesTest.verified.txt │ ├── ObservableAsPropertyHelperGeneratorTests.MultipleObservableAsPropertiesTest.verified.txt │ ├── ObservableAsPropertyHelperGeneratorTests.NestedClassWithObservableAsPropertyTest.verified.txt │ ├── ObservableAsPropertyHelperGeneratorTests.NestedGenericTypesTest.verified.txt │ ├── ObservableAsPropertyHelperGeneratorTests.NestedPrivateClassTest.verified.txt │ ├── ObservableAsPropertyHelperGeneratorTests.NullablePropertiesTest.verified.txt │ ├── ObservableAsPropertyHelperGeneratorTests.ObservableAsPropertyWithComplexConstraints.verified.txt │ ├── ObservableAsPropertyHelperGeneratorTests.ObservableAsPropertyWithConstraints.verified.txt │ ├── ObservableAsPropertyHelperGeneratorTests.ObservableAsPropertyWithNestedGenerics.verified.txt │ ├── ObservableAsPropertyHelperGeneratorTests.SimpleObservableAsPropertyTest.verified.txt │ ├── ObservableAsPropertyHelperGeneratorTests.StaticPropertyTest.verified.txt │ ├── ReactiveGeneratorTests.AccessorModifiersTest.verified.txt │ ├── ReactiveGeneratorTests.AllPossibleConstraints.verified.txt │ ├── ReactiveGeneratorTests.AllPropertyModifiersTest.verified.txt │ ├── ReactiveGeneratorTests.ClassInGlobalNamespace.verified.txt │ ├── ReactiveGeneratorTests.ClassWithAbstractProperties.verified.txt │ ├── ReactiveGeneratorTests.ClassWithCustomAccessorAccessibility.verified.txt │ ├── ReactiveGeneratorTests.ClassWithCustomPropertyImplementationAndReactiveAttribute.verified.txt │ ├── ReactiveGeneratorTests.ClassWithDifferentPropertyAccessibilities.verified.txt │ ├── ReactiveGeneratorTests.ClassWithExplicitInterfaceImplementation.verified.txt │ ├── ReactiveGeneratorTests.ClassWithExpressionBodiedProperties.verified.txt │ ├── ReactiveGeneratorTests.ClassWithGenericConstraintsAndNullableProperties.verified.txt │ ├── ReactiveGeneratorTests.ClassWithIgnoreReactiveAttribute.verified.txt │ ├── ReactiveGeneratorTests.ClassWithIndexers.verified.txt │ ├── ReactiveGeneratorTests.ClassWithInitOnlySetters.verified.txt │ ├── ReactiveGeneratorTests.ClassWithMultipleComplexConstraints.verified.txt │ ├── ReactiveGeneratorTests.ClassWithMultipleInheritanceLevels.verified.txt │ ├── ReactiveGeneratorTests.ClassWithMultipleReactiveAttributes.verified.txt │ ├── ReactiveGeneratorTests.ClassWithNestedGenerics.verified.txt │ ├── ReactiveGeneratorTests.ClassWithNestedTypes.verified.txt │ ├── ReactiveGeneratorTests.ClassWithNotNullConstraint.verified.txt │ ├── ReactiveGeneratorTests.ClassWithNullableProperties.verified.txt │ ├── ReactiveGeneratorTests.ClassWithNullableReferenceConstraint.verified.txt │ ├── ReactiveGeneratorTests.ClassWithPropertyAccessorModifiers.verified.txt │ ├── ReactiveGeneratorTests.ClassWithPropertyImplementation.verified.txt │ ├── ReactiveGeneratorTests.ClassWithReactiveAttributeInDifferentNamespace.verified.txt │ ├── ReactiveGeneratorTests.ClassWithReactiveObjectInheritance.verified.txt │ ├── ReactiveGeneratorTests.ClassWithReadOnlyProperties.verified.txt │ ├── ReactiveGeneratorTests.ClassWithStaticProperties.verified.txt │ ├── ReactiveGeneratorTests.ClassWithTupleProperties.verified.txt │ ├── ReactiveGeneratorTests.ClassWithUnmanagedConstraint.verified.txt │ ├── ReactiveGeneratorTests.ClassWithVirtualProperties.verified.txt │ ├── ReactiveGeneratorTests.GenericClassWithConstraints.verified.txt │ ├── ReactiveGeneratorTests.GenericPropertyImplementation.verified.txt │ ├── ReactiveGeneratorTests.GenericPropertyWithConstraints.verified.txt │ ├── ReactiveGeneratorTests.GenericPropertyWithCustomAccessibility.verified.txt │ ├── ReactiveGeneratorTests.GenericPropertyWithInitSetter.verified.txt │ ├── ReactiveGeneratorTests.GenericPropertyWithMultipleTypeParameters.verified.txt │ ├── ReactiveGeneratorTests.GenericPropertyWithNestedTypes.verified.txt │ ├── ReactiveGeneratorTests.GenericPropertyWithNullableType.verified.txt │ ├── ReactiveGeneratorTests.GenericPropertyWithReactiveObjectBase.verified.txt │ ├── ReactiveGeneratorTests.GenericPropertyWithReadOnlyAccess.verified.txt │ ├── ReactiveGeneratorTests.InheritanceModifiersTest.verified.txt │ ├── ReactiveGeneratorTests.InheritedReactiveAttribute.verified.txt │ ├── ReactiveGeneratorTests.InitAccessorTest.verified.txt │ ├── ReactiveGeneratorTests.MixedModifiersTest.verified.txt │ ├── ReactiveGeneratorTests.ModifierOrderingTest.verified.txt │ ├── ReactiveGeneratorTests.MultiLevelInheritanceWithMixedReactiveAttributes.verified.txt │ ├── ReactiveGeneratorTests.MultiLevelNestedClassesWithReactiveProperties.verified.txt │ ├── ReactiveGeneratorTests.MultipleClassesWithInheritance.verified.txt │ ├── ReactiveGeneratorTests.NestedClassWithInheritance.verified.txt │ ├── ReactiveGeneratorTests.NestedClassesWithCustomPropertyImplementation.verified.txt │ ├── ReactiveGeneratorTests.NestedClassesWithDifferentAccessModifiers.verified.txt │ ├── ReactiveGeneratorTests.NestedClassesWithGenericConstraints.verified.txt │ ├── ReactiveGeneratorTests.NestedClassesWithInheritanceAndInterfaces.verified.txt │ ├── ReactiveGeneratorTests.NestedClassesWithInitOnlyProperties.verified.txt │ ├── ReactiveGeneratorTests.NestedClassesWithMixedReactiveScopes.verified.txt │ ├── ReactiveGeneratorTests.NestedClassesWithReactiveObjectInheritance.verified.txt │ ├── ReactiveGeneratorTests.NestedClassesWithStaticAndInstanceMembers.verified.txt │ ├── ReactiveGeneratorTests.NestedPrivateClassWithReactiveProperties.verified.txt │ ├── ReactiveGeneratorTests.NewModifierTest.verified.txt │ ├── ReactiveGeneratorTests.NonReactiveObjectWithMixedProperties.verified.txt │ ├── ReactiveGeneratorTests.PropertyLevelReactiveWithCustomAccessors.verified.txt │ ├── ReactiveGeneratorTests.PropertyLevelReactiveWithGenericType.verified.txt │ ├── ReactiveGeneratorTests.PropertyLevelReactiveWithInheritance.verified.txt │ ├── ReactiveGeneratorTests.PropertyLevelReactiveWithMixedProperties.verified.txt │ ├── ReactiveGeneratorTests.ReactiveObjectDerivedWithComplexProperties.verified.txt │ ├── ReactiveGeneratorTests.ReactiveObjectDerivedWithCustomImplementations.verified.txt │ ├── ReactiveGeneratorTests.ReactiveObjectDerivedWithInheritance.verified.txt │ ├── ReactiveGeneratorTests.ReactiveObjectDerivedWithInitProperties.verified.txt │ ├── ReactiveGeneratorTests.ReactiveObjectDerivedWithObservableProperties.verified.txt │ ├── ReactiveGeneratorTests.ReactiveObjectWithClassLevelReactive.verified.txt │ ├── ReactiveGeneratorTests.ReactiveObjectWithClassLevelReactiveAndIgnoreOverride.verified.txt │ ├── ReactiveGeneratorTests.ReactiveObjectWithMixedReactiveProperties.verified.txt │ ├── ReactiveGeneratorTests.ReactiveObjectWithNullableGenerics.verified.txt │ ├── ReactiveGeneratorTests.ReactiveObjectWithPropertyInitializer.verified.txt │ ├── ReactiveGeneratorTests.ReactiveObjectWithSingleReactiveProperty.verified.txt │ ├── ReactiveGeneratorTests.ReactiveObjectWithoutAnyReactiveAttribute.verified.txt │ ├── ReactiveGeneratorTests.RequiredModifierTest.verified.txt │ ├── ReactiveGeneratorTests.RequiredPropertyTest.verified.txt │ ├── ReactiveGeneratorTests.RequiredPropertyWithInheritanceTest.verified.txt │ ├── ReactiveGeneratorTests.RequiredPropertyWithMixedModifiersTest.verified.txt │ ├── ReactiveGeneratorTests.RequiredPropertyWithReactiveObjectTest.verified.txt │ ├── ReactiveGeneratorTests.SealedOverrideTest.verified.txt │ ├── ReactiveGeneratorTests.SimpleClassWithReactiveAttribute.verified.txt │ ├── ReactiveGeneratorTests.StaticPropertyTest.verified.txt │ ├── ReactiveGeneratorTests.UseLegacyModeTest.verified.txt │ ├── ReactivePropertyAnalyzerTests.BackingFieldUsedElsewhereTest.verified.txt │ ├── ReactivePropertyAnalyzerTests.CustomAccessibilityFixTest.verified.txt │ ├── ReactivePropertyAnalyzerTests.CustomAccessorAccessibilityTest.verified.txt │ ├── ReactivePropertyAnalyzerTests.DocumentWideFixTest.verified.txt │ ├── ReactivePropertyAnalyzerTests.FieldRemovalTest.verified.txt │ ├── ReactivePropertyAnalyzerTests.GenericClassWithReactivePropertyTest.verified.txt │ ├── ReactivePropertyAnalyzerTests.HandlesGenericsFixTest.verified.txt │ ├── ReactivePropertyAnalyzerTests.MixedPropertyTypesFixTest.verified.txt │ ├── ReactivePropertyAnalyzerTests.MultipleClassesFixTest.received.txt │ ├── ReactivePropertyAnalyzerTests.MultipleClassesFixTest.verified.txt │ ├── ReactivePropertyAnalyzerTests.MultiplePropertiesDocumentFixTest.received.txt │ ├── ReactivePropertyAnalyzerTests.MultiplePropertiesDocumentFixTest.verified.txt │ ├── ReactivePropertyAnalyzerTests.MultipleReactivePropertiesTest.verified.txt │ ├── ReactivePropertyAnalyzerTests.NonReactiveObjectShouldNotTriggerAnalyzer.verified.txt │ ├── ReactivePropertyAnalyzerTests.NullablePropertiesTest.verified.txt │ ├── ReactivePropertyAnalyzerTests.OnlyConvertsReactiveObjectsFixTest.verified.txt │ ├── ReactivePropertyAnalyzerTests.PreservesExistingReactivesFixTest.verified.txt │ ├── ReactivePropertyAnalyzerTests.ProjectWideFixTest.verified.txt │ ├── ReactivePropertyAnalyzerTests.PropertyWithoutSetterShouldNotTriggerAnalyzer.verified.txt │ ├── ReactivePropertyAnalyzerTests.SimpleReactivePropertyTest.verified.txt │ ├── ReactivePropertyAnalyzerTests.SinglePropertyFixTest.verified.txt │ ├── ReactivePropertyAnalyzerTests.SkipsPropertiesWithoutRaiseAndSetFixTest.received.txt │ ├── ReactivePropertyAnalyzerTests.SkipsPropertiesWithoutRaiseAndSetFixTest.verified.txt │ ├── ReactivePropertyAnalyzerTests.SolutionWideFixTest.verified.txt │ ├── UseBackingFieldsConfigurationTests.UseBackingFields_BothFormats_BothTrue.verified.txt │ ├── UseBackingFieldsConfigurationTests.UseBackingFields_BothFormats_NewTakesPrecedence.verified.txt │ ├── UseBackingFieldsConfigurationTests.UseBackingFields_CrossAssembly_LegacyFormat.verified.txt │ ├── UseBackingFieldsConfigurationTests.UseBackingFields_CrossAssembly_NewFormat.verified.txt │ ├── UseBackingFieldsConfigurationTests.UseBackingFields_EmptyValue_DefaultsToFalse.verified.txt │ ├── UseBackingFieldsConfigurationTests.UseBackingFields_InvalidValue_DefaultsToFalse.verified.txt │ ├── UseBackingFieldsConfigurationTests.UseBackingFields_LegacyFormat.verified.txt │ ├── UseBackingFieldsConfigurationTests.UseBackingFields_NewFormat.verified.txt │ ├── UseBackingFieldsConfigurationTests.UseBackingFields_NoConfig_DefaultsToFalse.verified.txt │ ├── UseBackingFieldsConfigurationTests.UseBackingFields_WithComplexProperties.verified.txt │ ├── UseBackingFieldsConfigurationTests.UseBackingFields_WithGenericClass.verified.txt │ ├── UseBackingFieldsConfigurationTests.UseBackingFields_WithInheritance.verified.txt │ ├── UseBackingFieldsConfigurationTests.UseBackingFields_WithNestedClasses.verified.txt │ ├── UseBackingFieldsConfigurationTests.UseBackingFields_WithOverrideProperties.verified.txt │ ├── UseBackingFieldsConfigurationTests.UseBackingFields_WithReactiveObjectInheritance.verified.txt │ ├── WhenAnyValueGeneratorTests.ClassInheritingFromReactiveObject.verified.txt │ ├── WhenAnyValueGeneratorTests.ClassWithComplexPropertyTypes.verified.txt │ ├── WhenAnyValueGeneratorTests.ClassWithDifferentAccessibilities.verified.txt │ ├── WhenAnyValueGeneratorTests.ClassWithMixedReactiveAttributes.verified.txt │ ├── WhenAnyValueGeneratorTests.ClassWithNestedGenerics.verified.txt │ ├── WhenAnyValueGeneratorTests.ClassWithNullableProperties.verified.txt │ ├── WhenAnyValueGeneratorTests.ClassWithPropertyLevelReactiveAttribute.verified.txt │ ├── WhenAnyValueGeneratorTests.CrossAssemblyInheritanceTest.verified.txt │ ├── WhenAnyValueGeneratorTests.GenericClassWithConstraints.verified.txt │ ├── WhenAnyValueGeneratorTests.GenericInheritanceWithReactiveAttribute.verified.txt │ ├── WhenAnyValueGeneratorTests.InheritedReactiveAttribute.verified.txt │ ├── WhenAnyValueGeneratorTests.InterfaceImplementationWithReactiveAttribute.verified.txt │ ├── WhenAnyValueGeneratorTests.MixedPropertyAndClassLevelReactiveInheritance.verified.txt │ ├── WhenAnyValueGeneratorTests.MultiLevelInheritanceWithMixedReactiveAttributes.verified.txt │ ├── WhenAnyValueGeneratorTests.MultipleClassesInDifferentNamespaces.verified.txt │ ├── WhenAnyValueGeneratorTests.MultipleClassesWithInheritance.verified.txt │ ├── WhenAnyValueGeneratorTests.NestedClassWithReactiveProperties.verified.txt │ ├── WhenAnyValueGeneratorTests.NestedInheritanceWithReactiveAttribute.verified.txt │ └── WhenAnyValueGeneratorTests.SimpleClassWithReactiveAttribute.verified.txt ├── SourceGeneratorTestHelper.cs └── WhenAnyValueGenerator │ └── WhenAnyValueGeneratorTests.cs ├── ReactiveGenerator.sln ├── ReactiveGenerator ├── IsExternalInit.cs ├── ObservableAsPropertyHelperGenerator.cs ├── ReactiveGenerator.cs ├── ReactiveGenerator.csproj ├── ReactivePropertyAnalyzer.cs ├── ReactivePropertyCodeFixProvider.cs ├── TypeHelper.cs ├── WhenAnyValueGenerator.cs └── build │ └── ReactiveGenerator.props ├── ReactiveGeneratorDemo ├── App.axaml ├── App.axaml.cs ├── MainWindow.axaml ├── MainWindow.axaml.cs ├── Program.cs ├── ReactiveGeneratorDemo.csproj ├── ViewModels │ ├── Advanced.cs │ ├── Car.cs │ ├── MainViewModel.cs │ ├── NullableGenericsTest.cs │ ├── NullableTest.cs │ ├── OaphViewModel.cs │ ├── Person.cs │ ├── Shape.cs │ ├── Student.cs │ ├── Teacher.cs │ ├── Test.cs │ ├── UsedCar.cs │ ├── ValidatingViewModel.cs │ └── ViewModelBase.cs └── app.manifest └── global.json /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [wieslawsoltes] 2 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # https://probot.github.io/apps/stale/ 2 | 3 | # Number of days of inactivity before an issue becomes stale 4 | daysUntilStale: 60 5 | 6 | # Number of days of inactivity before a stale issue is closed 7 | daysUntilClose: 7 8 | 9 | # Issues with these labels will never be considered stale 10 | exemptLabels: 11 | - pinned 12 | - security 13 | 14 | # Label to use when marking an issue as stale 15 | staleLabel: stale 16 | 17 | # Comment to post when marking an issue as stale. Set to `false` to disable 18 | markComment: > 19 | This issue has been automatically marked as stale because it has not had 20 | recent activity. It will be closed if no further activity occurs. Thank you 21 | for your contributions. 22 | 23 | # Comment to post when closing a stale issue. Set to `false` to disable 24 | closeComment: true 25 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | - release/* 8 | pull_request: 9 | branches: 10 | - main 11 | 12 | jobs: 13 | build: 14 | strategy: 15 | matrix: 16 | os: [ubuntu-latest, windows-latest, macos-latest] 17 | name: Build ${{ matrix.os }} 18 | runs-on: ${{ matrix.os }} 19 | 20 | steps: 21 | - uses: actions/checkout@v1 22 | - name: Setup .NET Core 23 | uses: actions/setup-dotnet@v1 24 | - name: Build Release 25 | run: dotnet build --configuration Release 26 | - name: Test Release 27 | run: dotnet test --configuration Release 28 | -------------------------------------------------------------------------------- /AnalyzerDemo/AnalyzerDemo.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net9.0 6 | enable 7 | enable 8 | false 9 | 10 | 11 | 12 | true 13 | $(BaseIntermediateOutputPath)\GeneratedFiles 14 | 15 | 16 | 17 | 13 18 | true 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /AnalyzerDemo/ItemViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.ObjectModel; 2 | using ReactiveUI; 3 | 4 | namespace AnalyzerDemo; 5 | 6 | public class ItemViewModel(string value) : ViewModelBase 7 | { 8 | private ObservableCollection? _items; 9 | private string? _value = value; 10 | 11 | public string? Value 12 | { 13 | get => _value; 14 | set => this.RaiseAndSetIfChanged(ref _value, value); 15 | } 16 | 17 | public ObservableCollection? Items 18 | { 19 | get => _items; 20 | set => this.RaiseAndSetIfChanged(ref _items, value); 21 | } 22 | 23 | public override string ToString() => _value ?? string.Empty; 24 | } 25 | -------------------------------------------------------------------------------- /AnalyzerDemo/Program.cs: -------------------------------------------------------------------------------- 1 | Console.WriteLine("Hello, World!"); 2 | -------------------------------------------------------------------------------- /AnalyzerDemo/ViewModelBase.cs: -------------------------------------------------------------------------------- 1 | using ReactiveUI; 2 | 3 | namespace AnalyzerDemo; 4 | 5 | public abstract class ViewModelBase : ReactiveObject 6 | { 7 | } 8 | -------------------------------------------------------------------------------- /LICENSE.TXT: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Wiesław Šoltés 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MultiTargetingDemo/App.axaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /MultiTargetingDemo/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls.ApplicationLifetimes; 3 | using Avalonia.Markup.Xaml; 4 | 5 | namespace MultiTargetingDemo; 6 | 7 | public partial class App : Application 8 | { 9 | public override void Initialize() 10 | { 11 | AvaloniaXamlLoader.Load(this); 12 | } 13 | 14 | public override void OnFrameworkInitializationCompleted() 15 | { 16 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 17 | { 18 | desktop.MainWindow = new MainWindow(); 19 | } 20 | 21 | base.OnFrameworkInitializationCompleted(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /MultiTargetingDemo/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 8 | Welcome to Avalonia! 9 | 10 | -------------------------------------------------------------------------------- /MultiTargetingDemo/MainWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls; 2 | 3 | namespace MultiTargetingDemo; 4 | 5 | public partial class MainWindow : Window 6 | { 7 | public MainWindow() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /MultiTargetingDemo/MultiTargetingDemo.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Library 4 | netstandard2.0;netstandard2.1;net471;net6.0;net8.0;net9.0 5 | enable 6 | false 7 | true 8 | app.manifest 9 | 10 | 11 | 12 | 13 | 14 | true 15 | true 16 | $(BaseIntermediateOutputPath)\GeneratedFiles 17 | 18 | 19 | 20 | preview 21 | true 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | all 35 | runtime; build; native; contentfiles; analyzers; buildtransitive 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /MultiTargetingDemo/Program.cs: -------------------------------------------------------------------------------- 1 | namespace MultiTargetingDemo; 2 | /* 3 | class Program 4 | { 5 | // Initialization code. Don't use any Avalonia, third-party APIs or any 6 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 7 | // yet and stuff might break. 8 | [STAThread] 9 | public static void Main(string[] args) => BuildAvaloniaApp() 10 | .StartWithClassicDesktopLifetime(args); 11 | 12 | // Avalonia configuration, don't remove; also used by visual designer. 13 | public static AppBuilder BuildAvaloniaApp() 14 | => AppBuilder.Configure() 15 | .UsePlatformDetect() 16 | .WithInterFont() 17 | .LogToTrace(); 18 | } 19 | */ 20 | -------------------------------------------------------------------------------- /MultiTargetingDemo/ViewModels/ViewModelBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Avalonia.Reactive; 3 | 4 | namespace MultiTargetingDemo.ViewModels; 5 | 6 | [Reactive] 7 | public partial class ViewModelBase 8 | { 9 | } 10 | 11 | public partial class MainViewModel : ViewModelBase 12 | { 13 | [Reactive] 14 | public partial bool IsInitialized { get; set; } 15 | } 16 | 17 | [Reactive] 18 | public partial class LoadingViewModel 19 | { 20 | public LoadingViewModel() 21 | { 22 | this.WhenAnyIsInitialized() 23 | .Subscribe(new AnonymousObserver(x => 24 | { 25 | Console.WriteLine($"{nameof(IsInitialized)}={x}"); 26 | })); 27 | } 28 | 29 | public partial bool IsInitialized { get; set; } 30 | } 31 | -------------------------------------------------------------------------------- /MultiTargetingDemo/app.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 6 | 7 | 8 | 9 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /NuGet.Config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ReactiveGenerator.Integration.Tests/ObservableAsPropertyHelperIntegrationTests.cs: -------------------------------------------------------------------------------- 1 | using System.Reactive.Linq; 2 | using ReactiveUI; 3 | 4 | namespace ReactiveGenerator.Integration.Tests; 5 | 6 | public partial class ObservableAsPropertyHelperIntegrationTests 7 | { 8 | [Fact] 9 | public void SimpleViewModel_WhenCounterChanges_UpdatesComputedValue() 10 | { 11 | // Arrange 12 | var viewModel = new SimpleViewModel(); 13 | var values = new List(); 14 | viewModel.WhenAnyValue(x => x.ComputedValue) 15 | .Subscribe(x => values.Add(x ?? string.Empty)); 16 | 17 | // Act 18 | viewModel.Counter = 1; 19 | viewModel.Counter = 2; 20 | 21 | // Assert 22 | Assert.Equal(new[] { "Counter: 0", "Counter: 1", "Counter: 2" }, values); 23 | } 24 | 25 | [Fact] 26 | public void GenericViewModel_WhenInputChanges_UpdatesComputedValue() 27 | { 28 | // Arrange 29 | var viewModel = new GenericViewModel(); 30 | var values = new List(); 31 | viewModel.WhenAnyValue(x => x.ComputedValue) 32 | .Subscribe(x => values.Add(x)); 33 | 34 | // Act 35 | viewModel.Input = "Hello"; 36 | viewModel.Input = "World"; 37 | 38 | // Assert 39 | Assert.Equal(new[] { null, "Value: Hello", "Value: World" }, values); 40 | } 41 | 42 | internal partial class SimpleViewModel : ReactiveObject 43 | { 44 | [ObservableAsProperty] 45 | public partial string ComputedValue { get; } 46 | 47 | [Reactive] 48 | public partial int Counter { get; set; } 49 | 50 | public SimpleViewModel() 51 | { 52 | ObservableAsPropertyHelper helper = this.WhenAnyCounter() 53 | .Select(x => $"Counter: {x}") 54 | .ToProperty(this, x => x.ComputedValue); 55 | 56 | _computedValueHelper = helper; 57 | } 58 | } 59 | 60 | internal partial class GenericViewModel : ReactiveObject 61 | where T : class 62 | { 63 | [ObservableAsProperty] 64 | public partial T? ComputedValue { get; } 65 | 66 | [Reactive] 67 | public partial T? Input { get; set; } 68 | 69 | public GenericViewModel() 70 | { 71 | ObservableAsPropertyHelper helper = this.WhenAnyInput() 72 | .Select(x => x != null ? $"Value: {x}" as T : default) 73 | .ToProperty(this, x => x.ComputedValue); 74 | 75 | _computedValueHelper = helper; 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /ReactiveGenerator.Integration.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 |  2 | [assembly: CollectionBehavior(DisableTestParallelization = true)] 3 | -------------------------------------------------------------------------------- /ReactiveGenerator.Integration.Tests/ReactiveGenerator.Integration.Tests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net9.0 5 | enable 6 | enable 7 | false 8 | 9 | 10 | 11 | preview 12 | false 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/ModuleInitializer.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | using DiffEngine; 3 | 4 | namespace ReactiveGenerator.Tests; 5 | 6 | public static class ModuleInitializer 7 | { 8 | [ModuleInitializer] 9 | public static void Initialize() 10 | { 11 | VerifySourceGenerators.Initialize(); 12 | 13 | Verifier.DerivePathInfo((sourceFile, projectDirectory, type, method) => new( 14 | directory: Path.Combine(projectDirectory, "Snapshots"), 15 | typeName: type.Name, 16 | methodName: method.Name)); 17 | 18 | DiffTools.UseOrder(DiffTool.VisualStudio); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 |  2 | [assembly: CollectionBehavior(DisableTestParallelization = true)] 3 | -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/ReactiveGenerator.Tests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net9.0 5 | enable 6 | enable 7 | false 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/CrossAssemblyTests.BaseHasNoAttributes_DerivedHasPropertyReactive.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: MainLib.DerivedClass.INPC.g.cs, 17 | Source: 18 | // 19 | #nullable enable 20 | 21 | using System.ComponentModel; 22 | using System.Runtime.CompilerServices; 23 | 24 | namespace MainLib 25 | { 26 | public partial class DerivedClass : INotifyPropertyChanged 27 | { 28 | public event PropertyChangedEventHandler? PropertyChanged; 29 | 30 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 31 | { 32 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 33 | } 34 | 35 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 36 | { 37 | PropertyChanged?.Invoke(this, args); 38 | } 39 | } 40 | } 41 | 42 | }, 43 | { 44 | FileName: MainLib.DerivedClass.ReactiveProperties.g.cs, 45 | Source: 46 | // 47 | #nullable enable 48 | 49 | using System.ComponentModel; 50 | using System.Runtime.CompilerServices; 51 | 52 | namespace MainLib 53 | { 54 | /// 55 | /// A partial class implementation for MainLib.DerivedClass. 56 | /// 57 | public partial class DerivedClass 58 | { 59 | private static readonly PropertyChangedEventArgs _reactivePropChangedEventArgs = new PropertyChangedEventArgs(nameof(ReactiveProp)); 60 | 61 | public partial string ReactiveProp 62 | { 63 | get => field; 64 | set 65 | { 66 | if (!Equals(field, value)) 67 | { 68 | field = value; 69 | OnPropertyChanged(_reactivePropChangedEventArgs); 70 | } 71 | } 72 | } 73 | } 74 | } 75 | 76 | }, 77 | { 78 | FileName: ReactiveAttribute.g.cs, 79 | Source: 80 | // 81 | using System; 82 | 83 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 84 | sealed class ReactiveAttribute : Attribute 85 | { 86 | public ReactiveAttribute() { } 87 | } 88 | } 89 | ], 90 | Diagnostics: null 91 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/CrossAssemblyTests.BaseHasNoAttributes_DerivedHasReactive.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: MainLib.DerivedClass.INPC.g.cs, 17 | Source: 18 | // 19 | #nullable enable 20 | 21 | using System.ComponentModel; 22 | using System.Runtime.CompilerServices; 23 | 24 | namespace MainLib 25 | { 26 | public partial class DerivedClass : INotifyPropertyChanged 27 | { 28 | public event PropertyChangedEventHandler? PropertyChanged; 29 | 30 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 31 | { 32 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 33 | } 34 | 35 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 36 | { 37 | PropertyChanged?.Invoke(this, args); 38 | } 39 | } 40 | } 41 | 42 | }, 43 | { 44 | FileName: MainLib.DerivedClass.ReactiveProperties.g.cs, 45 | Source: 46 | // 47 | #nullable enable 48 | 49 | using System.ComponentModel; 50 | using System.Runtime.CompilerServices; 51 | 52 | namespace MainLib 53 | { 54 | /// 55 | /// A partial class implementation for MainLib.DerivedClass. 56 | /// 57 | public partial class DerivedClass 58 | { 59 | private static readonly PropertyChangedEventArgs _derivedPropChangedEventArgs = new PropertyChangedEventArgs(nameof(DerivedProp)); 60 | 61 | public partial string DerivedProp 62 | { 63 | get => field; 64 | set 65 | { 66 | if (!Equals(field, value)) 67 | { 68 | field = value; 69 | OnPropertyChanged(_derivedPropChangedEventArgs); 70 | } 71 | } 72 | } 73 | } 74 | } 75 | 76 | }, 77 | { 78 | FileName: ReactiveAttribute.g.cs, 79 | Source: 80 | // 81 | using System; 82 | 83 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 84 | sealed class ReactiveAttribute : Attribute 85 | { 86 | public ReactiveAttribute() { } 87 | } 88 | } 89 | ], 90 | Diagnostics: null 91 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/CrossAssemblyTests.BaseHasPartialReactive_DerivedExtends.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: MainLib.DerivedClass.ReactiveProperties.g.cs, 17 | Source: 18 | // 19 | #nullable enable 20 | 21 | using System.ComponentModel; 22 | using System.Runtime.CompilerServices; 23 | 24 | namespace MainLib 25 | { 26 | /// 27 | /// A partial class implementation for MainLib.DerivedClass. 28 | /// 29 | public partial class DerivedClass 30 | { 31 | private static readonly PropertyChangedEventArgs _virtualPropChangedEventArgs = new PropertyChangedEventArgs(nameof(VirtualProp)); 32 | private static readonly PropertyChangedEventArgs _derivedPropChangedEventArgs = new PropertyChangedEventArgs(nameof(DerivedProp)); 33 | 34 | public override partial string VirtualProp 35 | { 36 | get => field; 37 | set 38 | { 39 | if (!Equals(field, value)) 40 | { 41 | field = value; 42 | OnPropertyChanged(_virtualPropChangedEventArgs); 43 | } 44 | } 45 | } 46 | 47 | public partial string DerivedProp 48 | { 49 | get => field; 50 | set 51 | { 52 | if (!Equals(field, value)) 53 | { 54 | field = value; 55 | OnPropertyChanged(_derivedPropChangedEventArgs); 56 | } 57 | } 58 | } 59 | } 60 | } 61 | 62 | }, 63 | { 64 | FileName: ReactiveAttribute.g.cs, 65 | Source: 66 | // 67 | using System; 68 | 69 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 70 | sealed class ReactiveAttribute : Attribute 71 | { 72 | public ReactiveAttribute() { } 73 | } 74 | } 75 | ], 76 | Diagnostics: null 77 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/CrossAssemblyTests.BaseHasPropertyReactive_DerivedHasNoAttributes.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | } 27 | ], 28 | Diagnostics: null 29 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/CrossAssemblyTests.BaseHasReactive_DerivedHasIgnoreReactive.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | } 27 | ], 28 | Diagnostics: null 29 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/CrossAssemblyTests.BaseHasReactive_DerivedHasMixedPropertyAttributes.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: MainLib.DerivedClass.ReactiveProperties.g.cs, 17 | Source: 18 | // 19 | #nullable enable 20 | 21 | using System.ComponentModel; 22 | using System.Runtime.CompilerServices; 23 | 24 | namespace MainLib 25 | { 26 | /// 27 | /// A partial class implementation for MainLib.DerivedClass. 28 | /// 29 | public partial class DerivedClass 30 | { 31 | private static readonly PropertyChangedEventArgs _inheritedReactivePropChangedEventArgs = new PropertyChangedEventArgs(nameof(InheritedReactiveProp)); 32 | private static readonly PropertyChangedEventArgs _explicitReactivePropChangedEventArgs = new PropertyChangedEventArgs(nameof(ExplicitReactiveProp)); 33 | 34 | public partial string InheritedReactiveProp 35 | { 36 | get => field; 37 | set 38 | { 39 | if (!Equals(field, value)) 40 | { 41 | field = value; 42 | OnPropertyChanged(_inheritedReactivePropChangedEventArgs); 43 | } 44 | } 45 | } 46 | 47 | public partial string ExplicitReactiveProp 48 | { 49 | get => field; 50 | set 51 | { 52 | if (!Equals(field, value)) 53 | { 54 | field = value; 55 | OnPropertyChanged(_explicitReactivePropChangedEventArgs); 56 | } 57 | } 58 | } 59 | } 60 | } 61 | 62 | }, 63 | { 64 | FileName: ReactiveAttribute.g.cs, 65 | Source: 66 | // 67 | using System; 68 | 69 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 70 | sealed class ReactiveAttribute : Attribute 71 | { 72 | public ReactiveAttribute() { } 73 | } 74 | } 75 | ], 76 | Diagnostics: null 77 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/CrossAssemblyTests.BaseHasReactive_DerivedHasNoAttributes.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: MainLib.DerivedClass.ReactiveProperties.g.cs, 17 | Source: 18 | // 19 | #nullable enable 20 | 21 | using System.ComponentModel; 22 | using System.Runtime.CompilerServices; 23 | 24 | namespace MainLib 25 | { 26 | /// 27 | /// A partial class implementation for MainLib.DerivedClass. 28 | /// 29 | public partial class DerivedClass 30 | { 31 | private static readonly PropertyChangedEventArgs _derivedPropChangedEventArgs = new PropertyChangedEventArgs(nameof(DerivedProp)); 32 | 33 | public partial string DerivedProp 34 | { 35 | get => field; 36 | set 37 | { 38 | if (!Equals(field, value)) 39 | { 40 | field = value; 41 | OnPropertyChanged(_derivedPropChangedEventArgs); 42 | } 43 | } 44 | } 45 | } 46 | } 47 | 48 | }, 49 | { 50 | FileName: ReactiveAttribute.g.cs, 51 | Source: 52 | // 53 | using System; 54 | 55 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 56 | sealed class ReactiveAttribute : Attribute 57 | { 58 | public ReactiveAttribute() { } 59 | } 60 | } 61 | ], 62 | Diagnostics: null 63 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/CrossAssemblyTests.ExternalBaseDerivedFromReactiveObject_ThenNoDoubleINPCInDerived.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: MainLib.ChildViewModel.ReactiveProperties.g.cs, 17 | Source: 18 | // 19 | #nullable enable 20 | 21 | using ReactiveUI; 22 | 23 | namespace MainLib 24 | { 25 | /// 26 | /// A partial class implementation for MainLib.ChildViewModel. 27 | /// 28 | public partial class ChildViewModel 29 | { 30 | public partial int AnotherProp 31 | { 32 | get => field; 33 | set => this.RaiseAndSetIfChanged(ref field, value); 34 | } 35 | } 36 | } 37 | 38 | }, 39 | { 40 | FileName: ReactiveAttribute.g.cs, 41 | Source: 42 | // 43 | using System; 44 | 45 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 46 | sealed class ReactiveAttribute : Attribute 47 | { 48 | public ReactiveAttribute() { } 49 | } 50 | } 51 | ], 52 | Diagnostics: null 53 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/CrossAssemblyTests.ExternalBaseHasIgnoreReactive_ThenDerivedIgnoresItToo.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: MainLib.DerivedIgnore.ReactiveProperties.g.cs, 17 | Source: 18 | // 19 | #nullable enable 20 | 21 | using System.ComponentModel; 22 | using System.Runtime.CompilerServices; 23 | 24 | namespace MainLib 25 | { 26 | /// 27 | /// A partial class implementation for MainLib.DerivedIgnore. 28 | /// 29 | public partial class DerivedIgnore 30 | { 31 | private static readonly PropertyChangedEventArgs _extraPropChangedEventArgs = new PropertyChangedEventArgs(nameof(ExtraProp)); 32 | 33 | public partial string ExtraProp 34 | { 35 | get => field; 36 | set 37 | { 38 | if (!Equals(field, value)) 39 | { 40 | field = value; 41 | OnPropertyChanged(_extraPropChangedEventArgs); 42 | } 43 | } 44 | } 45 | } 46 | } 47 | 48 | }, 49 | { 50 | FileName: ReactiveAttribute.g.cs, 51 | Source: 52 | // 53 | using System; 54 | 55 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 56 | sealed class ReactiveAttribute : Attribute 57 | { 58 | public ReactiveAttribute() { } 59 | } 60 | } 61 | ], 62 | Diagnostics: null 63 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/CrossAssemblyTests.ExternalBaseHasPropertyLevelReactive_ThenNoExtraINPCInDerived.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: MainLib.LocalDerived.ReactiveProperties.g.cs, 17 | Source: 18 | // 19 | #nullable enable 20 | 21 | using System.ComponentModel; 22 | using System.Runtime.CompilerServices; 23 | 24 | namespace MainLib 25 | { 26 | /// 27 | /// A partial class implementation for MainLib.LocalDerived. 28 | /// 29 | public partial class LocalDerived 30 | { 31 | private static readonly PropertyChangedEventArgs _localReactivePropChangedEventArgs = new PropertyChangedEventArgs(nameof(LocalReactiveProp)); 32 | 33 | public partial int LocalReactiveProp 34 | { 35 | get => field; 36 | set 37 | { 38 | if (!Equals(field, value)) 39 | { 40 | field = value; 41 | OnPropertyChanged(_localReactivePropChangedEventArgs); 42 | } 43 | } 44 | } 45 | } 46 | } 47 | 48 | }, 49 | { 50 | FileName: ReactiveAttribute.g.cs, 51 | Source: 52 | // 53 | using System; 54 | 55 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 56 | sealed class ReactiveAttribute : Attribute 57 | { 58 | public ReactiveAttribute() { } 59 | } 60 | } 61 | ], 62 | Diagnostics: null 63 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/CrossAssemblyTests.ExternalBaseHasReactiveClass_ThenNoDoubleINPCInDerived.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: MainLib.DerivedClass.ReactiveProperties.g.cs, 17 | Source: 18 | // 19 | #nullable enable 20 | 21 | using System.ComponentModel; 22 | using System.Runtime.CompilerServices; 23 | 24 | namespace MainLib 25 | { 26 | /// 27 | /// A partial class implementation for MainLib.DerivedClass. 28 | /// 29 | public partial class DerivedClass 30 | { 31 | private static readonly PropertyChangedEventArgs _localPropChangedEventArgs = new PropertyChangedEventArgs(nameof(LocalProp)); 32 | 33 | public partial int LocalProp 34 | { 35 | get => field; 36 | set 37 | { 38 | if (!Equals(field, value)) 39 | { 40 | field = value; 41 | OnPropertyChanged(_localPropChangedEventArgs); 42 | } 43 | } 44 | } 45 | } 46 | } 47 | 48 | }, 49 | { 50 | FileName: ReactiveAttribute.g.cs, 51 | Source: 52 | // 53 | using System; 54 | 55 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 56 | sealed class ReactiveAttribute : Attribute 57 | { 58 | public ReactiveAttribute() { } 59 | } 60 | } 61 | ], 62 | Diagnostics: null 63 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ObservableAsPropertyHelperGeneratorTests.ComplexTypesTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: ObservableAsPropertyAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)] 10 | sealed class ObservableAsPropertyAttribute : Attribute 11 | { 12 | public ObservableAsPropertyAttribute() { } 13 | } 14 | 15 | }, 16 | { 17 | FileName: TestViewModel.ObservableAsProperty.g.cs, 18 | Source: 19 | // 20 | #nullable enable 21 | 22 | using System; 23 | using ReactiveUI; 24 | 25 | public partial class TestViewModel 26 | { 27 | private ObservableAsPropertyHelper> _stringListHelper; 28 | 29 | public partial global::System.Collections.Generic.List StringList 30 | { 31 | get => _stringListHelper.Value; 32 | } 33 | 34 | private ObservableAsPropertyHelper> _intStringMapHelper; 35 | 36 | public partial global::System.Collections.Generic.Dictionary IntStringMap 37 | { 38 | get => _intStringMapHelper.Value; 39 | } 40 | 41 | private ObservableAsPropertyHelper<(string Name, int Age)> _personInfoHelper; 42 | 43 | public partial (string Name, int Age) PersonInfo 44 | { 45 | get => _personInfoHelper.Value; 46 | } 47 | } 48 | 49 | } 50 | ], 51 | Diagnostics: null 52 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ObservableAsPropertyHelperGeneratorTests.DifferentAccessibilityLevelsTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: ObservableAsPropertyAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)] 10 | sealed class ObservableAsPropertyAttribute : Attribute 11 | { 12 | public ObservableAsPropertyAttribute() { } 13 | } 14 | 15 | }, 16 | { 17 | FileName: TestViewModel.ObservableAsProperty.g.cs, 18 | Source: 19 | // 20 | #nullable enable 21 | 22 | using System; 23 | using ReactiveUI; 24 | 25 | public partial class TestViewModel 26 | { 27 | private ObservableAsPropertyHelper _publicValueHelper; 28 | 29 | public partial string PublicValue 30 | { 31 | get => _publicValueHelper.Value; 32 | } 33 | 34 | private ObservableAsPropertyHelper _protectedValueHelper; 35 | 36 | protected partial string ProtectedValue 37 | { 38 | get => _protectedValueHelper.Value; 39 | } 40 | 41 | private ObservableAsPropertyHelper _privateValueHelper; 42 | 43 | private partial string PrivateValue 44 | { 45 | get => _privateValueHelper.Value; 46 | } 47 | 48 | private ObservableAsPropertyHelper _internalValueHelper; 49 | 50 | internal partial string InternalValue 51 | { 52 | get => _internalValueHelper.Value; 53 | } 54 | } 55 | 56 | } 57 | ], 58 | Diagnostics: null 59 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ObservableAsPropertyHelperGeneratorTests.GenericClassWithObservableAsPropertyTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: ObservableAsPropertyAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)] 10 | sealed class ObservableAsPropertyAttribute : Attribute 11 | { 12 | public ObservableAsPropertyAttribute() { } 13 | } 14 | 15 | }, 16 | { 17 | FileName: TestViewModel.ObservableAsProperty.g.cs, 18 | Source: 19 | // 20 | #nullable enable 21 | 22 | using System; 23 | using ReactiveUI; 24 | 25 | public partial class TestViewModel where T : class 26 | { 27 | private ObservableAsPropertyHelper _valueHelper; 28 | 29 | public partial T? Value 30 | { 31 | get => _valueHelper.Value; 32 | } 33 | } 34 | 35 | } 36 | ], 37 | Diagnostics: null 38 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ObservableAsPropertyHelperGeneratorTests.GenericConstraintsTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: ObservableAsPropertyAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)] 10 | sealed class ObservableAsPropertyAttribute : Attribute 11 | { 12 | public ObservableAsPropertyAttribute() { } 13 | } 14 | 15 | }, 16 | { 17 | FileName: TestViewModel.ObservableAsProperty.g.cs, 18 | Source: 19 | // 20 | #nullable enable 21 | 22 | using System; 23 | using ReactiveUI; 24 | 25 | public partial class TestViewModel where T : class, new() where U : struct, IComparable 26 | { 27 | private ObservableAsPropertyHelper _referenceValueHelper; 28 | 29 | public partial T? ReferenceValue 30 | { 31 | get => _referenceValueHelper.Value; 32 | } 33 | 34 | private ObservableAsPropertyHelper _valueTypeHelper; 35 | 36 | public partial U ValueType 37 | { 38 | get => _valueTypeHelper.Value; 39 | } 40 | } 41 | 42 | } 43 | ], 44 | Diagnostics: null 45 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ObservableAsPropertyHelperGeneratorTests.InheritanceTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: BaseViewModel.ObservableAsProperty.g.cs, 5 | Source: 6 | // 7 | #nullable enable 8 | 9 | using System; 10 | using ReactiveUI; 11 | 12 | public partial class BaseViewModel 13 | { 14 | private ObservableAsPropertyHelper _baseValueHelper; 15 | 16 | public partial string BaseValue 17 | { 18 | get => _baseValueHelper.Value; 19 | } 20 | } 21 | 22 | }, 23 | { 24 | FileName: DerivedViewModel.ObservableAsProperty.g.cs, 25 | Source: 26 | // 27 | #nullable enable 28 | 29 | using System; 30 | using ReactiveUI; 31 | 32 | public partial class DerivedViewModel 33 | { 34 | private ObservableAsPropertyHelper _derivedValueHelper; 35 | 36 | public partial string DerivedValue 37 | { 38 | get => _derivedValueHelper.Value; 39 | } 40 | } 41 | 42 | }, 43 | { 44 | FileName: ObservableAsPropertyAttribute.g.cs, 45 | Source: 46 | // 47 | using System; 48 | 49 | [AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)] 50 | sealed class ObservableAsPropertyAttribute : Attribute 51 | { 52 | public ObservableAsPropertyAttribute() { } 53 | } 54 | 55 | } 56 | ], 57 | Diagnostics: null 58 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ObservableAsPropertyHelperGeneratorTests.MixedAttributesTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: ObservableAsPropertyAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)] 10 | sealed class ObservableAsPropertyAttribute : Attribute 11 | { 12 | public ObservableAsPropertyAttribute() { } 13 | } 14 | 15 | }, 16 | { 17 | FileName: TestViewModel.ObservableAsProperty.g.cs, 18 | Source: 19 | // 20 | #nullable enable 21 | 22 | using System; 23 | using ReactiveUI; 24 | 25 | public partial class TestViewModel 26 | { 27 | private ObservableAsPropertyHelper _computedValueHelper; 28 | 29 | public partial string ComputedValue 30 | { 31 | get => _computedValueHelper.Value; 32 | } 33 | } 34 | 35 | } 36 | ], 37 | Diagnostics: null 38 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ObservableAsPropertyHelperGeneratorTests.MultiLevelInheritanceTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: ChildViewModel.ObservableAsProperty.g.cs, 5 | Source: 6 | // 7 | #nullable enable 8 | 9 | using System; 10 | using ReactiveUI; 11 | 12 | public partial class ChildViewModel 13 | { 14 | private ObservableAsPropertyHelper _childValueHelper; 15 | 16 | public partial string ChildValue 17 | { 18 | get => _childValueHelper.Value; 19 | } 20 | } 21 | 22 | }, 23 | { 24 | FileName: GrandParentViewModel.ObservableAsProperty.g.cs, 25 | Source: 26 | // 27 | #nullable enable 28 | 29 | using System; 30 | using ReactiveUI; 31 | 32 | public partial class GrandParentViewModel 33 | { 34 | private ObservableAsPropertyHelper _grandParentValueHelper; 35 | 36 | public partial string GrandParentValue 37 | { 38 | get => _grandParentValueHelper.Value; 39 | } 40 | } 41 | 42 | }, 43 | { 44 | FileName: ObservableAsPropertyAttribute.g.cs, 45 | Source: 46 | // 47 | using System; 48 | 49 | [AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)] 50 | sealed class ObservableAsPropertyAttribute : Attribute 51 | { 52 | public ObservableAsPropertyAttribute() { } 53 | } 54 | 55 | }, 56 | { 57 | FileName: ParentViewModel.ObservableAsProperty.g.cs, 58 | Source: 59 | // 60 | #nullable enable 61 | 62 | using System; 63 | using ReactiveUI; 64 | 65 | public partial class ParentViewModel 66 | { 67 | private ObservableAsPropertyHelper _parentValueHelper; 68 | 69 | public partial string ParentValue 70 | { 71 | get => _parentValueHelper.Value; 72 | } 73 | } 74 | 75 | } 76 | ], 77 | Diagnostics: null 78 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ObservableAsPropertyHelperGeneratorTests.MultipleNamespacesTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: First.TestViewModel.ObservableAsProperty.g.cs, 5 | Source: 6 | // 7 | #nullable enable 8 | 9 | using System; 10 | using ReactiveUI; 11 | 12 | namespace First 13 | { 14 | public partial class TestViewModel 15 | { 16 | private ObservableAsPropertyHelper _valueHelper; 17 | 18 | public partial string Value 19 | { 20 | get => _valueHelper.Value; 21 | } 22 | } 23 | } 24 | 25 | }, 26 | { 27 | FileName: ObservableAsPropertyAttribute.g.cs, 28 | Source: 29 | // 30 | using System; 31 | 32 | [AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)] 33 | sealed class ObservableAsPropertyAttribute : Attribute 34 | { 35 | public ObservableAsPropertyAttribute() { } 36 | } 37 | 38 | }, 39 | { 40 | FileName: Second.TestViewModel.ObservableAsProperty.g.cs, 41 | Source: 42 | // 43 | #nullable enable 44 | 45 | using System; 46 | using ReactiveUI; 47 | 48 | namespace Second 49 | { 50 | public partial class TestViewModel 51 | { 52 | private ObservableAsPropertyHelper _valueHelper; 53 | 54 | public partial string Value 55 | { 56 | get => _valueHelper.Value; 57 | } 58 | } 59 | } 60 | 61 | } 62 | ], 63 | Diagnostics: null 64 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ObservableAsPropertyHelperGeneratorTests.MultipleObservableAsPropertiesTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: ObservableAsPropertyAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)] 10 | sealed class ObservableAsPropertyAttribute : Attribute 11 | { 12 | public ObservableAsPropertyAttribute() { } 13 | } 14 | 15 | }, 16 | { 17 | FileName: TestViewModel.ObservableAsProperty.g.cs, 18 | Source: 19 | // 20 | #nullable enable 21 | 22 | using System; 23 | using ReactiveUI; 24 | 25 | public partial class TestViewModel 26 | { 27 | private ObservableAsPropertyHelper _firstValueHelper; 28 | 29 | public partial string FirstValue 30 | { 31 | get => _firstValueHelper.Value; 32 | } 33 | 34 | private ObservableAsPropertyHelper _secondValueHelper; 35 | 36 | public partial int SecondValue 37 | { 38 | get => _secondValueHelper.Value; 39 | } 40 | } 41 | 42 | } 43 | ], 44 | Diagnostics: null 45 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ObservableAsPropertyHelperGeneratorTests.NestedClassWithObservableAsPropertyTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: Container.NestedViewModel.ObservableAsProperty.g.cs, 5 | Source: 6 | // 7 | #nullable enable 8 | 9 | using System; 10 | using ReactiveUI; 11 | 12 | public partial class Container 13 | { 14 | public partial class NestedViewModel 15 | { 16 | private ObservableAsPropertyHelper _valueHelper; 17 | 18 | public partial string Value 19 | { 20 | get => _valueHelper.Value; 21 | } 22 | } 23 | } 24 | 25 | }, 26 | { 27 | FileName: ObservableAsPropertyAttribute.g.cs, 28 | Source: 29 | // 30 | using System; 31 | 32 | [AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)] 33 | sealed class ObservableAsPropertyAttribute : Attribute 34 | { 35 | public ObservableAsPropertyAttribute() { } 36 | } 37 | 38 | } 39 | ], 40 | Diagnostics: null 41 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ObservableAsPropertyHelperGeneratorTests.NestedGenericTypesTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: ObservableAsPropertyAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)] 10 | sealed class ObservableAsPropertyAttribute : Attribute 11 | { 12 | public ObservableAsPropertyAttribute() { } 13 | } 14 | 15 | }, 16 | { 17 | FileName: TestViewModel.ObservableAsProperty.g.cs, 18 | Source: 19 | // 20 | #nullable enable 21 | 22 | using System; 23 | using ReactiveUI; 24 | 25 | public partial class TestViewModel where T : class 26 | { 27 | private ObservableAsPropertyHelper>> _complexPropertyHelper; 28 | 29 | public partial global::System.Collections.Generic.List> ComplexProperty 30 | { 31 | get => _complexPropertyHelper.Value; 32 | } 33 | 34 | private ObservableAsPropertyHelper>> _nestedPropertyHelper; 35 | 36 | public partial global::System.Collections.Generic.Dictionary> NestedProperty 37 | { 38 | get => _nestedPropertyHelper.Value; 39 | } 40 | } 41 | 42 | } 43 | ], 44 | Diagnostics: null 45 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ObservableAsPropertyHelperGeneratorTests.NestedPrivateClassTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: Container.PrivateViewModel.ObservableAsProperty.g.cs, 5 | Source: 6 | // 7 | #nullable enable 8 | 9 | using System; 10 | using ReactiveUI; 11 | 12 | public partial class Container 13 | { 14 | private partial class PrivateViewModel 15 | { 16 | private ObservableAsPropertyHelper _valueHelper; 17 | 18 | public partial string Value 19 | { 20 | get => _valueHelper.Value; 21 | } 22 | } 23 | } 24 | 25 | }, 26 | { 27 | FileName: Container.ProtectedViewModel.ObservableAsProperty.g.cs, 28 | Source: 29 | // 30 | #nullable enable 31 | 32 | using System; 33 | using ReactiveUI; 34 | 35 | public partial class Container 36 | { 37 | protected partial class ProtectedViewModel 38 | { 39 | private ObservableAsPropertyHelper _valueHelper; 40 | 41 | public partial string Value 42 | { 43 | get => _valueHelper.Value; 44 | } 45 | } 46 | } 47 | 48 | }, 49 | { 50 | FileName: ObservableAsPropertyAttribute.g.cs, 51 | Source: 52 | // 53 | using System; 54 | 55 | [AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)] 56 | sealed class ObservableAsPropertyAttribute : Attribute 57 | { 58 | public ObservableAsPropertyAttribute() { } 59 | } 60 | 61 | } 62 | ], 63 | Diagnostics: null 64 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ObservableAsPropertyHelperGeneratorTests.NullablePropertiesTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: ObservableAsPropertyAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)] 10 | sealed class ObservableAsPropertyAttribute : Attribute 11 | { 12 | public ObservableAsPropertyAttribute() { } 13 | } 14 | 15 | }, 16 | { 17 | FileName: TestViewModel.ObservableAsProperty.g.cs, 18 | Source: 19 | // 20 | #nullable enable 21 | 22 | using System; 23 | using ReactiveUI; 24 | 25 | public partial class TestViewModel 26 | { 27 | private ObservableAsPropertyHelper _nullableStringHelper; 28 | 29 | public partial string? NullableString 30 | { 31 | get => _nullableStringHelper.Value; 32 | } 33 | 34 | private ObservableAsPropertyHelper _nullableIntHelper; 35 | 36 | public partial int? NullableInt 37 | { 38 | get => _nullableIntHelper.Value; 39 | } 40 | } 41 | 42 | } 43 | ], 44 | Diagnostics: null 45 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ObservableAsPropertyHelperGeneratorTests.ObservableAsPropertyWithComplexConstraints.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: Container.ObservableAsProperty.g.cs, 5 | Source: 6 | // 7 | #nullable enable 8 | 9 | using System; 10 | using ReactiveUI; 11 | 12 | public partial class Container where T : class? where U : struct, IComparable where V : unmanaged, struct 13 | { 14 | private ObservableAsPropertyHelper _nullableRefHelper; 15 | 16 | public partial T? NullableRef 17 | { 18 | get => _nullableRefHelper.Value; 19 | } 20 | 21 | private ObservableAsPropertyHelper _valueTypeHelper; 22 | 23 | public partial U ValueType 24 | { 25 | get => _valueTypeHelper.Value; 26 | } 27 | 28 | private ObservableAsPropertyHelper _unmanagedValueHelper; 29 | 30 | public partial V UnmanagedValue 31 | { 32 | get => _unmanagedValueHelper.Value; 33 | } 34 | } 35 | 36 | }, 37 | { 38 | FileName: ObservableAsPropertyAttribute.g.cs, 39 | Source: 40 | // 41 | using System; 42 | 43 | [AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)] 44 | sealed class ObservableAsPropertyAttribute : Attribute 45 | { 46 | public ObservableAsPropertyAttribute() { } 47 | } 48 | 49 | } 50 | ], 51 | Diagnostics: null 52 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ObservableAsPropertyHelperGeneratorTests.ObservableAsPropertyWithConstraints.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: ObservableAsPropertyAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)] 10 | sealed class ObservableAsPropertyAttribute : Attribute 11 | { 12 | public ObservableAsPropertyAttribute() { } 13 | } 14 | 15 | }, 16 | { 17 | FileName: ViewModel.ObservableAsProperty.g.cs, 18 | Source: 19 | // 20 | #nullable enable 21 | 22 | using System; 23 | using ReactiveUI; 24 | 25 | public partial class ViewModel where T : class, IDisposable where TKey : notnull 26 | { 27 | private ObservableAsPropertyHelper _computedValueHelper; 28 | 29 | public partial T? ComputedValue 30 | { 31 | get => _computedValueHelper.Value; 32 | } 33 | 34 | private ObservableAsPropertyHelper _currentKeyHelper; 35 | 36 | public partial TKey CurrentKey 37 | { 38 | get => _currentKeyHelper.Value; 39 | } 40 | } 41 | 42 | } 43 | ], 44 | Diagnostics: null 45 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ObservableAsPropertyHelperGeneratorTests.ObservableAsPropertyWithNestedGenerics.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: ObservableAsPropertyAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)] 10 | sealed class ObservableAsPropertyAttribute : Attribute 11 | { 12 | public ObservableAsPropertyAttribute() { } 13 | } 14 | 15 | }, 16 | { 17 | FileName: Outer.Inner.ObservableAsProperty.g.cs, 18 | Source: 19 | // 20 | #nullable enable 21 | 22 | using System; 23 | using ReactiveUI; 24 | 25 | public partial class Outer where T : class 26 | { 27 | public partial class Inner where U : T, new() 28 | { 29 | private ObservableAsPropertyHelper _valueHelper; 30 | 31 | public partial U? Value 32 | { 33 | get => _valueHelper.Value; 34 | } 35 | } 36 | } 37 | 38 | } 39 | ], 40 | Diagnostics: null 41 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ObservableAsPropertyHelperGeneratorTests.SimpleObservableAsPropertyTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: ObservableAsPropertyAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)] 10 | sealed class ObservableAsPropertyAttribute : Attribute 11 | { 12 | public ObservableAsPropertyAttribute() { } 13 | } 14 | 15 | }, 16 | { 17 | FileName: TestViewModel.ObservableAsProperty.g.cs, 18 | Source: 19 | // 20 | #nullable enable 21 | 22 | using System; 23 | using ReactiveUI; 24 | 25 | public partial class TestViewModel 26 | { 27 | private ObservableAsPropertyHelper _computedValueHelper; 28 | 29 | public partial string ComputedValue 30 | { 31 | get => _computedValueHelper.Value; 32 | } 33 | } 34 | 35 | } 36 | ], 37 | Diagnostics: null 38 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ObservableAsPropertyHelperGeneratorTests.StaticPropertyTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: ObservableAsPropertyAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)] 10 | sealed class ObservableAsPropertyAttribute : Attribute 11 | { 12 | public ObservableAsPropertyAttribute() { } 13 | } 14 | 15 | }, 16 | { 17 | FileName: TestViewModel.ObservableAsProperty.g.cs, 18 | Source: 19 | // 20 | #nullable enable 21 | 22 | using System; 23 | using ReactiveUI; 24 | 25 | public partial class TestViewModel 26 | { 27 | private ObservableAsPropertyHelper _staticValueHelper; 28 | 29 | public partial string StaticValue 30 | { 31 | get => _staticValueHelper.Value; 32 | } 33 | 34 | private ObservableAsPropertyHelper _instanceValueHelper; 35 | 36 | public partial string InstanceValue 37 | { 38 | get => _instanceValueHelper.Value; 39 | } 40 | } 41 | 42 | } 43 | ], 44 | Diagnostics: null 45 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.ClassInGlobalNamespace.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: GlobalClass.INPC.g.cs, 5 | Source: 6 | // 7 | #nullable enable 8 | 9 | using System.ComponentModel; 10 | using System.Runtime.CompilerServices; 11 | 12 | public partial class GlobalClass : INotifyPropertyChanged 13 | { 14 | public event PropertyChangedEventHandler? PropertyChanged; 15 | 16 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 17 | { 18 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 19 | } 20 | 21 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 22 | { 23 | PropertyChanged?.Invoke(this, args); 24 | } 25 | } 26 | 27 | }, 28 | { 29 | FileName: GlobalClass.ReactiveProperties.g.cs, 30 | Source: 31 | // 32 | #nullable enable 33 | 34 | using System.ComponentModel; 35 | using System.Runtime.CompilerServices; 36 | 37 | /// 38 | /// A partial class implementation for GlobalClass. 39 | /// 40 | public partial class GlobalClass 41 | { 42 | private static readonly PropertyChangedEventArgs _nameChangedEventArgs = new PropertyChangedEventArgs(nameof(Name)); 43 | 44 | public partial string Name 45 | { 46 | get => field; 47 | set 48 | { 49 | if (!Equals(field, value)) 50 | { 51 | field = value; 52 | OnPropertyChanged(_nameChangedEventArgs); 53 | } 54 | } 55 | } 56 | } 57 | 58 | }, 59 | { 60 | FileName: IgnoreReactiveAttribute.g.cs, 61 | Source: 62 | // 63 | using System; 64 | 65 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 66 | sealed class IgnoreReactiveAttribute : Attribute 67 | { 68 | public IgnoreReactiveAttribute() { } 69 | } 70 | }, 71 | { 72 | FileName: ReactiveAttribute.g.cs, 73 | Source: 74 | // 75 | using System; 76 | 77 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 78 | sealed class ReactiveAttribute : Attribute 79 | { 80 | public ReactiveAttribute() { } 81 | } 82 | } 83 | ], 84 | Diagnostics: null 85 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.ClassWithAbstractProperties.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: TestClass.INPC.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using System.ComponentModel; 34 | using System.Runtime.CompilerServices; 35 | 36 | public partial class TestClass : INotifyPropertyChanged 37 | { 38 | public event PropertyChangedEventHandler? PropertyChanged; 39 | 40 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 41 | { 42 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 43 | } 44 | 45 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 46 | { 47 | PropertyChanged?.Invoke(this, args); 48 | } 49 | } 50 | 51 | }, 52 | { 53 | FileName: TestClass.ReactiveProperties.g.cs, 54 | Source: 55 | // 56 | #nullable enable 57 | 58 | using System.ComponentModel; 59 | using System.Runtime.CompilerServices; 60 | 61 | /// 62 | /// A partial class implementation for TestClass. 63 | /// 64 | public partial class TestClass 65 | { 66 | private static readonly PropertyChangedEventArgs _concretePropChangedEventArgs = new PropertyChangedEventArgs(nameof(ConcreteProp)); 67 | 68 | public partial string ConcreteProp 69 | { 70 | get => field; 71 | set 72 | { 73 | if (!Equals(field, value)) 74 | { 75 | field = value; 76 | OnPropertyChanged(_concretePropChangedEventArgs); 77 | } 78 | } 79 | } 80 | } 81 | 82 | } 83 | ], 84 | Diagnostics: null 85 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.ClassWithCustomAccessorAccessibility.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: TestClass.INPC.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using System.ComponentModel; 34 | using System.Runtime.CompilerServices; 35 | 36 | public partial class TestClass : INotifyPropertyChanged 37 | { 38 | public event PropertyChangedEventHandler? PropertyChanged; 39 | 40 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 41 | { 42 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 43 | } 44 | 45 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 46 | { 47 | PropertyChanged?.Invoke(this, args); 48 | } 49 | } 50 | 51 | }, 52 | { 53 | FileName: TestClass.ReactiveProperties.g.cs, 54 | Source: 55 | // 56 | #nullable enable 57 | 58 | using System.ComponentModel; 59 | using System.Runtime.CompilerServices; 60 | 61 | /// 62 | /// A partial class implementation for TestClass. 63 | /// 64 | public partial class TestClass 65 | { 66 | private static readonly PropertyChangedEventArgs _nameChangedEventArgs = new PropertyChangedEventArgs(nameof(Name)); 67 | private static readonly PropertyChangedEventArgs _idChangedEventArgs = new PropertyChangedEventArgs(nameof(Id)); 68 | 69 | public partial string Name 70 | { 71 | get => field; 72 | private set 73 | { 74 | if (!Equals(field, value)) 75 | { 76 | field = value; 77 | OnPropertyChanged(_nameChangedEventArgs); 78 | } 79 | } 80 | } 81 | 82 | protected partial string Id 83 | { 84 | private get => field; 85 | set 86 | { 87 | if (!Equals(field, value)) 88 | { 89 | field = value; 90 | OnPropertyChanged(_idChangedEventArgs); 91 | } 92 | } 93 | } 94 | } 95 | 96 | } 97 | ], 98 | Diagnostics: null 99 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.ClassWithCustomPropertyImplementationAndReactiveAttribute.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: TestClass.INPC.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using System.ComponentModel; 34 | using System.Runtime.CompilerServices; 35 | 36 | public partial class TestClass : INotifyPropertyChanged 37 | { 38 | public event PropertyChangedEventHandler? PropertyChanged; 39 | 40 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 41 | { 42 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 43 | } 44 | 45 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 46 | { 47 | PropertyChanged?.Invoke(this, args); 48 | } 49 | } 50 | 51 | } 52 | ], 53 | Diagnostics: null 54 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.ClassWithExplicitInterfaceImplementation.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: TestClass.INPC.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using System.ComponentModel; 34 | using System.Runtime.CompilerServices; 35 | 36 | public partial class TestClass : INotifyPropertyChanged 37 | { 38 | public event PropertyChangedEventHandler? PropertyChanged; 39 | 40 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 41 | { 42 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 43 | } 44 | 45 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 46 | { 47 | PropertyChanged?.Invoke(this, args); 48 | } 49 | } 50 | 51 | }, 52 | { 53 | FileName: TestClass.ReactiveProperties.g.cs, 54 | Source: 55 | // 56 | #nullable enable 57 | 58 | using System.ComponentModel; 59 | using System.Runtime.CompilerServices; 60 | 61 | /// 62 | /// A partial class implementation for TestClass. 63 | /// 64 | public partial class TestClass 65 | { 66 | private static readonly PropertyChangedEventArgs _publicNameChangedEventArgs = new PropertyChangedEventArgs(nameof(PublicName)); 67 | 68 | public partial string PublicName 69 | { 70 | get => field; 71 | set 72 | { 73 | if (!Equals(field, value)) 74 | { 75 | field = value; 76 | OnPropertyChanged(_publicNameChangedEventArgs); 77 | } 78 | } 79 | } 80 | } 81 | 82 | } 83 | ], 84 | Diagnostics: null 85 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.ClassWithExpressionBodiedProperties.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: TestClass.INPC.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using System.ComponentModel; 34 | using System.Runtime.CompilerServices; 35 | 36 | public partial class TestClass : INotifyPropertyChanged 37 | { 38 | public event PropertyChangedEventHandler? PropertyChanged; 39 | 40 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 41 | { 42 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 43 | } 44 | 45 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 46 | { 47 | PropertyChanged?.Invoke(this, args); 48 | } 49 | } 50 | 51 | }, 52 | { 53 | FileName: TestClass.ReactiveProperties.g.cs, 54 | Source: 55 | // 56 | #nullable enable 57 | 58 | using System.ComponentModel; 59 | using System.Runtime.CompilerServices; 60 | 61 | /// 62 | /// A partial class implementation for TestClass. 63 | /// 64 | public partial class TestClass 65 | { 66 | private static readonly PropertyChangedEventArgs _editableNameChangedEventArgs = new PropertyChangedEventArgs(nameof(EditableName)); 67 | 68 | public partial string EditableName 69 | { 70 | get => field; 71 | set 72 | { 73 | if (!Equals(field, value)) 74 | { 75 | field = value; 76 | OnPropertyChanged(_editableNameChangedEventArgs); 77 | } 78 | } 79 | } 80 | } 81 | 82 | } 83 | ], 84 | Diagnostics: null 85 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.ClassWithIgnoreReactiveAttribute.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: TestClass.INPC.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using System.ComponentModel; 34 | using System.Runtime.CompilerServices; 35 | 36 | public partial class TestClass : INotifyPropertyChanged 37 | { 38 | public event PropertyChangedEventHandler? PropertyChanged; 39 | 40 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 41 | { 42 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 43 | } 44 | 45 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 46 | { 47 | PropertyChanged?.Invoke(this, args); 48 | } 49 | } 50 | 51 | }, 52 | { 53 | FileName: TestClass.ReactiveProperties.g.cs, 54 | Source: 55 | // 56 | #nullable enable 57 | 58 | using System.ComponentModel; 59 | using System.Runtime.CompilerServices; 60 | 61 | /// 62 | /// A partial class implementation for TestClass. 63 | /// 64 | public partial class TestClass 65 | { 66 | private static readonly PropertyChangedEventArgs _includedChangedEventArgs = new PropertyChangedEventArgs(nameof(Included)); 67 | 68 | public partial string Included 69 | { 70 | get => field; 71 | set 72 | { 73 | if (!Equals(field, value)) 74 | { 75 | field = value; 76 | OnPropertyChanged(_includedChangedEventArgs); 77 | } 78 | } 79 | } 80 | } 81 | 82 | } 83 | ], 84 | Diagnostics: null 85 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.ClassWithIndexers.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: TestClass.INPC.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using System.ComponentModel; 34 | using System.Runtime.CompilerServices; 35 | 36 | public partial class TestClass : INotifyPropertyChanged 37 | { 38 | public event PropertyChangedEventHandler? PropertyChanged; 39 | 40 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 41 | { 42 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 43 | } 44 | 45 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 46 | { 47 | PropertyChanged?.Invoke(this, args); 48 | } 49 | } 50 | 51 | }, 52 | { 53 | FileName: TestClass.ReactiveProperties.g.cs, 54 | Source: 55 | // 56 | #nullable enable 57 | 58 | using System.ComponentModel; 59 | using System.Runtime.CompilerServices; 60 | 61 | /// 62 | /// A partial class implementation for TestClass. 63 | /// 64 | public partial class TestClass 65 | { 66 | private static readonly PropertyChangedEventArgs _regularPropChangedEventArgs = new PropertyChangedEventArgs(nameof(RegularProp)); 67 | 68 | public partial string RegularProp 69 | { 70 | get => field; 71 | set 72 | { 73 | if (!Equals(field, value)) 74 | { 75 | field = value; 76 | OnPropertyChanged(_regularPropChangedEventArgs); 77 | } 78 | } 79 | } 80 | } 81 | 82 | } 83 | ], 84 | Diagnostics: null 85 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.ClassWithMultipleReactiveAttributes.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: TestClass.INPC.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using System.ComponentModel; 34 | using System.Runtime.CompilerServices; 35 | 36 | public partial class TestClass : INotifyPropertyChanged 37 | { 38 | public event PropertyChangedEventHandler? PropertyChanged; 39 | 40 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 41 | { 42 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 43 | } 44 | 45 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 46 | { 47 | PropertyChanged?.Invoke(this, args); 48 | } 49 | } 50 | 51 | }, 52 | { 53 | FileName: TestClass.ReactiveProperties.g.cs, 54 | Source: 55 | // 56 | #nullable enable 57 | 58 | using System.ComponentModel; 59 | using System.Runtime.CompilerServices; 60 | 61 | /// 62 | /// A partial class implementation for TestClass. 63 | /// 64 | public partial class TestClass 65 | { 66 | private static readonly PropertyChangedEventArgs _doubleDeclaredChangedEventArgs = new PropertyChangedEventArgs(nameof(DoubleDeclared)); 67 | 68 | public partial string DoubleDeclared 69 | { 70 | get => field; 71 | set 72 | { 73 | if (!Equals(field, value)) 74 | { 75 | field = value; 76 | OnPropertyChanged(_doubleDeclaredChangedEventArgs); 77 | } 78 | } 79 | } 80 | } 81 | 82 | } 83 | ], 84 | Diagnostics: null 85 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.ClassWithNestedTypes.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: OuterClass.InnerClass.INPC.g.cs, 17 | Source: 18 | // 19 | #nullable enable 20 | 21 | using System.ComponentModel; 22 | using System.Runtime.CompilerServices; 23 | 24 | public partial class OuterClass 25 | { 26 | public partial class InnerClass : INotifyPropertyChanged 27 | { 28 | public event PropertyChangedEventHandler? PropertyChanged; 29 | 30 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 31 | { 32 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 33 | } 34 | 35 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 36 | { 37 | PropertyChanged?.Invoke(this, args); 38 | } 39 | } 40 | } 41 | 42 | }, 43 | { 44 | FileName: OuterClass.InnerClass.ReactiveProperties.g.cs, 45 | Source: 46 | // 47 | #nullable enable 48 | 49 | using System.ComponentModel; 50 | using System.Runtime.CompilerServices; 51 | 52 | public partial class OuterClass 53 | { 54 | /// 55 | /// A partial class implementation for OuterClass.InnerClass. 56 | /// 57 | public partial class InnerClass 58 | { 59 | private static readonly PropertyChangedEventArgs _nameChangedEventArgs = new PropertyChangedEventArgs(nameof(Name)); 60 | 61 | public partial string Name 62 | { 63 | get => field; 64 | set 65 | { 66 | if (!Equals(field, value)) 67 | { 68 | field = value; 69 | OnPropertyChanged(_nameChangedEventArgs); 70 | } 71 | } 72 | } 73 | } 74 | } 75 | 76 | }, 77 | { 78 | FileName: ReactiveAttribute.g.cs, 79 | Source: 80 | // 81 | using System; 82 | 83 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 84 | sealed class ReactiveAttribute : Attribute 85 | { 86 | public ReactiveAttribute() { } 87 | } 88 | } 89 | ], 90 | Diagnostics: null 91 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.ClassWithNullableReferenceConstraint.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: Container.INPC.g.cs, 5 | Source: 6 | // 7 | #nullable enable 8 | 9 | using System.ComponentModel; 10 | using System.Runtime.CompilerServices; 11 | 12 | public partial class Container : INotifyPropertyChanged where T : class? 13 | { 14 | public event PropertyChangedEventHandler? PropertyChanged; 15 | 16 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 17 | { 18 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 19 | } 20 | 21 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 22 | { 23 | PropertyChanged?.Invoke(this, args); 24 | } 25 | } 26 | 27 | }, 28 | { 29 | FileName: Container.ReactiveProperties.g.cs, 30 | Source: 31 | // 32 | #nullable enable 33 | 34 | using System.ComponentModel; 35 | using System.Runtime.CompilerServices; 36 | 37 | /// 38 | /// A partial class implementation for Container{T}. 39 | /// 40 | public partial class Container where T : class? 41 | { 42 | private static readonly PropertyChangedEventArgs _valueChangedEventArgs = new PropertyChangedEventArgs(nameof(Value)); 43 | 44 | public partial T? Value 45 | { 46 | get => field; 47 | set 48 | { 49 | if (!Equals(field, value)) 50 | { 51 | field = value; 52 | OnPropertyChanged(_valueChangedEventArgs); 53 | } 54 | } 55 | } 56 | } 57 | 58 | }, 59 | { 60 | FileName: IgnoreReactiveAttribute.g.cs, 61 | Source: 62 | // 63 | using System; 64 | 65 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 66 | sealed class IgnoreReactiveAttribute : Attribute 67 | { 68 | public IgnoreReactiveAttribute() { } 69 | } 70 | }, 71 | { 72 | FileName: ReactiveAttribute.g.cs, 73 | Source: 74 | // 75 | using System; 76 | 77 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 78 | sealed class ReactiveAttribute : Attribute 79 | { 80 | public ReactiveAttribute() { } 81 | } 82 | } 83 | ], 84 | Diagnostics: null 85 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.ClassWithPropertyImplementation.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: TestClass.INPC.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using System.ComponentModel; 34 | using System.Runtime.CompilerServices; 35 | 36 | public partial class TestClass : INotifyPropertyChanged 37 | { 38 | public event PropertyChangedEventHandler? PropertyChanged; 39 | 40 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 41 | { 42 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 43 | } 44 | 45 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 46 | { 47 | PropertyChanged?.Invoke(this, args); 48 | } 49 | } 50 | 51 | }, 52 | { 53 | FileName: TestClass.ReactiveProperties.g.cs, 54 | Source: 55 | // 56 | #nullable enable 57 | 58 | using System.ComponentModel; 59 | using System.Runtime.CompilerServices; 60 | 61 | /// 62 | /// A partial class implementation for TestClass. 63 | /// 64 | public partial class TestClass 65 | { 66 | private static readonly PropertyChangedEventArgs _notImplementedChangedEventArgs = new PropertyChangedEventArgs(nameof(NotImplemented)); 67 | 68 | public partial string NotImplemented 69 | { 70 | get => field; 71 | set 72 | { 73 | if (!Equals(field, value)) 74 | { 75 | field = value; 76 | OnPropertyChanged(_notImplementedChangedEventArgs); 77 | } 78 | } 79 | } 80 | } 81 | 82 | } 83 | ], 84 | Diagnostics: null 85 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.ClassWithReactiveObjectInheritance.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: TestClass.ReactiveProperties.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using ReactiveUI; 34 | 35 | /// 36 | /// A partial class implementation for TestClass. 37 | /// 38 | public partial class TestClass 39 | { 40 | public partial string Name 41 | { 42 | get => field; 43 | set => this.RaiseAndSetIfChanged(ref field, value); 44 | } 45 | } 46 | 47 | } 48 | ], 49 | Diagnostics: null 50 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.ClassWithReadOnlyProperties.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: TestClass.INPC.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using System.ComponentModel; 34 | using System.Runtime.CompilerServices; 35 | 36 | public partial class TestClass : INotifyPropertyChanged 37 | { 38 | public event PropertyChangedEventHandler? PropertyChanged; 39 | 40 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 41 | { 42 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 43 | } 44 | 45 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 46 | { 47 | PropertyChanged?.Invoke(this, args); 48 | } 49 | } 50 | 51 | }, 52 | { 53 | FileName: TestClass.ReactiveProperties.g.cs, 54 | Source: 55 | // 56 | #nullable enable 57 | 58 | using System.ComponentModel; 59 | using System.Runtime.CompilerServices; 60 | 61 | /// 62 | /// A partial class implementation for TestClass. 63 | /// 64 | public partial class TestClass 65 | { 66 | private static readonly PropertyChangedEventArgs _readOnlyChangedEventArgs = new PropertyChangedEventArgs(nameof(ReadOnly)); 67 | private static readonly PropertyChangedEventArgs _readWriteChangedEventArgs = new PropertyChangedEventArgs(nameof(ReadWrite)); 68 | 69 | public partial string ReadOnly 70 | { 71 | get => field; 72 | } 73 | 74 | public partial string ReadWrite 75 | { 76 | get => field; 77 | set 78 | { 79 | if (!Equals(field, value)) 80 | { 81 | field = value; 82 | OnPropertyChanged(_readWriteChangedEventArgs); 83 | } 84 | } 85 | } 86 | } 87 | 88 | } 89 | ], 90 | Diagnostics: null 91 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.ClassWithUnmanagedConstraint.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: UnmanagedContainer.INPC.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using System.ComponentModel; 34 | using System.Runtime.CompilerServices; 35 | 36 | public partial class UnmanagedContainer : INotifyPropertyChanged where T : unmanaged, struct 37 | { 38 | public event PropertyChangedEventHandler? PropertyChanged; 39 | 40 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 41 | { 42 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 43 | } 44 | 45 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 46 | { 47 | PropertyChanged?.Invoke(this, args); 48 | } 49 | } 50 | 51 | }, 52 | { 53 | FileName: UnmanagedContainer.ReactiveProperties.g.cs, 54 | Source: 55 | // 56 | #nullable enable 57 | 58 | using System.ComponentModel; 59 | using System.Runtime.CompilerServices; 60 | 61 | /// 62 | /// A partial class implementation for UnmanagedContainer{T}. 63 | /// 64 | public partial class UnmanagedContainer where T : unmanaged, struct 65 | { 66 | private static readonly PropertyChangedEventArgs _valueChangedEventArgs = new PropertyChangedEventArgs(nameof(Value)); 67 | 68 | public partial T Value 69 | { 70 | get => field; 71 | set 72 | { 73 | if (!Equals(field, value)) 74 | { 75 | field = value; 76 | OnPropertyChanged(_valueChangedEventArgs); 77 | } 78 | } 79 | } 80 | } 81 | 82 | } 83 | ], 84 | Diagnostics: null 85 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.GenericPropertyImplementation.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: GenericViewModel.INPC.g.cs, 5 | Source: 6 | // 7 | #nullable enable 8 | 9 | using System.ComponentModel; 10 | using System.Runtime.CompilerServices; 11 | 12 | internal partial class GenericViewModel : INotifyPropertyChanged 13 | { 14 | public event PropertyChangedEventHandler? PropertyChanged; 15 | 16 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 17 | { 18 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 19 | } 20 | 21 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 22 | { 23 | PropertyChanged?.Invoke(this, args); 24 | } 25 | } 26 | 27 | }, 28 | { 29 | FileName: GenericViewModel.ReactiveProperties.g.cs, 30 | Source: 31 | // 32 | #nullable enable 33 | 34 | using System.ComponentModel; 35 | using System.Runtime.CompilerServices; 36 | 37 | internal partial class GenericViewModel 38 | { 39 | private static readonly PropertyChangedEventArgs _valueChangedEventArgs = new PropertyChangedEventArgs(nameof(Value)); 40 | 41 | public partial T Value 42 | { 43 | get => field; 44 | set 45 | { 46 | if (!Equals(field, value)) 47 | { 48 | field = value; 49 | OnPropertyChanged(_valueChangedEventArgs); 50 | } 51 | } 52 | } 53 | } 54 | 55 | }, 56 | { 57 | FileName: IgnoreReactiveAttribute.g.cs, 58 | Source: 59 | // 60 | using System; 61 | 62 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 63 | sealed class IgnoreReactiveAttribute : Attribute 64 | { 65 | public IgnoreReactiveAttribute() { } 66 | } 67 | }, 68 | { 69 | FileName: ReactiveAttribute.g.cs, 70 | Source: 71 | // 72 | using System; 73 | 74 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 75 | sealed class ReactiveAttribute : Attribute 76 | { 77 | public ReactiveAttribute() { } 78 | } 79 | } 80 | ], 81 | Diagnostics: null 82 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.GenericPropertyWithConstraints.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: GenericViewModel.INPC.g.cs, 5 | Source: 6 | // 7 | #nullable enable 8 | 9 | using System.ComponentModel; 10 | using System.Runtime.CompilerServices; 11 | 12 | internal partial class GenericViewModel : INotifyPropertyChanged where T : class, new() 13 | { 14 | public event PropertyChangedEventHandler? PropertyChanged; 15 | 16 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 17 | { 18 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 19 | } 20 | 21 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 22 | { 23 | PropertyChanged?.Invoke(this, args); 24 | } 25 | } 26 | 27 | }, 28 | { 29 | FileName: GenericViewModel.ReactiveProperties.g.cs, 30 | Source: 31 | // 32 | #nullable enable 33 | 34 | using System.ComponentModel; 35 | using System.Runtime.CompilerServices; 36 | 37 | internal partial class GenericViewModel where T : class, new() 38 | { 39 | private static readonly PropertyChangedEventArgs _valueChangedEventArgs = new PropertyChangedEventArgs(nameof(Value)); 40 | 41 | public partial T Value 42 | { 43 | get => field; 44 | set 45 | { 46 | if (!Equals(field, value)) 47 | { 48 | field = value; 49 | OnPropertyChanged(_valueChangedEventArgs); 50 | } 51 | } 52 | } 53 | } 54 | 55 | }, 56 | { 57 | FileName: IgnoreReactiveAttribute.g.cs, 58 | Source: 59 | // 60 | using System; 61 | 62 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 63 | sealed class IgnoreReactiveAttribute : Attribute 64 | { 65 | public IgnoreReactiveAttribute() { } 66 | } 67 | }, 68 | { 69 | FileName: ReactiveAttribute.g.cs, 70 | Source: 71 | // 72 | using System; 73 | 74 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 75 | sealed class ReactiveAttribute : Attribute 76 | { 77 | public ReactiveAttribute() { } 78 | } 79 | } 80 | ], 81 | Diagnostics: null 82 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.GenericPropertyWithCustomAccessibility.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: GenericViewModel.INPC.g.cs, 5 | Source: 6 | // 7 | #nullable enable 8 | 9 | using System.ComponentModel; 10 | using System.Runtime.CompilerServices; 11 | 12 | internal partial class GenericViewModel : INotifyPropertyChanged 13 | { 14 | public event PropertyChangedEventHandler? PropertyChanged; 15 | 16 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 17 | { 18 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 19 | } 20 | 21 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 22 | { 23 | PropertyChanged?.Invoke(this, args); 24 | } 25 | } 26 | 27 | }, 28 | { 29 | FileName: GenericViewModel.ReactiveProperties.g.cs, 30 | Source: 31 | // 32 | #nullable enable 33 | 34 | using System.ComponentModel; 35 | using System.Runtime.CompilerServices; 36 | 37 | internal partial class GenericViewModel 38 | { 39 | private static readonly PropertyChangedEventArgs _valueChangedEventArgs = new PropertyChangedEventArgs(nameof(Value)); 40 | private static readonly PropertyChangedEventArgs _protectedValueChangedEventArgs = new PropertyChangedEventArgs(nameof(ProtectedValue)); 41 | 42 | public partial T Value 43 | { 44 | get => field; 45 | private set 46 | { 47 | if (!Equals(field, value)) 48 | { 49 | field = value; 50 | OnPropertyChanged(_valueChangedEventArgs); 51 | } 52 | } 53 | } 54 | 55 | protected partial T ProtectedValue 56 | { 57 | get => field; 58 | set 59 | { 60 | if (!Equals(field, value)) 61 | { 62 | field = value; 63 | OnPropertyChanged(_protectedValueChangedEventArgs); 64 | } 65 | } 66 | } 67 | } 68 | 69 | }, 70 | { 71 | FileName: IgnoreReactiveAttribute.g.cs, 72 | Source: 73 | // 74 | using System; 75 | 76 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 77 | sealed class IgnoreReactiveAttribute : Attribute 78 | { 79 | public IgnoreReactiveAttribute() { } 80 | } 81 | }, 82 | { 83 | FileName: ReactiveAttribute.g.cs, 84 | Source: 85 | // 86 | using System; 87 | 88 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 89 | sealed class ReactiveAttribute : Attribute 90 | { 91 | public ReactiveAttribute() { } 92 | } 93 | } 94 | ], 95 | Diagnostics: null 96 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.GenericPropertyWithInitSetter.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: GenericViewModel.INPC.g.cs, 5 | Source: 6 | // 7 | #nullable enable 8 | 9 | using System.ComponentModel; 10 | using System.Runtime.CompilerServices; 11 | 12 | internal partial class GenericViewModel : INotifyPropertyChanged 13 | { 14 | public event PropertyChangedEventHandler? PropertyChanged; 15 | 16 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 17 | { 18 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 19 | } 20 | 21 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 22 | { 23 | PropertyChanged?.Invoke(this, args); 24 | } 25 | } 26 | 27 | }, 28 | { 29 | FileName: GenericViewModel.ReactiveProperties.g.cs, 30 | Source: 31 | // 32 | #nullable enable 33 | 34 | using System.ComponentModel; 35 | using System.Runtime.CompilerServices; 36 | 37 | internal partial class GenericViewModel 38 | { 39 | private static readonly PropertyChangedEventArgs _initValueChangedEventArgs = new PropertyChangedEventArgs(nameof(InitValue)); 40 | private static readonly PropertyChangedEventArgs _regularValueChangedEventArgs = new PropertyChangedEventArgs(nameof(RegularValue)); 41 | 42 | public partial T InitValue 43 | { 44 | get => field; 45 | init 46 | { 47 | if (!Equals(field, value)) 48 | { 49 | field = value; 50 | OnPropertyChanged(_initValueChangedEventArgs); 51 | } 52 | } 53 | } 54 | 55 | public partial T RegularValue 56 | { 57 | get => field; 58 | set 59 | { 60 | if (!Equals(field, value)) 61 | { 62 | field = value; 63 | OnPropertyChanged(_regularValueChangedEventArgs); 64 | } 65 | } 66 | } 67 | } 68 | 69 | }, 70 | { 71 | FileName: IgnoreReactiveAttribute.g.cs, 72 | Source: 73 | // 74 | using System; 75 | 76 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 77 | sealed class IgnoreReactiveAttribute : Attribute 78 | { 79 | public IgnoreReactiveAttribute() { } 80 | } 81 | }, 82 | { 83 | FileName: ReactiveAttribute.g.cs, 84 | Source: 85 | // 86 | using System; 87 | 88 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 89 | sealed class ReactiveAttribute : Attribute 90 | { 91 | public ReactiveAttribute() { } 92 | } 93 | } 94 | ], 95 | Diagnostics: null 96 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.GenericPropertyWithNestedTypes.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: GenericViewModel.INPC.g.cs, 5 | Source: 6 | // 7 | #nullable enable 8 | 9 | using System.ComponentModel; 10 | using System.Runtime.CompilerServices; 11 | 12 | internal partial class GenericViewModel : INotifyPropertyChanged 13 | { 14 | public event PropertyChangedEventHandler? PropertyChanged; 15 | 16 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 17 | { 18 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 19 | } 20 | 21 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 22 | { 23 | PropertyChanged?.Invoke(this, args); 24 | } 25 | } 26 | 27 | }, 28 | { 29 | FileName: GenericViewModel.ReactiveProperties.g.cs, 30 | Source: 31 | // 32 | #nullable enable 33 | 34 | using System.ComponentModel; 35 | using System.Runtime.CompilerServices; 36 | 37 | internal partial class GenericViewModel 38 | { 39 | private static readonly PropertyChangedEventArgs _listValueChangedEventArgs = new PropertyChangedEventArgs(nameof(ListValue)); 40 | private static readonly PropertyChangedEventArgs _dictValueChangedEventArgs = new PropertyChangedEventArgs(nameof(DictValue)); 41 | 42 | public partial List ListValue 43 | { 44 | get => field; 45 | set 46 | { 47 | if (!Equals(field, value)) 48 | { 49 | field = value; 50 | OnPropertyChanged(_listValueChangedEventArgs); 51 | } 52 | } 53 | } 54 | 55 | public partial Dictionary DictValue 56 | { 57 | get => field; 58 | set 59 | { 60 | if (!Equals(field, value)) 61 | { 62 | field = value; 63 | OnPropertyChanged(_dictValueChangedEventArgs); 64 | } 65 | } 66 | } 67 | } 68 | 69 | }, 70 | { 71 | FileName: IgnoreReactiveAttribute.g.cs, 72 | Source: 73 | // 74 | using System; 75 | 76 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 77 | sealed class IgnoreReactiveAttribute : Attribute 78 | { 79 | public IgnoreReactiveAttribute() { } 80 | } 81 | }, 82 | { 83 | FileName: ReactiveAttribute.g.cs, 84 | Source: 85 | // 86 | using System; 87 | 88 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 89 | sealed class ReactiveAttribute : Attribute 90 | { 91 | public ReactiveAttribute() { } 92 | } 93 | } 94 | ], 95 | Diagnostics: null 96 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.GenericPropertyWithNullableType.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: GenericViewModel.INPC.g.cs, 5 | Source: 6 | // 7 | #nullable enable 8 | 9 | using System.ComponentModel; 10 | using System.Runtime.CompilerServices; 11 | 12 | internal partial class GenericViewModel : INotifyPropertyChanged where T : class 13 | { 14 | public event PropertyChangedEventHandler? PropertyChanged; 15 | 16 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 17 | { 18 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 19 | } 20 | 21 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 22 | { 23 | PropertyChanged?.Invoke(this, args); 24 | } 25 | } 26 | 27 | }, 28 | { 29 | FileName: GenericViewModel.ReactiveProperties.g.cs, 30 | Source: 31 | // 32 | #nullable enable 33 | 34 | using System.ComponentModel; 35 | using System.Runtime.CompilerServices; 36 | 37 | internal partial class GenericViewModel where T : class 38 | { 39 | private static readonly PropertyChangedEventArgs _valueChangedEventArgs = new PropertyChangedEventArgs(nameof(Value)); 40 | 41 | public partial T? Value 42 | { 43 | get => field; 44 | set 45 | { 46 | if (!Equals(field, value)) 47 | { 48 | field = value; 49 | OnPropertyChanged(_valueChangedEventArgs); 50 | } 51 | } 52 | } 53 | } 54 | 55 | }, 56 | { 57 | FileName: IgnoreReactiveAttribute.g.cs, 58 | Source: 59 | // 60 | using System; 61 | 62 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 63 | sealed class IgnoreReactiveAttribute : Attribute 64 | { 65 | public IgnoreReactiveAttribute() { } 66 | } 67 | }, 68 | { 69 | FileName: ReactiveAttribute.g.cs, 70 | Source: 71 | // 72 | using System; 73 | 74 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 75 | sealed class ReactiveAttribute : Attribute 76 | { 77 | public ReactiveAttribute() { } 78 | } 79 | } 80 | ], 81 | Diagnostics: null 82 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.GenericPropertyWithReactiveObjectBase.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: GenericViewModel.ReactiveProperties.g.cs, 5 | Source: 6 | // 7 | #nullable enable 8 | 9 | using ReactiveUI; 10 | 11 | internal partial class GenericViewModel where T : class 12 | { 13 | public partial T? Value 14 | { 15 | get => field; 16 | set => this.RaiseAndSetIfChanged(ref field, value); 17 | } 18 | } 19 | 20 | }, 21 | { 22 | FileName: IgnoreReactiveAttribute.g.cs, 23 | Source: 24 | // 25 | using System; 26 | 27 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 28 | sealed class IgnoreReactiveAttribute : Attribute 29 | { 30 | public IgnoreReactiveAttribute() { } 31 | } 32 | }, 33 | { 34 | FileName: ReactiveAttribute.g.cs, 35 | Source: 36 | // 37 | using System; 38 | 39 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 40 | sealed class ReactiveAttribute : Attribute 41 | { 42 | public ReactiveAttribute() { } 43 | } 44 | } 45 | ], 46 | Diagnostics: null 47 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.GenericPropertyWithReadOnlyAccess.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: GenericViewModel.INPC.g.cs, 5 | Source: 6 | // 7 | #nullable enable 8 | 9 | using System.ComponentModel; 10 | using System.Runtime.CompilerServices; 11 | 12 | internal partial class GenericViewModel : INotifyPropertyChanged 13 | { 14 | public event PropertyChangedEventHandler? PropertyChanged; 15 | 16 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 17 | { 18 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 19 | } 20 | 21 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 22 | { 23 | PropertyChanged?.Invoke(this, args); 24 | } 25 | } 26 | 27 | }, 28 | { 29 | FileName: GenericViewModel.ReactiveProperties.g.cs, 30 | Source: 31 | // 32 | #nullable enable 33 | 34 | using System.ComponentModel; 35 | using System.Runtime.CompilerServices; 36 | 37 | internal partial class GenericViewModel 38 | { 39 | private static readonly PropertyChangedEventArgs _valueChangedEventArgs = new PropertyChangedEventArgs(nameof(Value)); 40 | private static readonly PropertyChangedEventArgs _readWriteValueChangedEventArgs = new PropertyChangedEventArgs(nameof(ReadWriteValue)); 41 | 42 | public partial T Value 43 | { 44 | get => field; 45 | } 46 | 47 | public partial T ReadWriteValue 48 | { 49 | get => field; 50 | set 51 | { 52 | if (!Equals(field, value)) 53 | { 54 | field = value; 55 | OnPropertyChanged(_readWriteValueChangedEventArgs); 56 | } 57 | } 58 | } 59 | } 60 | 61 | }, 62 | { 63 | FileName: IgnoreReactiveAttribute.g.cs, 64 | Source: 65 | // 66 | using System; 67 | 68 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 69 | sealed class IgnoreReactiveAttribute : Attribute 70 | { 71 | public IgnoreReactiveAttribute() { } 72 | } 73 | }, 74 | { 75 | FileName: ReactiveAttribute.g.cs, 76 | Source: 77 | // 78 | using System; 79 | 80 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 81 | sealed class ReactiveAttribute : Attribute 82 | { 83 | public ReactiveAttribute() { } 84 | } 85 | } 86 | ], 87 | Diagnostics: null 88 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.InitAccessorTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: Person.INPC.g.cs, 17 | Source: 18 | // 19 | #nullable enable 20 | 21 | using System.ComponentModel; 22 | using System.Runtime.CompilerServices; 23 | 24 | public partial class Person : INotifyPropertyChanged 25 | { 26 | public event PropertyChangedEventHandler? PropertyChanged; 27 | 28 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 29 | { 30 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 31 | } 32 | 33 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 34 | { 35 | PropertyChanged?.Invoke(this, args); 36 | } 37 | } 38 | 39 | }, 40 | { 41 | FileName: Person.ReactiveProperties.g.cs, 42 | Source: 43 | // 44 | #nullable enable 45 | 46 | using System.ComponentModel; 47 | using System.Runtime.CompilerServices; 48 | 49 | /// 50 | /// A partial class implementation for Person. 51 | /// 52 | public partial class Person 53 | { 54 | private static readonly PropertyChangedEventArgs _nameChangedEventArgs = new PropertyChangedEventArgs(nameof(Name)); 55 | private static readonly PropertyChangedEventArgs _idChangedEventArgs = new PropertyChangedEventArgs(nameof(Id)); 56 | 57 | public partial string Name 58 | { 59 | get => field; 60 | init 61 | { 62 | if (!Equals(field, value)) 63 | { 64 | field = value; 65 | OnPropertyChanged(_nameChangedEventArgs); 66 | } 67 | } 68 | } 69 | 70 | public required partial string Id 71 | { 72 | get => field; 73 | init 74 | { 75 | if (!Equals(field, value)) 76 | { 77 | field = value; 78 | OnPropertyChanged(_idChangedEventArgs); 79 | } 80 | } 81 | } 82 | } 83 | 84 | }, 85 | { 86 | FileName: ReactiveAttribute.g.cs, 87 | Source: 88 | // 89 | using System; 90 | 91 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 92 | sealed class ReactiveAttribute : Attribute 93 | { 94 | public ReactiveAttribute() { } 95 | } 96 | } 97 | ], 98 | Diagnostics: null 99 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.MultiLevelNestedClassesWithReactiveProperties.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: Level1.Level2.INPC.g.cs, 17 | Source: 18 | // 19 | #nullable enable 20 | 21 | using System.ComponentModel; 22 | using System.Runtime.CompilerServices; 23 | 24 | public partial class Level1 25 | { 26 | public partial class Level2 : INotifyPropertyChanged 27 | { 28 | public event PropertyChangedEventHandler? PropertyChanged; 29 | 30 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 31 | { 32 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 33 | } 34 | 35 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 36 | { 37 | PropertyChanged?.Invoke(this, args); 38 | } 39 | } 40 | } 41 | 42 | }, 43 | { 44 | FileName: Level1.Level2.ReactiveProperties.g.cs, 45 | Source: 46 | // 47 | #nullable enable 48 | 49 | using System.ComponentModel; 50 | using System.Runtime.CompilerServices; 51 | 52 | public partial class Level1 53 | { 54 | /// 55 | /// A partial class implementation for Level1.Level2. 56 | /// 57 | public partial class Level2 58 | { 59 | private static readonly PropertyChangedEventArgs _level2PropChangedEventArgs = new PropertyChangedEventArgs(nameof(Level2Prop)); 60 | 61 | public partial string Level2Prop 62 | { 63 | get => field; 64 | set 65 | { 66 | if (!Equals(field, value)) 67 | { 68 | field = value; 69 | OnPropertyChanged(_level2PropChangedEventArgs); 70 | } 71 | } 72 | } 73 | } 74 | } 75 | 76 | }, 77 | { 78 | FileName: ReactiveAttribute.g.cs, 79 | Source: 80 | // 81 | using System; 82 | 83 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 84 | sealed class ReactiveAttribute : Attribute 85 | { 86 | public ReactiveAttribute() { } 87 | } 88 | } 89 | ], 90 | Diagnostics: null 91 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.NestedClassesWithCustomPropertyImplementation.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: Container.Nested.INPC.g.cs, 5 | Source: 6 | // 7 | #nullable enable 8 | 9 | using System.ComponentModel; 10 | using System.Runtime.CompilerServices; 11 | 12 | public partial class Container 13 | { 14 | public partial class Nested : INotifyPropertyChanged 15 | { 16 | public event PropertyChangedEventHandler? PropertyChanged; 17 | 18 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 19 | { 20 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 21 | } 22 | 23 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 24 | { 25 | PropertyChanged?.Invoke(this, args); 26 | } 27 | } 28 | } 29 | 30 | }, 31 | { 32 | FileName: Container.Nested.ReactiveProperties.g.cs, 33 | Source: 34 | // 35 | #nullable enable 36 | 37 | using System.ComponentModel; 38 | using System.Runtime.CompilerServices; 39 | 40 | public partial class Container 41 | { 42 | /// 43 | /// A partial class implementation for Container.Nested. 44 | /// 45 | public partial class Nested 46 | { 47 | private static readonly PropertyChangedEventArgs _regularPropChangedEventArgs = new PropertyChangedEventArgs(nameof(RegularProp)); 48 | 49 | public partial string RegularProp 50 | { 51 | get => field; 52 | set 53 | { 54 | if (!Equals(field, value)) 55 | { 56 | field = value; 57 | OnPropertyChanged(_regularPropChangedEventArgs); 58 | } 59 | } 60 | } 61 | } 62 | } 63 | 64 | }, 65 | { 66 | FileName: IgnoreReactiveAttribute.g.cs, 67 | Source: 68 | // 69 | using System; 70 | 71 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 72 | sealed class IgnoreReactiveAttribute : Attribute 73 | { 74 | public IgnoreReactiveAttribute() { } 75 | } 76 | }, 77 | { 78 | FileName: ReactiveAttribute.g.cs, 79 | Source: 80 | // 81 | using System; 82 | 83 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 84 | sealed class ReactiveAttribute : Attribute 85 | { 86 | public ReactiveAttribute() { } 87 | } 88 | } 89 | ], 90 | Diagnostics: null 91 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.NestedClassesWithReactiveObjectInheritance.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: Container.NestedReactiveViewModel.ReactiveProperties.g.cs, 5 | Source: 6 | // 7 | #nullable enable 8 | 9 | using ReactiveUI; 10 | 11 | public partial class Container 12 | { 13 | /// 14 | /// A partial class implementation for Container.NestedReactiveViewModel. 15 | /// 16 | public partial class NestedReactiveViewModel 17 | { 18 | public partial string ViewModelProp 19 | { 20 | get => field; 21 | set => this.RaiseAndSetIfChanged(ref field, value); 22 | } 23 | } 24 | } 25 | 26 | }, 27 | { 28 | FileName: IgnoreReactiveAttribute.g.cs, 29 | Source: 30 | // 31 | using System; 32 | 33 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 34 | sealed class IgnoreReactiveAttribute : Attribute 35 | { 36 | public IgnoreReactiveAttribute() { } 37 | } 38 | }, 39 | { 40 | FileName: ReactiveAttribute.g.cs, 41 | Source: 42 | // 43 | using System; 44 | 45 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 46 | sealed class ReactiveAttribute : Attribute 47 | { 48 | public ReactiveAttribute() { } 49 | } 50 | } 51 | ], 52 | Diagnostics: null 53 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.NonReactiveObjectWithMixedProperties.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: RegularClass.INPC.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using System.ComponentModel; 34 | using System.Runtime.CompilerServices; 35 | 36 | public partial class RegularClass : INotifyPropertyChanged 37 | { 38 | public event PropertyChangedEventHandler? PropertyChanged; 39 | 40 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 41 | { 42 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 43 | } 44 | 45 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 46 | { 47 | PropertyChanged?.Invoke(this, args); 48 | } 49 | } 50 | 51 | }, 52 | { 53 | FileName: RegularClass.ReactiveProperties.g.cs, 54 | Source: 55 | // 56 | #nullable enable 57 | 58 | using System.ComponentModel; 59 | using System.Runtime.CompilerServices; 60 | 61 | /// 62 | /// A partial class implementation for RegularClass. 63 | /// 64 | public partial class RegularClass 65 | { 66 | private static readonly PropertyChangedEventArgs _reactivePropertyChangedEventArgs = new PropertyChangedEventArgs(nameof(ReactiveProperty)); 67 | 68 | public partial string ReactiveProperty 69 | { 70 | get => field; 71 | set 72 | { 73 | if (!Equals(field, value)) 74 | { 75 | field = value; 76 | OnPropertyChanged(_reactivePropertyChangedEventArgs); 77 | } 78 | } 79 | } 80 | } 81 | 82 | } 83 | ], 84 | Diagnostics: null 85 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.ReactiveObjectDerivedWithComplexProperties.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: TestViewModel.ReactiveProperties.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using ReactiveUI; 34 | 35 | /// 36 | /// A partial class implementation for TestViewModel. 37 | /// 38 | public partial class TestViewModel 39 | { 40 | public partial global::System.Collections.ObjectModel.ObservableCollection Items 41 | { 42 | get => field; 43 | set => this.RaiseAndSetIfChanged(ref field, value); 44 | } 45 | 46 | public partial Dictionary> ComplexData 47 | { 48 | get => field; 49 | set => this.RaiseAndSetIfChanged(ref field, value); 50 | } 51 | 52 | public partial (string Name, int Count) TupleData 53 | { 54 | get => field; 55 | set => this.RaiseAndSetIfChanged(ref field, value); 56 | } 57 | } 58 | 59 | } 60 | ], 61 | Diagnostics: null 62 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.ReactiveObjectDerivedWithCustomImplementations.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: TestViewModel.ReactiveProperties.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using ReactiveUI; 34 | 35 | /// 36 | /// A partial class implementation for TestViewModel. 37 | /// 38 | public partial class TestViewModel 39 | { 40 | public partial string RegularProp 41 | { 42 | get => field; 43 | set => this.RaiseAndSetIfChanged(ref field, value); 44 | } 45 | } 46 | 47 | } 48 | ], 49 | Diagnostics: null 50 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.ReactiveObjectDerivedWithInheritance.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: BaseViewModel.ReactiveProperties.g.cs, 5 | Source: 6 | // 7 | #nullable enable 8 | 9 | using ReactiveUI; 10 | 11 | /// 12 | /// A partial class implementation for BaseViewModel. 13 | /// 14 | public partial class BaseViewModel 15 | { 16 | public partial string BaseProp 17 | { 18 | get => field; 19 | set => this.RaiseAndSetIfChanged(ref field, value); 20 | } 21 | } 22 | 23 | }, 24 | { 25 | FileName: DerivedViewModel.ReactiveProperties.g.cs, 26 | Source: 27 | // 28 | #nullable enable 29 | 30 | using ReactiveUI; 31 | 32 | /// 33 | /// A partial class implementation for DerivedViewModel. 34 | /// 35 | public partial class DerivedViewModel 36 | { 37 | public partial string DerivedProp 38 | { 39 | get => field; 40 | set => this.RaiseAndSetIfChanged(ref field, value); 41 | } 42 | } 43 | 44 | }, 45 | { 46 | FileName: GrandChildViewModel.ReactiveProperties.g.cs, 47 | Source: 48 | // 49 | #nullable enable 50 | 51 | using ReactiveUI; 52 | 53 | /// 54 | /// A partial class implementation for GrandChildViewModel. 55 | /// 56 | public partial class GrandChildViewModel 57 | { 58 | public partial string GrandChildProp 59 | { 60 | get => field; 61 | set => this.RaiseAndSetIfChanged(ref field, value); 62 | } 63 | } 64 | 65 | }, 66 | { 67 | FileName: IgnoreReactiveAttribute.g.cs, 68 | Source: 69 | // 70 | using System; 71 | 72 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 73 | sealed class IgnoreReactiveAttribute : Attribute 74 | { 75 | public IgnoreReactiveAttribute() { } 76 | } 77 | }, 78 | { 79 | FileName: ReactiveAttribute.g.cs, 80 | Source: 81 | // 82 | using System; 83 | 84 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 85 | sealed class ReactiveAttribute : Attribute 86 | { 87 | public ReactiveAttribute() { } 88 | } 89 | } 90 | ], 91 | Diagnostics: null 92 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.ReactiveObjectDerivedWithInitProperties.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: TestViewModel.ReactiveProperties.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using ReactiveUI; 34 | 35 | /// 36 | /// A partial class implementation for TestViewModel. 37 | /// 38 | public partial class TestViewModel 39 | { 40 | public partial string ReadWriteProp 41 | { 42 | get => field; 43 | set => this.RaiseAndSetIfChanged(ref field, value); 44 | } 45 | 46 | public partial string InitOnlyProp 47 | { 48 | get => field; 49 | init => this.RaiseAndSetIfChanged(ref field, value); 50 | } 51 | 52 | public partial string GetOnlyProp 53 | { 54 | get => field; 55 | } 56 | } 57 | 58 | } 59 | ], 60 | Diagnostics: null 61 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.ReactiveObjectDerivedWithObservableProperties.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: TestViewModel.ReactiveProperties.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using ReactiveUI; 34 | 35 | /// 36 | /// A partial class implementation for TestViewModel. 37 | /// 38 | public partial class TestViewModel 39 | { 40 | public partial string Name 41 | { 42 | get => field; 43 | set => this.RaiseAndSetIfChanged(ref field, value); 44 | } 45 | 46 | public partial int Age 47 | { 48 | get => field; 49 | set => this.RaiseAndSetIfChanged(ref field, value); 50 | } 51 | } 52 | 53 | } 54 | ], 55 | Diagnostics: null 56 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.ReactiveObjectWithClassLevelReactive.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: ReactiveViewModel.ReactiveProperties.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using ReactiveUI; 34 | 35 | internal partial class ReactiveViewModel 36 | { 37 | public partial string FirstName 38 | { 39 | get => field; 40 | set => this.RaiseAndSetIfChanged(ref field, value); 41 | } 42 | 43 | public partial string LastName 44 | { 45 | get => field; 46 | set => this.RaiseAndSetIfChanged(ref field, value); 47 | } 48 | } 49 | 50 | } 51 | ], 52 | Diagnostics: null 53 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.ReactiveObjectWithClassLevelReactiveAndIgnoreOverride.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: AllReactiveViewModel.ReactiveProperties.g.cs, 5 | Source: 6 | // 7 | #nullable enable 8 | 9 | using ReactiveUI; 10 | 11 | /// 12 | /// A partial class implementation for AllReactiveViewModel. 13 | /// 14 | public partial class AllReactiveViewModel 15 | { 16 | public partial string Property1 17 | { 18 | get => field; 19 | set => this.RaiseAndSetIfChanged(ref field, value); 20 | } 21 | 22 | public partial string Property2 23 | { 24 | get => field; 25 | set => this.RaiseAndSetIfChanged(ref field, value); 26 | } 27 | } 28 | 29 | }, 30 | { 31 | FileName: IgnoreReactiveAttribute.g.cs, 32 | Source: 33 | // 34 | using System; 35 | 36 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 37 | sealed class IgnoreReactiveAttribute : Attribute 38 | { 39 | public IgnoreReactiveAttribute() { } 40 | } 41 | }, 42 | { 43 | FileName: ReactiveAttribute.g.cs, 44 | Source: 45 | // 46 | using System; 47 | 48 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 49 | sealed class ReactiveAttribute : Attribute 50 | { 51 | public ReactiveAttribute() { } 52 | } 53 | } 54 | ], 55 | Diagnostics: null 56 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.ReactiveObjectWithMixedReactiveProperties.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: MixedViewModel.ReactiveProperties.g.cs, 17 | Source: 18 | // 19 | #nullable enable 20 | 21 | using ReactiveUI; 22 | 23 | /// 24 | /// A partial class implementation for MixedViewModel. 25 | /// 26 | public partial class MixedViewModel 27 | { 28 | public partial string ReactiveProperty 29 | { 30 | get => field; 31 | set => this.RaiseAndSetIfChanged(ref field, value); 32 | } 33 | 34 | public partial int? NullableReactiveProperty 35 | { 36 | get => field; 37 | set => this.RaiseAndSetIfChanged(ref field, value); 38 | } 39 | } 40 | 41 | }, 42 | { 43 | FileName: ReactiveAttribute.g.cs, 44 | Source: 45 | // 46 | using System; 47 | 48 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 49 | sealed class ReactiveAttribute : Attribute 50 | { 51 | public ReactiveAttribute() { } 52 | } 53 | } 54 | ], 55 | Diagnostics: null 56 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.ReactiveObjectWithPropertyInitializer.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: InitializedViewModel.ReactiveProperties.g.cs, 17 | Source: 18 | // 19 | #nullable enable 20 | 21 | using ReactiveUI; 22 | 23 | /// 24 | /// A partial class implementation for InitializedViewModel. 25 | /// 26 | public partial class InitializedViewModel 27 | { 28 | public partial string Name 29 | { 30 | get => field; 31 | set => this.RaiseAndSetIfChanged(ref field, value); 32 | } 33 | 34 | public partial int Count 35 | { 36 | get => field; 37 | set => this.RaiseAndSetIfChanged(ref field, value); 38 | } 39 | } 40 | 41 | }, 42 | { 43 | FileName: ReactiveAttribute.g.cs, 44 | Source: 45 | // 46 | using System; 47 | 48 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 49 | sealed class ReactiveAttribute : Attribute 50 | { 51 | public ReactiveAttribute() { } 52 | } 53 | } 54 | ], 55 | Diagnostics: null 56 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.ReactiveObjectWithSingleReactiveProperty.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: Car.ReactiveProperties.g.cs, 5 | Source: 6 | // 7 | #nullable enable 8 | 9 | using ReactiveUI; 10 | 11 | /// 12 | /// A partial class implementation for Car. 13 | /// 14 | public partial class Car 15 | { 16 | public partial string? Make 17 | { 18 | get => field; 19 | set => this.RaiseAndSetIfChanged(ref field, value); 20 | } 21 | } 22 | 23 | }, 24 | { 25 | FileName: IgnoreReactiveAttribute.g.cs, 26 | Source: 27 | // 28 | using System; 29 | 30 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 31 | sealed class IgnoreReactiveAttribute : Attribute 32 | { 33 | public IgnoreReactiveAttribute() { } 34 | } 35 | }, 36 | { 37 | FileName: ReactiveAttribute.g.cs, 38 | Source: 39 | // 40 | using System; 41 | 42 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 43 | sealed class ReactiveAttribute : Attribute 44 | { 45 | public ReactiveAttribute() { } 46 | } 47 | } 48 | ], 49 | Diagnostics: null 50 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.ReactiveObjectWithoutAnyReactiveAttribute.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | } 27 | ], 28 | Diagnostics: null 29 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.RequiredPropertyWithReactiveObjectTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: Person.ReactiveProperties.g.cs, 17 | Source: 18 | // 19 | #nullable enable 20 | 21 | using ReactiveUI; 22 | 23 | /// 24 | /// A partial class implementation for Person. 25 | /// 26 | public partial class Person 27 | { 28 | public required partial string Name 29 | { 30 | get => field; 31 | set => this.RaiseAndSetIfChanged(ref field, value); 32 | } 33 | 34 | public required partial DateOnly BirthDate 35 | { 36 | get => field; 37 | set => this.RaiseAndSetIfChanged(ref field, value); 38 | } 39 | } 40 | 41 | }, 42 | { 43 | FileName: ReactiveAttribute.g.cs, 44 | Source: 45 | // 46 | using System; 47 | 48 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 49 | sealed class ReactiveAttribute : Attribute 50 | { 51 | public ReactiveAttribute() { } 52 | } 53 | } 54 | ], 55 | Diagnostics: null 56 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.SimpleClassWithReactiveAttribute.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: TestClass.INPC.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using System.ComponentModel; 34 | using System.Runtime.CompilerServices; 35 | 36 | public partial class TestClass : INotifyPropertyChanged 37 | { 38 | public event PropertyChangedEventHandler? PropertyChanged; 39 | 40 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 41 | { 42 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 43 | } 44 | 45 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 46 | { 47 | PropertyChanged?.Invoke(this, args); 48 | } 49 | } 50 | 51 | }, 52 | { 53 | FileName: TestClass.ReactiveProperties.g.cs, 54 | Source: 55 | // 56 | #nullable enable 57 | 58 | using System.ComponentModel; 59 | using System.Runtime.CompilerServices; 60 | 61 | /// 62 | /// A partial class implementation for TestClass. 63 | /// 64 | public partial class TestClass 65 | { 66 | private static readonly PropertyChangedEventArgs _nameChangedEventArgs = new PropertyChangedEventArgs(nameof(Name)); 67 | 68 | public partial string Name 69 | { 70 | get => field; 71 | set 72 | { 73 | if (!Equals(field, value)) 74 | { 75 | field = value; 76 | OnPropertyChanged(_nameChangedEventArgs); 77 | } 78 | } 79 | } 80 | } 81 | 82 | } 83 | ], 84 | Diagnostics: null 85 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.StaticPropertyTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: TestClass.INPC.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using System.ComponentModel; 34 | using System.Runtime.CompilerServices; 35 | 36 | public partial class TestClass : INotifyPropertyChanged 37 | { 38 | public event PropertyChangedEventHandler? PropertyChanged; 39 | 40 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 41 | { 42 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 43 | } 44 | 45 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 46 | { 47 | PropertyChanged?.Invoke(this, args); 48 | } 49 | } 50 | 51 | }, 52 | { 53 | FileName: TestClass.ReactiveProperties.g.cs, 54 | Source: 55 | // 56 | #nullable enable 57 | 58 | using System.ComponentModel; 59 | using System.Runtime.CompilerServices; 60 | 61 | /// 62 | /// A partial class implementation for TestClass. 63 | /// 64 | public partial class TestClass 65 | { 66 | private static readonly PropertyChangedEventArgs _globalConfigChangedEventArgs = new PropertyChangedEventArgs(nameof(GlobalConfig)); 67 | private static readonly PropertyChangedEventArgs _counterChangedEventArgs = new PropertyChangedEventArgs(nameof(Counter)); 68 | 69 | public static partial string GlobalConfig 70 | { 71 | get => field; 72 | set 73 | { 74 | if (!Equals(field, value)) 75 | { 76 | field = value; 77 | OnPropertyChanged(_globalConfigChangedEventArgs); 78 | } 79 | } 80 | } 81 | 82 | private static partial int Counter 83 | { 84 | get => field; 85 | set 86 | { 87 | if (!Equals(field, value)) 88 | { 89 | field = value; 90 | OnPropertyChanged(_counterChangedEventArgs); 91 | } 92 | } 93 | } 94 | } 95 | 96 | } 97 | ], 98 | Diagnostics: null 99 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactiveGeneratorTests.UseLegacyModeTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: TestClass.INPC.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using System.ComponentModel; 34 | using System.Runtime.CompilerServices; 35 | 36 | public partial class TestClass : INotifyPropertyChanged 37 | { 38 | public event PropertyChangedEventHandler? PropertyChanged; 39 | 40 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 41 | { 42 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 43 | } 44 | 45 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 46 | { 47 | PropertyChanged?.Invoke(this, args); 48 | } 49 | } 50 | 51 | }, 52 | { 53 | FileName: TestClass.ReactiveProperties.g.cs, 54 | Source: 55 | // 56 | #nullable enable 57 | 58 | using System.ComponentModel; 59 | using System.Runtime.CompilerServices; 60 | 61 | /// 62 | /// A partial class implementation for TestClass. 63 | /// 64 | public partial class TestClass 65 | { 66 | private string _name; 67 | 68 | private static readonly PropertyChangedEventArgs _nameChangedEventArgs = new PropertyChangedEventArgs(nameof(Name)); 69 | 70 | public partial string Name 71 | { 72 | get => _name; 73 | set 74 | { 75 | if (!Equals(_name, value)) 76 | { 77 | _name = value; 78 | OnPropertyChanged(_nameChangedEventArgs); 79 | } 80 | } 81 | } 82 | } 83 | 84 | } 85 | ], 86 | Diagnostics: null 87 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactivePropertyAnalyzerTests.BackingFieldUsedElsewhereTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Diagnostics: [ 3 | { 4 | Id: REACTIVE001, 5 | Severity: Info, 6 | Location: { 7 | _line: 6, 8 | _character: 16 9 | }, 10 | Message: Property 'Value' can be simplified using [Reactive] attribute 11 | } 12 | ], 13 | FixedSource: 14 | using ReactiveUI; 15 | 16 | public partial class TestViewModel : ReactiveObject 17 | { 18 | 19 | [Reactive] 20 | public partial string Value { get; set; } 21 | 22 | public string GetValueDirectly() => _value; 23 | } 24 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactivePropertyAnalyzerTests.CustomAccessibilityFixTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Diagnostics: [ 3 | { 4 | Id: REACTIVE001, 5 | Severity: Info, 6 | Location: { 7 | _line: 6, 8 | _character: 16 9 | }, 10 | Message: Property 'Value' can be simplified using [Reactive] attribute 11 | } 12 | ], 13 | FixedSource: 14 | using ReactiveUI; 15 | 16 | public partial class TestViewModel : ReactiveObject 17 | { 18 | 19 | [Reactive] 20 | public partial string Value { protected get; private set; } 21 | } 22 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactivePropertyAnalyzerTests.CustomAccessorAccessibilityTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Diagnostics: [ 3 | { 4 | Id: REACTIVE001, 5 | Severity: Info, 6 | Location: { 7 | _line: 6, 8 | _character: 16 9 | }, 10 | Message: Property 'Value' can be simplified using [Reactive] attribute 11 | } 12 | ], 13 | FixedSource: 14 | using ReactiveUI; 15 | 16 | public partial class TestViewModel : ReactiveObject 17 | { 18 | 19 | [Reactive] 20 | public partial string Value { protected get; private set; } 21 | } 22 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactivePropertyAnalyzerTests.DocumentWideFixTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Diagnostics: [ 3 | { 4 | Id: REACTIVE001, 5 | Severity: Info, 6 | Location: { 7 | _line: 6, 8 | _character: 16 9 | }, 10 | Message: Property 'First' can be simplified using [Reactive] attribute 11 | }, 12 | { 13 | Id: REACTIVE001, 14 | Severity: Info, 15 | Location: { 16 | _line: 13, 17 | _character: 16 18 | }, 19 | Message: Property 'Second' can be simplified using [Reactive] attribute 20 | } 21 | ], 22 | FixedSource: 23 | using ReactiveUI; 24 | 25 | public partial class TestViewModel : ReactiveObject 26 | { 27 | 28 | [Reactive] 29 | public partial string First { get; set; } 30 | [Reactive] 31 | public partial int Second { get; set; } 32 | public string NonReactiveProperty { get; set; } 33 | } 34 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactivePropertyAnalyzerTests.FieldRemovalTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Diagnostics: [ 3 | { 4 | Id: REACTIVE001, 5 | Severity: Info, 6 | Location: { 7 | _line: 6, 8 | _character: 12 9 | }, 10 | Message: Property 'Value' can be simplified using [Reactive] attribute 11 | } 12 | ], 13 | FixedSource: 14 | using ReactiveUI; 15 | 16 | public partial class TestViewModel : ReactiveObject 17 | { 18 | 19 | [Reactive] 20 | public partial string Value { get; set; } 21 | } 22 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactivePropertyAnalyzerTests.GenericClassWithReactivePropertyTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Diagnostics: [ 3 | { 4 | Id: REACTIVE001, 5 | Severity: Info, 6 | Location: { 7 | _line: 7, 8 | _character: 16 9 | }, 10 | Message: Property 'Value' can be simplified using [Reactive] attribute 11 | } 12 | ], 13 | FixedSource: 14 | using ReactiveUI; 15 | 16 | public partial class TestViewModel : ReactiveObject 17 | where T : class 18 | { 19 | 20 | [Reactive] 21 | public partial T? Value { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactivePropertyAnalyzerTests.HandlesGenericsFixTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Diagnostics: [ 3 | { 4 | Id: REACTIVE001, 5 | Severity: Info, 6 | Location: { 7 | _line: 7, 8 | _character: 16 9 | }, 10 | Message: Property 'Items' can be simplified using [Reactive] attribute 11 | } 12 | ], 13 | FixedSource: 14 | using ReactiveUI; 15 | using System.Collections.ObjectModel; 16 | 17 | public partial class TestViewModel : ReactiveObject where T : class 18 | { 19 | 20 | [Reactive] 21 | public partial ObservableCollection? Items { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactivePropertyAnalyzerTests.MixedPropertyTypesFixTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Diagnostics: [ 3 | { 4 | Id: REACTIVE001, 5 | Severity: Info, 6 | Location: { 7 | _line: 8, 8 | _character: 16 9 | }, 10 | Message: Property 'Name' can be simplified using [Reactive] attribute 11 | }, 12 | { 13 | Id: REACTIVE001, 14 | Severity: Info, 15 | Location: { 16 | _line: 19, 17 | _character: 16 18 | }, 19 | Message: Property 'Count' can be simplified using [Reactive] attribute 20 | } 21 | ], 22 | FixedSource: 23 | using ReactiveUI; 24 | using System; 25 | using System.Windows.Input; 26 | 27 | public partial class TestViewModel : ReactiveObject 28 | { 29 | 30 | [Reactive] 31 | public partial string Name { get; set; } 32 | public ICommand UpdateCommand { get; set; } 33 | public IObservable Values { get; } 34 | public string ReadOnlyProperty { get; } 35 | 36 | [Reactive] 37 | public partial int Count { get; set; } 38 | } 39 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactivePropertyAnalyzerTests.MultipleClassesFixTest.received.txt: -------------------------------------------------------------------------------- 1 | { 2 | Diagnostics: [ 3 | { 4 | Id: REACTIVE001, 5 | Severity: Info, 6 | Location: { 7 | _line: 6, 8 | _character: 16 9 | }, 10 | Message: Property 'Name' can be simplified using [Reactive] attribute 11 | }, 12 | { 13 | Id: REACTIVE001, 14 | Severity: Info, 15 | Location: { 16 | _line: 16, 17 | _character: 16 18 | }, 19 | Message: Property 'Count' can be simplified using [Reactive] attribute 20 | } 21 | ], 22 | FixedSource: 23 | using ReactiveUI; 24 | 25 | public partial class FirstViewModel : ReactiveObject 26 | { 27 | 28 | [Reactive] 29 | public partial string Name { get; set; } 30 | } 31 | 32 | public partial class SecondViewModel : ReactiveObject 33 | { 34 | 35 | [Reactive] 36 | public partial int Count { get; set; } 37 | public string NonReactiveProperty { get; set; } 38 | } 39 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactivePropertyAnalyzerTests.MultipleClassesFixTest.verified.txt: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactivePropertyAnalyzerTests.MultiplePropertiesDocumentFixTest.received.txt: -------------------------------------------------------------------------------- 1 | { 2 | Diagnostics: [ 3 | { 4 | Id: REACTIVE001, 5 | Severity: Info, 6 | Location: { 7 | _line: 6, 8 | _character: 16 9 | }, 10 | Message: Property 'First' can be simplified using [Reactive] attribute 11 | }, 12 | { 13 | Id: REACTIVE001, 14 | Severity: Info, 15 | Location: { 16 | _line: 13, 17 | _character: 16 18 | }, 19 | Message: Property 'Second' can be simplified using [Reactive] attribute 20 | } 21 | ], 22 | FixedSource: 23 | using ReactiveUI; 24 | 25 | public partial class TestViewModel : ReactiveObject 26 | { 27 | 28 | [Reactive] 29 | public partial string First { get; set; } 30 | [Reactive] 31 | public partial int Second { get; set; } 32 | public string NonReactiveProperty { get; set; } 33 | } 34 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactivePropertyAnalyzerTests.MultiplePropertiesDocumentFixTest.verified.txt: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactivePropertyAnalyzerTests.MultipleReactivePropertiesTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Diagnostics: [ 3 | { 4 | Id: REACTIVE001, 5 | Severity: Info, 6 | Location: { 7 | _line: 6, 8 | _character: 16 9 | }, 10 | Message: Property 'First' can be simplified using [Reactive] attribute 11 | }, 12 | { 13 | Id: REACTIVE001, 14 | Severity: Info, 15 | Location: { 16 | _line: 13, 17 | _character: 16 18 | }, 19 | Message: Property 'Second' can be simplified using [Reactive] attribute 20 | } 21 | ], 22 | FixedSource: 23 | using ReactiveUI; 24 | 25 | public partial class TestViewModel : ReactiveObject 26 | { 27 | 28 | [Reactive] 29 | public partial string First { get; set; } 30 | [Reactive] 31 | public partial int Second { get; set; } 32 | } 33 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactivePropertyAnalyzerTests.NonReactiveObjectShouldNotTriggerAnalyzer.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Diagnostics: [], 3 | FixedSource: 4 | using System.ComponentModel; 5 | 6 | public class TestViewModel : INotifyPropertyChanged 7 | { 8 | private string _value; 9 | public string Value 10 | { 11 | get => _value; 12 | set => this.RaiseAndSetIfChanged(ref _value, value); 13 | } 14 | 15 | public event PropertyChangedEventHandler PropertyChanged; 16 | } 17 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactivePropertyAnalyzerTests.NullablePropertiesTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Diagnostics: [ 3 | { 4 | Id: REACTIVE001, 5 | Severity: Info, 6 | Location: { 7 | _line: 6, 8 | _character: 16 9 | }, 10 | Message: Property 'NullableString' can be simplified using [Reactive] attribute 11 | }, 12 | { 13 | Id: REACTIVE001, 14 | Severity: Info, 15 | Location: { 16 | _line: 13, 17 | _character: 16 18 | }, 19 | Message: Property 'NullableInt' can be simplified using [Reactive] attribute 20 | } 21 | ], 22 | FixedSource: 23 | using ReactiveUI; 24 | 25 | public partial class TestViewModel : ReactiveObject 26 | { 27 | 28 | [Reactive] 29 | public partial string? NullableString { get; set; } 30 | [Reactive] 31 | public partial int? NullableInt { get; set; } 32 | } 33 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactivePropertyAnalyzerTests.OnlyConvertsReactiveObjectsFixTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Diagnostics: [ 3 | { 4 | Id: REACTIVE001, 5 | Severity: Info, 6 | Location: { 7 | _line: 23, 8 | _character: 16 9 | }, 10 | Message: Property 'Name' can be simplified using [Reactive] attribute 11 | } 12 | ], 13 | FixedSource: 14 | using ReactiveUI; 15 | using System.ComponentModel; 16 | 17 | public class NonReactiveViewModel : INotifyPropertyChanged 18 | { 19 | private string _value; 20 | public string Value 21 | { 22 | get => _value; 23 | set 24 | { 25 | _value = value; 26 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Value))); 27 | } 28 | } 29 | 30 | public event PropertyChangedEventHandler? PropertyChanged; 31 | } 32 | 33 | public partial class ReactiveViewModel : ReactiveObject 34 | { 35 | 36 | [Reactive] 37 | public partial string Name { get; set; } 38 | } 39 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactivePropertyAnalyzerTests.PreservesExistingReactivesFixTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Diagnostics: [ 3 | { 4 | Id: REACTIVE001, 5 | Severity: Info, 6 | Location: { 7 | _line: 9, 8 | _character: 16 9 | }, 10 | Message: Property 'Name' can be simplified using [Reactive] attribute 11 | } 12 | ], 13 | FixedSource: 14 | using ReactiveUI; 15 | 16 | public partial class TestViewModel : ReactiveObject 17 | { 18 | [Reactive] 19 | public partial string ExistingReactive { get; set; } 20 | 21 | [Reactive] 22 | public partial string Name { get; set; } 23 | public string NonReactive { get; set; } 24 | } 25 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactivePropertyAnalyzerTests.ProjectWideFixTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Diagnostics: [ 3 | { 4 | Id: REACTIVE001, 5 | Severity: Info, 6 | Location: { 7 | _line: 6, 8 | _character: 16 9 | }, 10 | Message: Property 'Name' can be simplified using [Reactive] attribute 11 | }, 12 | { 13 | Id: REACTIVE001, 14 | Severity: Info, 15 | Location: { 16 | _line: 16, 17 | _character: 16 18 | }, 19 | Message: Property 'Count' can be simplified using [Reactive] attribute 20 | } 21 | ], 22 | FixedSource: 23 | using ReactiveUI; 24 | 25 | public partial class FirstViewModel : ReactiveObject 26 | { 27 | 28 | [Reactive] 29 | public partial string Name { get; set; } 30 | } 31 | 32 | public partial class SecondViewModel : ReactiveObject 33 | { 34 | 35 | [Reactive] 36 | public partial int Count { get; set; } 37 | public string NonReactiveProperty { get; set; } 38 | } 39 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactivePropertyAnalyzerTests.PropertyWithoutSetterShouldNotTriggerAnalyzer.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Diagnostics: [], 3 | FixedSource: 4 | using ReactiveUI; 5 | 6 | public partial class TestViewModel : ReactiveObject 7 | { 8 | private string _value; 9 | public string Value 10 | { 11 | get => _value; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactivePropertyAnalyzerTests.SimpleReactivePropertyTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Diagnostics: [ 3 | { 4 | Id: REACTIVE001, 5 | Severity: Info, 6 | Location: { 7 | _line: 6, 8 | _character: 16 9 | }, 10 | Message: Property 'Value' can be simplified using [Reactive] attribute 11 | } 12 | ], 13 | FixedSource: 14 | using ReactiveUI; 15 | 16 | public partial class TestViewModel : ReactiveObject 17 | { 18 | 19 | [Reactive] 20 | public partial string Value { get; set; } 21 | } 22 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactivePropertyAnalyzerTests.SinglePropertyFixTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Diagnostics: [ 3 | { 4 | Id: REACTIVE001, 5 | Severity: Info, 6 | Location: { 7 | _line: 6, 8 | _character: 16 9 | }, 10 | Message: Property 'First' can be simplified using [Reactive] attribute 11 | }, 12 | { 13 | Id: REACTIVE001, 14 | Severity: Info, 15 | Location: { 16 | _line: 13, 17 | _character: 16 18 | }, 19 | Message: Property 'Second' can be simplified using [Reactive] attribute 20 | } 21 | ], 22 | FixedSource: 23 | using ReactiveUI; 24 | 25 | public partial class TestViewModel : ReactiveObject 26 | { 27 | 28 | [Reactive] 29 | public partial string First { get; set; } 30 | 31 | private int _second; 32 | public int Second 33 | { 34 | get => _second; 35 | set => this.RaiseAndSetIfChanged(ref _second, value); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactivePropertyAnalyzerTests.SkipsPropertiesWithoutRaiseAndSetFixTest.received.txt: -------------------------------------------------------------------------------- 1 | { 2 | Diagnostics: [ 3 | { 4 | Id: REACTIVE001, 5 | Severity: Info, 6 | Location: { 7 | _line: 6, 8 | _character: 16 9 | }, 10 | Message: Property 'Name' can be simplified using [Reactive] attribute 11 | } 12 | ], 13 | FixedSource: 14 | using ReactiveUI; 15 | 16 | public partial class TestViewModel : ReactiveObject 17 | { 18 | 19 | [Reactive] 20 | public partial string Name { get; set; } 21 | 22 | private string _title; 23 | public string Title 24 | { 25 | get => _title; 26 | set 27 | { 28 | _title = value; 29 | this.RaisePropertyChanged(); 30 | } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactivePropertyAnalyzerTests.SkipsPropertiesWithoutRaiseAndSetFixTest.verified.txt: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/ReactivePropertyAnalyzerTests.SolutionWideFixTest.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Diagnostics: [ 3 | { 4 | Id: REACTIVE001, 5 | Severity: Info, 6 | Location: { 7 | _line: 6, 8 | _character: 16 9 | }, 10 | Message: Property 'Name' can be simplified using [Reactive] attribute 11 | }, 12 | { 13 | Id: REACTIVE001, 14 | Severity: Info, 15 | Location: { 16 | _line: 16, 17 | _character: 16 18 | }, 19 | Message: Property 'Count' can be simplified using [Reactive] attribute 20 | } 21 | ], 22 | FixedSource: 23 | using ReactiveUI; 24 | 25 | public partial class FirstViewModel : ReactiveObject 26 | { 27 | 28 | [Reactive] 29 | public partial string Name { get; set; } 30 | } 31 | 32 | public partial class SecondViewModel : ReactiveObject 33 | { 34 | 35 | [Reactive] 36 | public partial int Count { get; set; } 37 | } 38 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/UseBackingFieldsConfigurationTests.UseBackingFields_BothFormats_BothTrue.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: TestClass.INPC.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using System.ComponentModel; 34 | using System.Runtime.CompilerServices; 35 | 36 | public partial class TestClass : INotifyPropertyChanged 37 | { 38 | public event PropertyChangedEventHandler? PropertyChanged; 39 | 40 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 41 | { 42 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 43 | } 44 | 45 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 46 | { 47 | PropertyChanged?.Invoke(this, args); 48 | } 49 | } 50 | 51 | }, 52 | { 53 | FileName: TestClass.ReactiveProperties.g.cs, 54 | Source: 55 | // 56 | #nullable enable 57 | 58 | using System.ComponentModel; 59 | using System.Runtime.CompilerServices; 60 | 61 | /// 62 | /// A partial class implementation for TestClass. 63 | /// 64 | public partial class TestClass 65 | { 66 | private string _name; 67 | 68 | private static readonly PropertyChangedEventArgs _nameChangedEventArgs = new PropertyChangedEventArgs(nameof(Name)); 69 | 70 | public partial string Name 71 | { 72 | get => _name; 73 | set 74 | { 75 | if (!Equals(_name, value)) 76 | { 77 | _name = value; 78 | OnPropertyChanged(_nameChangedEventArgs); 79 | } 80 | } 81 | } 82 | } 83 | 84 | } 85 | ], 86 | Diagnostics: null 87 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/UseBackingFieldsConfigurationTests.UseBackingFields_BothFormats_NewTakesPrecedence.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: TestClass.INPC.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using System.ComponentModel; 34 | using System.Runtime.CompilerServices; 35 | 36 | public partial class TestClass : INotifyPropertyChanged 37 | { 38 | public event PropertyChangedEventHandler? PropertyChanged; 39 | 40 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 41 | { 42 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 43 | } 44 | 45 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 46 | { 47 | PropertyChanged?.Invoke(this, args); 48 | } 49 | } 50 | 51 | }, 52 | { 53 | FileName: TestClass.ReactiveProperties.g.cs, 54 | Source: 55 | // 56 | #nullable enable 57 | 58 | using System.ComponentModel; 59 | using System.Runtime.CompilerServices; 60 | 61 | /// 62 | /// A partial class implementation for TestClass. 63 | /// 64 | public partial class TestClass 65 | { 66 | private string _name; 67 | 68 | private static readonly PropertyChangedEventArgs _nameChangedEventArgs = new PropertyChangedEventArgs(nameof(Name)); 69 | 70 | public partial string Name 71 | { 72 | get => _name; 73 | set 74 | { 75 | if (!Equals(_name, value)) 76 | { 77 | _name = value; 78 | OnPropertyChanged(_nameChangedEventArgs); 79 | } 80 | } 81 | } 82 | } 83 | 84 | } 85 | ], 86 | Diagnostics: null 87 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/UseBackingFieldsConfigurationTests.UseBackingFields_CrossAssembly_LegacyFormat.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: DerivedClass.ReactiveProperties.g.cs, 5 | Source: 6 | // 7 | #nullable enable 8 | 9 | using System.ComponentModel; 10 | using System.Runtime.CompilerServices; 11 | 12 | /// 13 | /// A partial class implementation for DerivedClass. 14 | /// 15 | public partial class DerivedClass 16 | { 17 | private string _localProp; 18 | 19 | private static readonly PropertyChangedEventArgs _localPropChangedEventArgs = new PropertyChangedEventArgs(nameof(LocalProp)); 20 | 21 | public partial string LocalProp 22 | { 23 | get => _localProp; 24 | set 25 | { 26 | if (!Equals(_localProp, value)) 27 | { 28 | _localProp = value; 29 | OnPropertyChanged(_localPropChangedEventArgs); 30 | } 31 | } 32 | } 33 | } 34 | 35 | }, 36 | { 37 | FileName: IgnoreReactiveAttribute.g.cs, 38 | Source: 39 | // 40 | using System; 41 | 42 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 43 | sealed class IgnoreReactiveAttribute : Attribute 44 | { 45 | public IgnoreReactiveAttribute() { } 46 | } 47 | }, 48 | { 49 | FileName: ReactiveAttribute.g.cs, 50 | Source: 51 | // 52 | using System; 53 | 54 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 55 | sealed class ReactiveAttribute : Attribute 56 | { 57 | public ReactiveAttribute() { } 58 | } 59 | } 60 | ], 61 | Diagnostics: null 62 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/UseBackingFieldsConfigurationTests.UseBackingFields_CrossAssembly_NewFormat.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: DerivedClass.ReactiveProperties.g.cs, 5 | Source: 6 | // 7 | #nullable enable 8 | 9 | using System.ComponentModel; 10 | using System.Runtime.CompilerServices; 11 | 12 | /// 13 | /// A partial class implementation for DerivedClass. 14 | /// 15 | public partial class DerivedClass 16 | { 17 | private string _localProp; 18 | 19 | private static readonly PropertyChangedEventArgs _localPropChangedEventArgs = new PropertyChangedEventArgs(nameof(LocalProp)); 20 | 21 | public partial string LocalProp 22 | { 23 | get => _localProp; 24 | set 25 | { 26 | if (!Equals(_localProp, value)) 27 | { 28 | _localProp = value; 29 | OnPropertyChanged(_localPropChangedEventArgs); 30 | } 31 | } 32 | } 33 | } 34 | 35 | }, 36 | { 37 | FileName: IgnoreReactiveAttribute.g.cs, 38 | Source: 39 | // 40 | using System; 41 | 42 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 43 | sealed class IgnoreReactiveAttribute : Attribute 44 | { 45 | public IgnoreReactiveAttribute() { } 46 | } 47 | }, 48 | { 49 | FileName: ReactiveAttribute.g.cs, 50 | Source: 51 | // 52 | using System; 53 | 54 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 55 | sealed class ReactiveAttribute : Attribute 56 | { 57 | public ReactiveAttribute() { } 58 | } 59 | } 60 | ], 61 | Diagnostics: null 62 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/UseBackingFieldsConfigurationTests.UseBackingFields_EmptyValue_DefaultsToFalse.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: TestClass.INPC.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using System.ComponentModel; 34 | using System.Runtime.CompilerServices; 35 | 36 | public partial class TestClass : INotifyPropertyChanged 37 | { 38 | public event PropertyChangedEventHandler? PropertyChanged; 39 | 40 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 41 | { 42 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 43 | } 44 | 45 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 46 | { 47 | PropertyChanged?.Invoke(this, args); 48 | } 49 | } 50 | 51 | }, 52 | { 53 | FileName: TestClass.ReactiveProperties.g.cs, 54 | Source: 55 | // 56 | #nullable enable 57 | 58 | using System.ComponentModel; 59 | using System.Runtime.CompilerServices; 60 | 61 | /// 62 | /// A partial class implementation for TestClass. 63 | /// 64 | public partial class TestClass 65 | { 66 | private static readonly PropertyChangedEventArgs _nameChangedEventArgs = new PropertyChangedEventArgs(nameof(Name)); 67 | 68 | public partial string Name 69 | { 70 | get => field; 71 | set 72 | { 73 | if (!Equals(field, value)) 74 | { 75 | field = value; 76 | OnPropertyChanged(_nameChangedEventArgs); 77 | } 78 | } 79 | } 80 | } 81 | 82 | } 83 | ], 84 | Diagnostics: null 85 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/UseBackingFieldsConfigurationTests.UseBackingFields_InvalidValue_DefaultsToFalse.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: TestClass.INPC.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using System.ComponentModel; 34 | using System.Runtime.CompilerServices; 35 | 36 | public partial class TestClass : INotifyPropertyChanged 37 | { 38 | public event PropertyChangedEventHandler? PropertyChanged; 39 | 40 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 41 | { 42 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 43 | } 44 | 45 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 46 | { 47 | PropertyChanged?.Invoke(this, args); 48 | } 49 | } 50 | 51 | }, 52 | { 53 | FileName: TestClass.ReactiveProperties.g.cs, 54 | Source: 55 | // 56 | #nullable enable 57 | 58 | using System.ComponentModel; 59 | using System.Runtime.CompilerServices; 60 | 61 | /// 62 | /// A partial class implementation for TestClass. 63 | /// 64 | public partial class TestClass 65 | { 66 | private static readonly PropertyChangedEventArgs _nameChangedEventArgs = new PropertyChangedEventArgs(nameof(Name)); 67 | 68 | public partial string Name 69 | { 70 | get => field; 71 | set 72 | { 73 | if (!Equals(field, value)) 74 | { 75 | field = value; 76 | OnPropertyChanged(_nameChangedEventArgs); 77 | } 78 | } 79 | } 80 | } 81 | 82 | } 83 | ], 84 | Diagnostics: null 85 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/UseBackingFieldsConfigurationTests.UseBackingFields_LegacyFormat.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: TestClass.INPC.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using System.ComponentModel; 34 | using System.Runtime.CompilerServices; 35 | 36 | public partial class TestClass : INotifyPropertyChanged 37 | { 38 | public event PropertyChangedEventHandler? PropertyChanged; 39 | 40 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 41 | { 42 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 43 | } 44 | 45 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 46 | { 47 | PropertyChanged?.Invoke(this, args); 48 | } 49 | } 50 | 51 | }, 52 | { 53 | FileName: TestClass.ReactiveProperties.g.cs, 54 | Source: 55 | // 56 | #nullable enable 57 | 58 | using System.ComponentModel; 59 | using System.Runtime.CompilerServices; 60 | 61 | /// 62 | /// A partial class implementation for TestClass. 63 | /// 64 | public partial class TestClass 65 | { 66 | private string _name; 67 | 68 | private static readonly PropertyChangedEventArgs _nameChangedEventArgs = new PropertyChangedEventArgs(nameof(Name)); 69 | 70 | public partial string Name 71 | { 72 | get => _name; 73 | set 74 | { 75 | if (!Equals(_name, value)) 76 | { 77 | _name = value; 78 | OnPropertyChanged(_nameChangedEventArgs); 79 | } 80 | } 81 | } 82 | } 83 | 84 | } 85 | ], 86 | Diagnostics: null 87 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/UseBackingFieldsConfigurationTests.UseBackingFields_NewFormat.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: TestClass.INPC.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using System.ComponentModel; 34 | using System.Runtime.CompilerServices; 35 | 36 | public partial class TestClass : INotifyPropertyChanged 37 | { 38 | public event PropertyChangedEventHandler? PropertyChanged; 39 | 40 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 41 | { 42 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 43 | } 44 | 45 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 46 | { 47 | PropertyChanged?.Invoke(this, args); 48 | } 49 | } 50 | 51 | }, 52 | { 53 | FileName: TestClass.ReactiveProperties.g.cs, 54 | Source: 55 | // 56 | #nullable enable 57 | 58 | using System.ComponentModel; 59 | using System.Runtime.CompilerServices; 60 | 61 | /// 62 | /// A partial class implementation for TestClass. 63 | /// 64 | public partial class TestClass 65 | { 66 | private string _name; 67 | 68 | private static readonly PropertyChangedEventArgs _nameChangedEventArgs = new PropertyChangedEventArgs(nameof(Name)); 69 | 70 | public partial string Name 71 | { 72 | get => _name; 73 | set 74 | { 75 | if (!Equals(_name, value)) 76 | { 77 | _name = value; 78 | OnPropertyChanged(_nameChangedEventArgs); 79 | } 80 | } 81 | } 82 | } 83 | 84 | } 85 | ], 86 | Diagnostics: null 87 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/UseBackingFieldsConfigurationTests.UseBackingFields_NoConfig_DefaultsToFalse.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: TestClass.INPC.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using System.ComponentModel; 34 | using System.Runtime.CompilerServices; 35 | 36 | public partial class TestClass : INotifyPropertyChanged 37 | { 38 | public event PropertyChangedEventHandler? PropertyChanged; 39 | 40 | protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null) 41 | { 42 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 43 | } 44 | 45 | protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) 46 | { 47 | PropertyChanged?.Invoke(this, args); 48 | } 49 | } 50 | 51 | }, 52 | { 53 | FileName: TestClass.ReactiveProperties.g.cs, 54 | Source: 55 | // 56 | #nullable enable 57 | 58 | using System.ComponentModel; 59 | using System.Runtime.CompilerServices; 60 | 61 | /// 62 | /// A partial class implementation for TestClass. 63 | /// 64 | public partial class TestClass 65 | { 66 | private static readonly PropertyChangedEventArgs _nameChangedEventArgs = new PropertyChangedEventArgs(nameof(Name)); 67 | 68 | public partial string Name 69 | { 70 | get => field; 71 | set 72 | { 73 | if (!Equals(field, value)) 74 | { 75 | field = value; 76 | OnPropertyChanged(_nameChangedEventArgs); 77 | } 78 | } 79 | } 80 | } 81 | 82 | } 83 | ], 84 | Diagnostics: null 85 | } -------------------------------------------------------------------------------- /ReactiveGenerator.Tests/Snapshots/UseBackingFieldsConfigurationTests.UseBackingFields_WithReactiveObjectInheritance.verified.txt: -------------------------------------------------------------------------------- 1 | { 2 | Sources: [ 3 | { 4 | FileName: IgnoreReactiveAttribute.g.cs, 5 | Source: 6 | // 7 | using System; 8 | 9 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] 10 | sealed class IgnoreReactiveAttribute : Attribute 11 | { 12 | public IgnoreReactiveAttribute() { } 13 | } 14 | }, 15 | { 16 | FileName: ReactiveAttribute.g.cs, 17 | Source: 18 | // 19 | using System; 20 | 21 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, Inherited = true, AllowMultiple = false)] 22 | sealed class ReactiveAttribute : Attribute 23 | { 24 | public ReactiveAttribute() { } 25 | } 26 | }, 27 | { 28 | FileName: TestClass.ReactiveProperties.g.cs, 29 | Source: 30 | // 31 | #nullable enable 32 | 33 | using ReactiveUI; 34 | 35 | /// 36 | /// A partial class implementation for TestClass. 37 | /// 38 | public partial class TestClass 39 | { 40 | private string _name; 41 | private int _age; 42 | 43 | public partial string Name 44 | { 45 | get => _name; 46 | set => this.RaiseAndSetIfChanged(ref _name, value); 47 | } 48 | 49 | public partial int Age 50 | { 51 | get => _age; 52 | set => this.RaiseAndSetIfChanged(ref _age, value); 53 | } 54 | } 55 | 56 | } 57 | ], 58 | Diagnostics: null 59 | } -------------------------------------------------------------------------------- /ReactiveGenerator/IsExternalInit.cs: -------------------------------------------------------------------------------- 1 | #if NET461 || NETSTANDARD 2 | // ReSharper disable once CheckNamespace 3 | namespace System.Runtime.CompilerServices; 4 | internal static class IsExternalInit {} 5 | #endif 6 | -------------------------------------------------------------------------------- /ReactiveGenerator/ReactiveGenerator.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | true 6 | 13 7 | false 8 | enable 9 | true 10 | 11 | true 12 | true 13 | false 14 | true 15 | 16 | 17 | 18 | 0.12.0 19 | 20 | Wiesław Šoltés 21 | Wiesław Šoltés 22 | A C# source generator that automatically implements property change notifications using either standard INotifyPropertyChanged or ReactiveUI patterns. 23 | Copyright © Wiesław Šoltés 2025 24 | https://github.com/wieslawsoltes/ReactiveGenerator 25 | ReactiveGenerator 26 | MIT 27 | reactive;property;inpc;INotifyPropertyChanged;generator 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /ReactiveGenerator/build/ReactiveGenerator.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /ReactiveGeneratorDemo/App.axaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ReactiveGeneratorDemo/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.Controls.ApplicationLifetimes; 3 | using Avalonia.Markup.Xaml; 4 | 5 | namespace ReactiveGeneratorDemo; 6 | 7 | public partial class App : Application 8 | { 9 | public override void Initialize() 10 | { 11 | AvaloniaXamlLoader.Load(this); 12 | } 13 | 14 | public override void OnFrameworkInitializationCompleted() 15 | { 16 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 17 | { 18 | desktop.MainWindow = new MainWindow(); 19 | } 20 | 21 | base.OnFrameworkInitializationCompleted(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ReactiveGeneratorDemo/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /ReactiveGeneratorDemo/MainWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reactive.Linq; 3 | using Avalonia.Controls; 4 | using ReactiveGeneratorDemo.ViewModels; 5 | 6 | namespace ReactiveGeneratorDemo; 7 | 8 | public partial class MainWindow : Window 9 | { 10 | public MainWindow() 11 | { 12 | InitializeComponent(); 13 | 14 | var person = new Person { FirstName = "John", LastName = "Doe", Age = 30 }; 15 | 16 | person 17 | .WhenAnyFirstName() 18 | .Subscribe(name => Console.WriteLine($"Name changed to: {name}")); 19 | 20 | person.WhenAnyFirstName() 21 | .CombineLatest(person.WhenAnyLastName()) 22 | .Subscribe(tuple => 23 | { 24 | var (firstName, lastName) = tuple; 25 | Console.WriteLine($"{firstName} {lastName}"); 26 | }); 27 | 28 | var test = new Test 29 | { 30 | Person = person, 31 | Car = new Car { Make = "Toyota", UniqueId = "123"}, 32 | OaphViewModel = new OaphViewModel() 33 | }; 34 | 35 | DataContext = test; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ReactiveGeneratorDemo/Program.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using System; 3 | using Avalonia.ReactiveUI; 4 | 5 | namespace ReactiveGeneratorDemo; 6 | 7 | class Program 8 | { 9 | // Initialization code. Don't use any Avalonia, third-party APIs or any 10 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 11 | // yet and stuff might break. 12 | [STAThread] 13 | public static void Main(string[] args) => BuildAvaloniaApp() 14 | .StartWithClassicDesktopLifetime(args); 15 | 16 | // Avalonia configuration, don't remove; also used by visual designer. 17 | public static AppBuilder BuildAvaloniaApp() 18 | => AppBuilder.Configure() 19 | .UsePlatformDetect() 20 | .UseReactiveUI() 21 | .WithInterFont() 22 | .LogToTrace(); 23 | } 24 | -------------------------------------------------------------------------------- /ReactiveGeneratorDemo/ReactiveGeneratorDemo.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | WinExe 4 | net9.0 5 | enable 6 | false 7 | true 8 | app.manifest 9 | true 10 | true 11 | $(BaseIntermediateOutputPath)\GeneratedFiles 12 | ReactiveGeneratorDemo 13 | 14 | 15 | 16 | true 17 | 18 | 19 | 20 | 21 | 22 | preview 23 | false 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /ReactiveGeneratorDemo/ViewModels/Advanced.cs: -------------------------------------------------------------------------------- 1 | namespace ReactiveGeneratorDemo.ViewModels; 2 | /* TODO: 3 | [Reactive] 4 | public partial class Advanced 5 | { 6 | public partial ref int RefValue { get; } 7 | 8 | public partial ref readonly int ReadOnlyRefValue { get; } 9 | } 10 | */ 11 | -------------------------------------------------------------------------------- /ReactiveGeneratorDemo/ViewModels/Car.cs: -------------------------------------------------------------------------------- 1 | using ReactiveUI; 2 | 3 | namespace ReactiveGeneratorDemo.ViewModels; 4 | 5 | public partial class Car : ReactiveObject 6 | { 7 | [Reactive] 8 | public partial string? Make { get; set; } 9 | 10 | [Reactive] 11 | public partial string? UniqueId { get; init; } 12 | } 13 | -------------------------------------------------------------------------------- /ReactiveGeneratorDemo/ViewModels/MainViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace ReactiveGeneratorDemo.ViewModels; 2 | 3 | // TODO: Edge case base class with [Reactive] properties 4 | // [Reactive] 5 | public partial class MainViewModel : ViewModelBase 6 | { 7 | [Reactive] 8 | public partial object? Data { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /ReactiveGeneratorDemo/ViewModels/NullableGenericsTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ReactiveGeneratorDemo.ViewModels; 4 | 5 | public partial class NullableGenericsTest 6 | { 7 | public NullableGenericsTest() 8 | { 9 | this.WhenAnyStartDate() 10 | .Subscribe(x => Console.WriteLine($"Start: {x}")); 11 | 12 | this.WhenAnyEndDate() 13 | .Subscribe(x => Console.WriteLine($"End: {x}")); 14 | } 15 | 16 | [Reactive] 17 | public partial DateTime? StartDate { get; set; } 18 | 19 | [Reactive] 20 | public partial DateTime? EndDate { get; set; } 21 | } 22 | -------------------------------------------------------------------------------- /ReactiveGeneratorDemo/ViewModels/NullableTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ReactiveGeneratorDemo.ViewModels; 4 | 5 | public partial class NullableTest 6 | { 7 | public NullableTest() 8 | { 9 | this.WhenAnyStartDate() 10 | .Subscribe(x => Console.WriteLine($"Start: {x}")); 11 | 12 | this.WhenAnyEndDate() 13 | .Subscribe(x => Console.WriteLine($"End: {x}")); 14 | } 15 | 16 | [Reactive] 17 | public partial DateTime? StartDate { get; set; } 18 | 19 | [Reactive] 20 | public partial DateTime? EndDate { get; set; } 21 | } 22 | -------------------------------------------------------------------------------- /ReactiveGeneratorDemo/ViewModels/OaphViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Reactive.Linq; 2 | using ReactiveGenerator; 3 | using ReactiveUI; 4 | 5 | namespace ReactiveGeneratorDemo.ViewModels; 6 | 7 | public partial class OaphViewModel : ReactiveObject 8 | { 9 | public OaphViewModel() 10 | { 11 | this.WhenAnyCounter() 12 | .Select(x => $"Counter: {x}") 13 | .ToProperty(this, x => x.ComputedValue, out _computedValueHelper); 14 | } 15 | 16 | [ObservableAsProperty] 17 | public partial string ComputedValue { get; } 18 | 19 | [Reactive] 20 | public partial int Counter { get; set; } 21 | } 22 | -------------------------------------------------------------------------------- /ReactiveGeneratorDemo/ViewModels/Person.cs: -------------------------------------------------------------------------------- 1 | namespace ReactiveGeneratorDemo.ViewModels; 2 | 3 | public partial class Person 4 | { 5 | [Reactive] 6 | public partial string? FirstName { get; set; } 7 | 8 | [Reactive] 9 | public partial string? LastName { get; set; } 10 | 11 | [Reactive] 12 | public partial int Age { get; set; } 13 | 14 | [Reactive] 15 | internal partial string? Tag { get; private set; } 16 | } 17 | -------------------------------------------------------------------------------- /ReactiveGeneratorDemo/ViewModels/Shape.cs: -------------------------------------------------------------------------------- 1 | namespace ReactiveGeneratorDemo.ViewModels; 2 | 3 | [Reactive] 4 | public partial class Shape 5 | { 6 | public partial string? Name { get; set; } 7 | 8 | [IgnoreReactive] 9 | public partial string? Tag { get; set; } 10 | } 11 | 12 | public partial class Shape 13 | { 14 | private string? _tag; 15 | 16 | public partial string? Tag 17 | { 18 | get => _tag; 19 | set => _tag = value; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ReactiveGeneratorDemo/ViewModels/Student.cs: -------------------------------------------------------------------------------- 1 | namespace ReactiveGeneratorDemo.ViewModels; 2 | 3 | public partial class Student : Person 4 | { 5 | [Reactive] 6 | public partial string? Address { get; set; } 7 | } 8 | -------------------------------------------------------------------------------- /ReactiveGeneratorDemo/ViewModels/Teacher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reactive; 4 | 5 | namespace ReactiveGeneratorDemo.ViewModels; 6 | 7 | public partial class Teacher : Person 8 | { 9 | public Teacher() 10 | { 11 | this.WhenAnyStudents() 12 | .Subscribe(new AnonymousObserver?>(x => 13 | { 14 | Console.WriteLine($"{nameof(Students)} changed"); 15 | })); 16 | } 17 | 18 | [Reactive] 19 | public partial List? Students { get; set; } 20 | } 21 | -------------------------------------------------------------------------------- /ReactiveGeneratorDemo/ViewModels/Test.cs: -------------------------------------------------------------------------------- 1 | namespace ReactiveGeneratorDemo.ViewModels; 2 | 3 | public partial class Test 4 | { 5 | [Reactive] 6 | public partial Person? Person { get; set; } 7 | } 8 | 9 | public partial class Test 10 | { 11 | [Reactive] 12 | public partial Car? Car { get; set; } 13 | 14 | [Reactive] 15 | public partial OaphViewModel? OaphViewModel { get; set; } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /ReactiveGeneratorDemo/ViewModels/UsedCar.cs: -------------------------------------------------------------------------------- 1 | namespace ReactiveGeneratorDemo.ViewModels; 2 | 3 | public partial class UsedCar : Car 4 | { 5 | [Reactive] 6 | public partial decimal Price { get; private set; } 7 | 8 | [Reactive] 9 | public partial int Miles { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /ReactiveGeneratorDemo/ViewModels/ValidatingViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Reactive; 2 | using ReactiveUI; 3 | 4 | namespace ReactiveGeneratorDemo.ViewModels; 5 | 6 | public abstract partial class ValidatingViewModelBase : ReactiveObject where T : class; 7 | 8 | public abstract partial class ValidatingViewModel : ValidatingViewModelBase 9 | where T : class 10 | { 11 | [Reactive] public partial ReactiveCommand PerformInitializeCommand { get; protected set; } 12 | } 13 | -------------------------------------------------------------------------------- /ReactiveGeneratorDemo/ViewModels/ViewModelBase.cs: -------------------------------------------------------------------------------- 1 | namespace ReactiveGeneratorDemo.ViewModels; 2 | 3 | [Reactive] 4 | public partial class ViewModelBase 5 | { 6 | // TODO: Edge case no [Reactive] properties 7 | // [Reactive] 8 | // public partial bool IsInitialized { get; set; } 9 | } 10 | -------------------------------------------------------------------------------- /ReactiveGeneratorDemo/app.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 6 | 7 | 8 | 9 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /global.json: -------------------------------------------------------------------------------- 1 | { 2 | "sdk": { 3 | "version": "9.0.100", 4 | "rollForward": "latestMinor", 5 | "allowPrerelease": true 6 | } 7 | } 8 | --------------------------------------------------------------------------------