├── images └── logo.png ├── .github ├── renovate.json └── workflows │ ├── ci-build.yml │ ├── release.yml │ └── lock.yml ├── tests.runsettings ├── src ├── TestApps │ ├── TestAvaloniaApplication │ │ ├── Assets │ │ │ └── avalonia-logo.ico │ │ ├── App.axaml │ │ ├── ViewModels │ │ │ ├── ViewModelBase.cs │ │ │ └── MainViewModel.cs │ │ ├── Views │ │ │ ├── MainWindow.axaml │ │ │ ├── MainWindow.axaml.cs │ │ │ ├── MainView.axaml.cs │ │ │ └── MainView.axaml │ │ ├── TestAvaloniaApplication.csproj │ │ └── App.axaml.cs │ ├── TestMauiApplication │ │ ├── Resources │ │ │ ├── Images │ │ │ │ └── dotnet_bot.png │ │ │ ├── Fonts │ │ │ │ ├── OpenSans-Regular.ttf │ │ │ │ └── OpenSans-Semibold.ttf │ │ │ ├── AppIcon │ │ │ │ ├── appicon.svg │ │ │ │ └── appiconfg.svg │ │ │ ├── Raw │ │ │ │ └── AboutAssets.txt │ │ │ └── Splash │ │ │ │ └── splash.svg │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── Platforms │ │ │ ├── Android │ │ │ │ ├── Resources │ │ │ │ │ └── values │ │ │ │ │ │ └── colors.xml │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── MainActivity.cs │ │ │ │ └── MainApplication.cs │ │ │ ├── Windows │ │ │ │ ├── App.xaml │ │ │ │ ├── app.manifest │ │ │ │ ├── App.xaml.cs │ │ │ │ └── Package.appxmanifest │ │ │ ├── Tizen │ │ │ │ ├── Main.cs │ │ │ │ └── tizen-manifest.xml │ │ │ ├── MacCatalyst │ │ │ │ ├── Entitlements.plist │ │ │ │ ├── AppDelegate.cs │ │ │ │ ├── Program.cs │ │ │ │ └── Info.plist │ │ │ └── iOS │ │ │ │ ├── AppDelegate.cs │ │ │ │ ├── Program.cs │ │ │ │ └── Info.plist │ │ ├── AppShell.xaml │ │ ├── MainViewModel.cs │ │ ├── App.xaml │ │ ├── AppShell.xaml.cs │ │ ├── App.xaml.cs │ │ ├── MauiProgram.cs │ │ ├── MainPage.xaml.cs │ │ └── MainPage.xaml │ ├── TestWpfApplication │ │ ├── App.xaml │ │ ├── AssemblyInfo.cs │ │ ├── MainViewModel.cs │ │ ├── App.xaml.cs │ │ ├── MainWindow.xaml │ │ ├── TestWpfApplication.csproj │ │ └── MainWindow.xaml.cs │ ├── TestWinFormsApplication │ │ ├── MainViewModel.cs │ │ ├── TestWinFormsApplication.csproj │ │ ├── Form1.cs │ │ ├── Program.cs │ │ └── Form1.Designer.cs │ └── TestAvaloniaApplication.Desktop │ │ ├── TestAvaloniaApplication.Desktop.csproj │ │ ├── app.manifest │ │ └── Program.cs ├── ReactiveUI.SourceGenerators.Roslyn │ ├── AnalyzerReleases.Unshipped.md │ ├── Core │ │ ├── Models │ │ │ ├── PropertyAttributeData.cs │ │ │ └── Result.cs │ │ ├── Helpers │ │ │ └── SymbolHelpers.cs │ │ └── Extensions │ │ │ └── SyntaxTokenExtensions.cs │ ├── ReactiveCommand │ │ └── Models │ │ │ ├── CanExecuteTypeInfo.cs │ │ │ └── CommandInfo.cs │ ├── IViewFor │ │ └── Models │ │ │ ├── IViewForBaseType.cs │ │ │ └── IViewForInfo.cs │ ├── ReactiveObject │ │ └── Models │ │ │ └── ReactiveObjectInfo.cs │ ├── Generated │ │ └── PolySharp.SourceGenerators │ │ │ └── PolySharp.SourceGenerators.PolyfillsGenerator │ │ │ ├── System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute.g.cs │ │ │ ├── System.Runtime.CompilerServices.IsExternalInit.g.cs │ │ │ └── System.Diagnostics.CodeAnalysis.NotNullWhenAttribute.g.cs │ ├── RoutedControlHost │ │ └── Models │ │ │ └── RoutedControlHostInfo.cs │ ├── ViewModelControlHost │ │ └── Models │ │ │ └── ViewModelControlHostInfo.cs │ ├── BindableDerivedList │ │ └── Models │ │ │ └── BindableDerivedListInfo.cs │ ├── ReactiveCollection │ │ └── Models │ │ │ └── ReactiveCollectionFieldInfo.cs │ ├── ObservableAsProperty │ │ ├── Models │ │ │ ├── ObservableFieldInfo.cs │ │ │ └── ObservableMethodInfo.cs │ │ └── ObservableAsPropertyGenerator.cs │ ├── ReactiveUI.SourceGenerators.Roslyn.shproj │ ├── Reactive │ │ └── Models │ │ │ └── PropertyInfo.cs │ └── Diagnostics │ │ └── SuppressionDescriptors.cs ├── ReactiveUI.SourceGenerators.Analyzers.CodeFixes │ ├── AnalyzerReleases.Unshipped.md │ ├── Core │ │ ├── Generated │ │ │ └── PolySharp.SourceGenerators │ │ │ │ └── PolySharp.SourceGenerators.PolyfillsGenerator │ │ │ │ └── System.Diagnostics.CodeAnalysis.NotNullWhenAttribute.g.cs │ │ └── Extensions │ │ │ └── ISymbolExtensions.cs │ ├── Diagnostics │ │ └── DiagnosticDescriptors.cs │ └── ReactiveUI.SourceGenerators.Analyzers.CodeFixes.csproj ├── ReactiveUI.SourceGenerators │ └── Properties │ │ └── launchSettings.json ├── ReactiveUI.SourceGenerator.Tests │ ├── AssemblyInfo.Parallel.cs │ ├── OAPH │ │ ├── OAPGeneratorTests.FromField#TestNs.TestVM.ObservableAsProperties.g.verified.cs │ │ ├── OAPGeneratorTests.NamedFromField#TestNs.TestVM.ObservableAsProperties.g.verified.cs │ │ ├── OAPGeneratorTests.FromFieldNestedClass#TestNs.TestVM.ObservableAsProperties.g.verified.cs │ │ ├── OAPGeneratorTests.NonReadOnlyFromField#TestNs.TestVM.ObservableAsProperties.g.verified.cs │ │ ├── OAPGeneratorTests.NonReadOnlyFromFieldProtected#TestNs.TestVM.ObservableAsProperties.g.verified.cs │ │ ├── OAPGeneratorTests.FromFieldNestedClass#TestNs.TestVM+TestVMInner1.ObservableAsProperties.g.verified.cs │ │ ├── OAPGeneratorTests.FromFieldNestedClass#TestNs.TestVM+TestVMInner2.ObservableAsProperties.g.verified.cs │ │ ├── OAPGeneratorTests.FromFieldNestedClass#TestNs.TestVM+TestVMInner2+TestVMInner3.ObservableAsProperties.g.verified.cs │ │ ├── OAPFromObservableGeneratorTests.FromField#TestNs.TestVM.ObservableAsProperties.g.verified.cs │ │ ├── OAPFromObservableGeneratorTests.FromObservableProp#TestNs.TestVM.ObservableAsPropertyFromObservable.g.verified.cs │ │ ├── OAPFromObservableGeneratorTests.FromObservableMethods#TestNs.TestVM.ObservableAsPropertyFromObservable.g.verified.cs │ │ ├── OAPFromObservableGeneratorTests.FromObservableMethodsWithName#TestNs.TestVM.ObservableAsPropertyFromObservable.g.verified.cs │ │ ├── OAPFromObservableGeneratorTests.FromObservablePropNestedClasses#TestNs.TestVM.ObservableAsPropertyFromObservable.g.verified.cs │ │ ├── OAPFromObservableGeneratorTests.FromObservablePropertiesWithName#TestNs.TestVM.ObservableAsPropertyFromObservable.g.verified.cs │ │ ├── OAPFromObservableGeneratorTests.FromPartialProperty#TestNs.TestVM.ObservableAsPropertyFromObservable.g.verified.cs │ │ ├── OAPFromObservableGeneratorTests.FromObservablePropNestedClasses#TestNs.TestVM+TestVMInner1.ObservableAsPropertyFromObservable.g.verified.cs │ │ ├── OAPFromObservableGeneratorTests.FromObservablePropNestedClasses#TestNs.TestVM+TestVMInner2.ObservableAsPropertyFromObservable.g.verified.cs │ │ ├── OAPFromObservableGeneratorTests.FromObservablePropertiesWithAttribute#TestNs.TestVM.ObservableAsPropertyFromObservable.g.verified.cs │ │ ├── OAPFromObservableGeneratorTests.FromObservablePropertiesWithAttributeRef#TestNs.TestVM.ObservableAsPropertyFromObservable.g.verified.cs │ │ ├── OAPFromObservableGeneratorTests.FromObservablePropNestedClasses#TestNs.TestVM+TestVMInner2+TestVMInner3.ObservableAsPropertyFromObservable.g.verified.cs │ │ └── OAPFromObservableGeneratorTests.FromObservablePropertiesWithAttributeNullableRef#TestNs.TestVM.ObservableAsPropertyFromObservable.g.verified.cs │ ├── ModuleInitializer.cs │ ├── REACTIVE │ │ ├── ReactiveGeneratorTests.FromReactiveProperties#TestNs.TestVM.Properties.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactivePropertiesWithAccess#TestNs.TestVM.Properties.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactiveFromPartialWithAlsoNotify#TestNs.TestVM.Properties.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactivePropertiesCalledValue#TestNs.TestVM.Properties.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactivePropertiesWithInit#TestNs.TestVM.Properties.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactiveProperiesWithAttributes#TestNs.TestVM.Properties.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactivePropertiesWithIdenticalClass#TestNs1.TestVM.Properties.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactivePropertiesWithIdenticalClass#TestNs2.TestVM.Properties.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactivePropertiesWithAttributesAccessAndInheritance#TestNs.TestVM.Properties.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactivePropertiesWithNestedClass#TestNs1.TestViewModel3.Properties.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactivePropertiesWithNestedClass#TestNs1.TestViewModel3+TestInnerClass1.Properties.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactivePropertiesWithNestedClass#TestNs1.TestViewModel3+TestInnerClass2.Properties.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactiveProperties#ReactiveUI.SourceGenerators.AccessModifier.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactivePartialProperties#ReactiveUI.SourceGenerators.AccessModifier.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactivePropertiesCalledValue#ReactiveUI.SourceGenerators.AccessModifier.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactivePropertiesWithAccess#ReactiveUI.SourceGenerators.AccessModifier.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactivePropertiesWithInit#ReactiveUI.SourceGenerators.AccessModifier.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactiveFromPartialWithAlsoNotify#ReactiveUI.SourceGenerators.AccessModifier.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactiveProperiesWithAttributes#ReactiveUI.SourceGenerators.AccessModifier.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactivePropertiesWithNestedClass#ReactiveUI.SourceGenerators.AccessModifier.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactivePropertiesWithIdenticalClass#ReactiveUI.SourceGenerators.AccessModifier.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactivePropertiesWithAttributesAccessAndInheritance#ReactiveUI.SourceGenerators.AccessModifier.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactivePropertiesWithNestedClass#TestNs1.TestViewModel3+TestInnerClass2+TestInnerClass3.Properties.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactiveProperties#ReactiveUI.SourceGenerators.ReactiveAttribute.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactivePartialProperties#ReactiveUI.SourceGenerators.ReactiveAttribute.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactivePropertiesWithAccess#ReactiveUI.SourceGenerators.ReactiveAttribute.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactivePropertiesWithInit#ReactiveUI.SourceGenerators.ReactiveAttribute.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactiveFromPartialWithAlsoNotify#ReactiveUI.SourceGenerators.ReactiveAttribute.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactiveProperiesWithAttributes#ReactiveUI.SourceGenerators.ReactiveAttribute.g.verified.cs │ │ ├── ReactiveGeneratorTests.FromReactivePropertiesCalledValue#ReactiveUI.SourceGenerators.ReactiveAttribute.g.verified.cs │ │ └── ReactiveGeneratorTests.FromReactivePropertiesWithNestedClass#ReactiveUI.SourceGenerators.ReactiveAttribute.g.verified.cs │ ├── IVIEWFOR │ │ └── IViewForGeneratorTests.FromIViewFor#ReactiveUI.ReactiveUISourceGeneratorsExtensions.g.verified.cs │ ├── DERIVEDLIST │ │ ├── ReactiveCollectionGeneratorTests.FromReactiveCollectionField#ReactiveUI.SourceGenerators.BindableDerivedListAttribute.g.verified.cs │ │ └── BindableDerivedListGeneratorTests.FromReactiveProperties#ReactiveUI.SourceGenerators.BindableDerivedListAttribute.g.verified.cs │ ├── REACTIVEOBJ │ │ └── ReactiveObjectGeneratorTests.FromReactiveObject#ReactiveUI.SourceGenerators.IReactiveObjectAttribute.g.verified.cs │ ├── REACTIVECOLL │ │ ├── ReactiveCollectionGeneratorTests.FromReactiveCollectionField#ReactiveUI.SourceGenerators.ReactiveCollectionAttribute.g.verified.cs │ │ └── ReactiveCollectionGeneratorTests.FromReactiveCollectionField#TestNs.TestVM.ReactiveCollections.g.verified.cs │ ├── UnitTests │ │ ├── BindableDerivedListGeneratorTests.cs │ │ ├── ReactiveObjectGeneratorTests.cs │ │ └── ReactiveCollectionGeneratorTests.cs │ ├── REACTIVECMD │ │ ├── ReactiveCMDGeneratorTests.FromReactiveCommand#ReactiveUI.SourceGenerators.ReactiveCommandAttribute.g.verified.cs │ │ ├── ReactiveCMDGeneratorTests.FromReactiveAsyncCommand#ReactiveUI.SourceGenerators.ReactiveCommandAttribute.g.verified.cs │ │ ├── ReactiveCMDGeneratorTests.FromReactiveCommandWithParameter#ReactiveUI.SourceGenerators.ReactiveCommandAttribute.g.verified.cs │ │ ├── ReactiveCMDGeneratorTests.FromReactiveAsyncCommandWithParameter#ReactiveUI.SourceGenerators.ReactiveCommandAttribute.g.verified.cs │ │ ├── ReactiveCMDGeneratorTests.FromReactiveCommandWithAccessModifier#ReactiveUI.SourceGenerators.ReactiveCommandAttribute.g.verified.cs │ │ ├── ReactiveCMDGeneratorTests.FromReactiveCommandWithNestedClasses#ReactiveUI.SourceGenerators.ReactiveCommandAttribute.g.verified.cs │ │ ├── ReactiveCMDGeneratorTests.FromReactiveCommandWithOutputScheduler#ReactiveUI.SourceGenerators.ReactiveCommandAttribute.g.verified.cs │ │ └── ReactiveCMDGeneratorTests.FromReactiveCommandWithNullableTypeAndNullableReturnType#ReactiveUI.SourceGenerators.ReactiveCommandAttribute.g.verified.cs │ └── TestBase.cs ├── ReactiveUI.SourceGenerators.Execute.Nested3 │ ├── Nested4 │ │ └── Class1.cs │ ├── ReactiveUI.SourceGenerators.Execute.Nested3.csproj │ └── Class1.cs ├── ReactiveUI.SourceGenerators.Execute │ ├── TestWinFormsRCHost.cs │ ├── TestWinFormsRCHost.Designer.cs │ ├── TestWinFormsVMCHost.cs │ ├── TestViewModel2.cs │ ├── TestWinFormsVMCHost.Designer.cs │ ├── Program.cs │ ├── TestAttribute.cs │ ├── TestViewModel{partTwo}.cs │ ├── TestViewWpf2.cs │ ├── Person.cs │ ├── TestViewWinForms.cs │ ├── TestViewWpf.cs │ ├── TestViewWinForms.Designer.cs │ └── ReactiveUI.SourceGenerators.Execute.csproj ├── ReactiveUI.SourceGenerators.Execute.Maui │ ├── IViewForTest.cs │ └── ReactiveUI.SourceGenerators.Execute.Maui.csproj ├── ReactiveUI.SourceGenerators.Execute.Nested1 │ ├── ReactiveUI.SourceGenerators.Execute.Nested1.csproj │ └── Class1.cs ├── ReactiveUI.SourceGenerators.Execute.Nested2 │ ├── Class1.cs │ └── ReactiveUI.SourceGenerators.Execute.Nested2.csproj ├── ReactiveUI.SourceGenerators.Roslyn480 │ └── ReactiveUI.SourceGenerators.Roslyn480.csproj └── stylecop.json └── version.json /images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reactiveui/ReactiveUI.SourceGenerators/HEAD/images/logo.png -------------------------------------------------------------------------------- /.github/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": ["local>reactiveui/.github:renovate"] 4 | } 5 | -------------------------------------------------------------------------------- /tests.runsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/TestApps/TestAvaloniaApplication/Assets/avalonia-logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reactiveui/ReactiveUI.SourceGenerators/HEAD/src/TestApps/TestAvaloniaApplication/Assets/avalonia-logo.ico -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/Resources/Images/dotnet_bot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reactiveui/ReactiveUI.SourceGenerators/HEAD/src/TestApps/TestMauiApplication/Resources/Images/dotnet_bot.png -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Windows Machine": { 4 | "commandName": "MsixPackage", 5 | "nativeDebugging": false 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/Resources/Fonts/OpenSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reactiveui/ReactiveUI.SourceGenerators/HEAD/src/TestApps/TestMauiApplication/Resources/Fonts/OpenSans-Regular.ttf -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/Resources/Fonts/OpenSans-Semibold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reactiveui/ReactiveUI.SourceGenerators/HEAD/src/TestApps/TestMauiApplication/Resources/Fonts/OpenSans-Semibold.ttf -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Roslyn/AnalyzerReleases.Unshipped.md: -------------------------------------------------------------------------------- 1 | ; Unshipped analyzer releases 2 | ; https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md 3 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Analyzers.CodeFixes/AnalyzerReleases.Unshipped.md: -------------------------------------------------------------------------------- 1 | ; Unshipped analyzer releases 2 | ; https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md 3 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "ReactiveUi_SG": { 4 | "commandName": "DebugRoslynComponent", 5 | "targetProject": "..\\ReactiveUI.SourceGenerators.Execute\\ReactiveUI.SourceGenerators.Execute.csproj" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/Resources/AppIcon/appicon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/Platforms/Android/Resources/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #512BD4 4 | #2B0B98 5 | #2B0B98 6 | -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/Platforms/Windows/App.xaml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/TestApps/TestWpfApplication/App.xaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/Platforms/Tizen/Main.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Maui; 2 | using Microsoft.Maui.Hosting; 3 | using System; 4 | 5 | namespace MauiApp1 6 | { 7 | internal class Program : MauiApplication 8 | { 9 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); 10 | 11 | static void Main(string[] args) 12 | { 13 | var app = new Program(); 14 | app.Run(args); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/TestApps/TestWpfApplication/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved. 2 | // Licensed to the .NET Foundation under one or more agreements. 3 | // The .NET Foundation licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using System.Windows; 7 | 8 | [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] 9 | -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/Platforms/Android/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/TestApps/TestAvaloniaApplication/App.axaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/AssemblyInfo.Parallel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using NUnit.Framework; 7 | 8 | [assembly: Parallelizable(ParallelScope.Fixtures)] 9 | [assembly: LevelOfParallelism(4)] 10 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Roslyn/Core/Models/PropertyAttributeData.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | namespace ReactiveUI.SourceGenerators.Models; 7 | 8 | internal record PropertyAttributeData(string? AttributeNamespace, string AttributeSyntax); 9 | -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/AppShell.xaml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/TestApps/TestWpfApplication/MainViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved. 2 | // Licensed to the .NET Foundation under one or more agreements. 3 | // The .NET Foundation licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using ReactiveUI; 7 | 8 | namespace WpfApp1 9 | { 10 | /// 11 | /// MainViewModel. 12 | /// 13 | public class MainViewModel : ReactiveObject; 14 | } 15 | -------------------------------------------------------------------------------- /src/TestApps/TestWpfApplication/App.xaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved. 2 | // Licensed to the .NET Foundation under one or more agreements. 3 | // The .NET Foundation licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using System.Windows; 7 | 8 | namespace WpfApp1 9 | { 10 | /// 11 | /// Interaction logic for App.xaml. 12 | /// 13 | public partial class App : Application; 14 | } 15 | -------------------------------------------------------------------------------- /src/TestApps/TestWpfApplication/MainWindow.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/MainViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved. 2 | // Licensed to the .NET Foundation under one or more agreements. 3 | // The .NET Foundation licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | namespace MauiApp1 7 | { 8 | /// 9 | /// MainViewModel. 10 | /// 11 | /// 12 | public class MainViewModel : ReactiveUI.ReactiveObject; 13 | } 14 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Roslyn/ReactiveCommand/Models/CanExecuteTypeInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | namespace ReactiveUI.SourceGenerators.Input.Models; 7 | 8 | internal enum CanExecuteTypeInfo 9 | { 10 | PropertyObservable, 11 | MethodObservable, 12 | FieldObservable, 13 | } 14 | -------------------------------------------------------------------------------- /src/TestApps/TestWinFormsApplication/MainViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved. 2 | // Licensed to the .NET Foundation under one or more agreements. 3 | // The .NET Foundation licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using ReactiveUI; 7 | 8 | namespace WinFormsApp1 9 | { 10 | /// 11 | /// MainViewModel. 12 | /// 13 | /// 14 | public class MainViewModel : ReactiveObject; 15 | } 16 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Roslyn/IViewFor/Models/IViewForBaseType.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | namespace ReactiveUI.SourceGenerators.Input.Models; 7 | 8 | internal enum IViewForBaseType 9 | { 10 | None, 11 | Wpf, 12 | WinUI, 13 | Uno, 14 | WinForms, 15 | Avalonia, 16 | Maui, 17 | } 18 | -------------------------------------------------------------------------------- /src/TestApps/TestAvaloniaApplication/ViewModels/ViewModelBase.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved. 2 | // Licensed to the .NET Foundation under one or more agreements. 3 | // The .NET Foundation licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using ReactiveUI; 7 | 8 | namespace AvaloniaApplication1.ViewModels; 9 | 10 | /// 11 | /// ViewModelBase. 12 | /// 13 | /// 14 | public class ViewModelBase : ReactiveObject 15 | { 16 | } 17 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Roslyn/ReactiveObject/Models/ReactiveObjectInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | namespace ReactiveUI.SourceGenerators.Models; 7 | 8 | /// 9 | /// A model with gathered information about a generated ReactiveObject (view model). 10 | /// 11 | internal sealed record ReactiveObjectInfo( 12 | TargetInfo TargetInfo); 13 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Execute.Nested3/Nested4/Class1.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using ReactiveUI; 7 | using ReactiveUI.SourceGenerators; 8 | 9 | namespace SGReactiveUI.SourceGenerators.Execute.Nested4; 10 | 11 | /// 12 | /// Class1. 13 | /// 14 | public partial class Class1 : ReactiveObject 15 | { 16 | [Reactive] 17 | private string? _property1; 18 | } 19 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Execute/TestWinFormsRCHost.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using System.Diagnostics.CodeAnalysis; 7 | using ReactiveUI.SourceGenerators.WinForms; 8 | 9 | namespace SGReactiveUI.SourceGenerators.Test; 10 | 11 | /// 12 | /// TestWinFormsRCHost. 13 | /// 14 | [RoutedControlHost(nameof(UserControl))] 15 | public partial class TestWinFormsRCHost; 16 | -------------------------------------------------------------------------------- /.github/workflows/ci-build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | env: 10 | productNamespacePrefix: "ReactiveUI.SourceGenerators" 11 | 12 | # Needed so the reusable workflow can optionally delete the temp per-OS artifacts it creates. 13 | permissions: 14 | contents: read 15 | actions: write 16 | 17 | jobs: 18 | build: 19 | uses: reactiveui/actions-common/.github/workflows/workflow-common-setup-and-build.yml@main 20 | with: 21 | productNamespacePrefix: ReactiveUI.SourceGenerators 22 | installWorkloads: true 23 | secrets: 24 | CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} 25 | 26 | -------------------------------------------------------------------------------- /src/TestApps/TestAvaloniaApplication/Views/MainWindow.axaml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/TestApps/TestWpfApplication/TestWpfApplication.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net8.0-windows10.0.19041.0 6 | enable 7 | enable 8 | true 9 | false 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPGeneratorTests.FromField#TestNs.TestVM.ObservableAsProperties.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM.ObservableAsProperties.g.cs 2 | // 3 | #pragma warning disable 4 | #nullable enable 5 | namespace TestNs 6 | { 7 | 8 | public partial class TestVM 9 | { 10 | /// 11 | private readonly ReactiveUI.ObservableAsPropertyHelper _test1Helper; 12 | 13 | /// 14 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 15 | public int Test1 { get => _test1 = _test1Helper?.Value ?? _test1; } 16 | } 17 | } 18 | #nullable restore 19 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPGeneratorTests.NamedFromField#TestNs.TestVM.ObservableAsProperties.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM.ObservableAsProperties.g.cs 2 | // 3 | #pragma warning disable 4 | #nullable enable 5 | namespace TestNs 6 | { 7 | 8 | public partial class TestVM 9 | { 10 | /// 11 | private readonly ReactiveUI.ObservableAsPropertyHelper _test4Helper; 12 | 13 | /// 14 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 15 | public int Test4 { get => _test4 = _test4Helper?.Value ?? _test4; } 16 | } 17 | } 18 | #nullable restore 19 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Execute.Maui/IViewForTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using System.Diagnostics.CodeAnalysis; 7 | using ReactiveUI.SourceGenerators; 8 | 9 | namespace SGReactiveUI.SourceGenerators.Test.Maui 10 | { 11 | /// 12 | /// IViewForTest. 13 | /// 14 | /// 15 | [IViewFor] 16 | public partial class IViewForTest : Shell; 17 | } 18 | -------------------------------------------------------------------------------- /src/TestApps/TestWinFormsApplication/TestWinFormsApplication.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net8.0-windows 6 | enable 7 | true 8 | enable 9 | false 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPGeneratorTests.FromFieldNestedClass#TestNs.TestVM.ObservableAsProperties.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM.ObservableAsProperties.g.cs 2 | // 3 | #pragma warning disable 4 | #nullable enable 5 | namespace TestNs 6 | { 7 | 8 | public partial class TestVM 9 | { 10 | /// 11 | private readonly ReactiveUI.ObservableAsPropertyHelper _test2Helper; 12 | 13 | /// 14 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 15 | public int Test2 { get => _test2 = _test2Helper?.Value ?? _test2; } 16 | } 17 | } 18 | #nullable restore 19 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPGeneratorTests.NonReadOnlyFromField#TestNs.TestVM.ObservableAsProperties.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM.ObservableAsProperties.g.cs 2 | // 3 | #pragma warning disable 4 | #nullable enable 5 | namespace TestNs 6 | { 7 | 8 | public partial class TestVM 9 | { 10 | /// 11 | private readonly ReactiveUI.ObservableAsPropertyHelper _test3Helper; 12 | 13 | /// 14 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 15 | public int Test3 { get => _test3 = _test3Helper?.Value ?? _test3; } 16 | } 17 | } 18 | #nullable restore 19 | #pragma warning restore -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/App.xaml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /version.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", 3 | "version": "2.5", 4 | "publicReleaseRefSpec": [ 5 | "^refs/heads/master$", // we release out of master 6 | "^refs/heads/main$", 7 | "^refs/heads/latest$", 8 | "^refs/heads/preview/.*", // we release previews 9 | "^refs/heads/patches/.*", // we release previews 10 | "^refs/heads/rel/\\d+\\.\\d+\\.\\d+" // we also release branches starting with rel/N.N.N 11 | ], 12 | "nugetPackageVersion":{ 13 | "semVer": 2 14 | }, 15 | "cloudBuild": { 16 | "setVersionVariables": true, 17 | "buildNumber": { 18 | "enabled": false 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPGeneratorTests.NonReadOnlyFromFieldProtected#TestNs.TestVM.ObservableAsProperties.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM.ObservableAsProperties.g.cs 2 | // 3 | #pragma warning disable 4 | #nullable enable 5 | namespace TestNs 6 | { 7 | 8 | public partial class TestVM 9 | { 10 | /// 11 | private readonly ReactiveUI.ObservableAsPropertyHelper _test5Helper; 12 | 13 | /// 14 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 15 | public int Test5 { get => _test5 = _test5Helper?.Value ?? _test5; } 16 | } 17 | } 18 | #nullable restore 19 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Execute.Nested1/ReactiveUI.SourceGenerators.Execute.Nested1.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | false 8 | 13.0 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/Resources/Raw/AboutAssets.txt: -------------------------------------------------------------------------------- 1 | Any raw assets you want to be deployed with your application can be placed in 2 | this directory (and child directories). Deployment of the asset to your application 3 | is automatically handled by the following `MauiAsset` Build Action within your `.csproj`. 4 | 5 | 6 | 7 | These files will be deployed with your package and will be accessible using Essentials: 8 | 9 | async Task LoadMauiAsset() 10 | { 11 | using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt"); 12 | using var reader = new StreamReader(stream); 13 | 14 | var contents = reader.ReadToEnd(); 15 | } 16 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Execute.Nested1/Class1.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using System.Diagnostics.CodeAnalysis; 7 | using ReactiveUI; 8 | using ReactiveUI.SourceGenerators; 9 | 10 | namespace SGReactiveUI.SourceGenerators.Execute.Nested1; 11 | 12 | /// 13 | /// Class1. 14 | /// 15 | [ExcludeFromCodeCoverage] 16 | public partial class Class1 : ReactiveObject 17 | { 18 | [Reactive] 19 | private string? _property1; 20 | } 21 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Execute.Nested2/Class1.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using System.Diagnostics.CodeAnalysis; 7 | using ReactiveUI; 8 | using ReactiveUI.SourceGenerators; 9 | 10 | namespace SGReactiveUI.SourceGenerators.Execute.Nested2; 11 | 12 | /// 13 | /// Class1. 14 | /// 15 | [ExcludeFromCodeCoverage] 16 | public partial class Class1 : ReactiveObject 17 | { 18 | [Reactive] 19 | private string? _property1; 20 | } 21 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/ModuleInitializer.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using System.Runtime.CompilerServices; 7 | 8 | /// 9 | /// Initializes the source generator verifiers. 10 | /// 11 | public static class ModuleInitializer 12 | { 13 | /// 14 | /// Initializes the source generators. 15 | /// 16 | [ModuleInitializer] 17 | public static void Init() => VerifySourceGenerators.Initialize(); 18 | } 19 | -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/Platforms/MacCatalyst/Entitlements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.apple.security.app-sandbox 8 | 9 | 10 | com.apple.security.network.client 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Execute/TestWinFormsRCHost.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SGReactiveUI.SourceGenerators.Test; 2 | 3 | partial class TestWinFormsRCHost 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | #region Component Designer generated code 11 | 12 | /// 13 | /// Required method for Designer support - do not modify 14 | /// the contents of this method with the code editor. 15 | /// 16 | private void InitializeComponent() 17 | { 18 | components = new System.ComponentModel.Container(); 19 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 20 | } 21 | 22 | #endregion 23 | } 24 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | 7 | env: 8 | productNamespacePrefix: "SourceGenerators" 9 | 10 | jobs: 11 | release: 12 | uses: reactiveui/actions-common/.github/workflows/workflow-common-release.yml@main 13 | with: 14 | configuration: Release 15 | productNamespacePrefix: "SourceGenerators" 16 | installWorkflows: true 17 | secrets: 18 | SIGN_ACCOUNT_NAME: ${{ secrets.SIGN_ACCOUNT_NAME }} 19 | SIGN_PROFILE_NAME: ${{ secrets.SIGN_PROFILE_NAME }} 20 | AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }} 21 | AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} 22 | AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} 23 | NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} 24 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Execute.Nested2/ReactiveUI.SourceGenerators.Execute.Nested2.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | false 8 | 13.0 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Execute.Nested3/ReactiveUI.SourceGenerators.Execute.Nested3.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | false 8 | 13.0 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/TestApps/TestAvaloniaApplication/Views/MainWindow.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved. 2 | // Licensed to the .NET Foundation under one or more agreements. 3 | // The .NET Foundation licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using Avalonia.Controls; 7 | 8 | namespace AvaloniaApplication1.Views; 9 | 10 | /// 11 | /// MainWindow. 12 | /// 13 | /// 14 | public partial class MainWindow : Window 15 | { 16 | /// 17 | /// Initializes a new instance of the class. 18 | /// 19 | public MainWindow() 20 | { 21 | InitializeComponent(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/TestApps/TestWinFormsApplication/Form1.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved. 2 | // Licensed to the .NET Foundation under one or more agreements. 3 | // The .NET Foundation licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | namespace WinFormsApp1 7 | { 8 | /// 9 | /// Form1. 10 | /// 11 | /// 12 | public partial class Form1 : Form 13 | { 14 | /// 15 | /// Initializes a new instance of the class. 16 | /// 17 | public Form1() 18 | { 19 | InitializeComponent(); 20 | ViewModel = new MainViewModel(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Roslyn/IViewFor/Models/IViewForInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using ReactiveUI.SourceGenerators.Models; 7 | 8 | namespace ReactiveUI.SourceGenerators.Input.Models; 9 | 10 | /// 11 | /// A model with gathered info on a given command method. 12 | /// 13 | internal sealed record IViewForInfo( 14 | TargetInfo TargetInfo, 15 | string ViewModelTypeName, 16 | IViewForBaseType BaseType, 17 | string SplatRegistrationType, 18 | string SplatViewModelRegistrationType); 19 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPGeneratorTests.FromFieldNestedClass#TestNs.TestVM+TestVMInner1.ObservableAsProperties.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM+TestVMInner1.ObservableAsProperties.g.cs 2 | // 3 | #pragma warning disable 4 | #nullable enable 5 | namespace TestNs 6 | { 7 | public partial class TestVM 8 | { 9 | 10 | public partial class TestVMInner1 11 | { 12 | /// 13 | private readonly ReactiveUI.ObservableAsPropertyHelper _testIn1Helper; 14 | 15 | /// 16 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 17 | public int TestIn1 { get => _testIn1 = _testIn1Helper?.Value ?? _testIn1; } 18 | } 19 | } 20 | 21 | } 22 | #nullable restore 23 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPGeneratorTests.FromFieldNestedClass#TestNs.TestVM+TestVMInner2.ObservableAsProperties.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM+TestVMInner2.ObservableAsProperties.g.cs 2 | // 3 | #pragma warning disable 4 | #nullable enable 5 | namespace TestNs 6 | { 7 | public partial class TestVM 8 | { 9 | 10 | public partial class TestVMInner2 11 | { 12 | /// 13 | private readonly ReactiveUI.ObservableAsPropertyHelper _testIn2Helper; 14 | 15 | /// 16 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 17 | public int TestIn2 { get => _testIn2 = _testIn2Helper?.Value ?? _testIn2; } 18 | } 19 | } 20 | 21 | } 22 | #nullable restore 23 | #pragma warning restore -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/Platforms/Windows/app.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | true/PM 12 | PerMonitorV2, PerMonitor 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/Platforms/Tizen/tizen-manifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | maui-appicon-placeholder 7 | 8 | 9 | 10 | 11 | http://tizen.org/privilege/internet 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/Platforms/iOS/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved. 2 | // Licensed to the .NET Foundation under one or more agreements. 3 | // The .NET Foundation licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using Foundation; 7 | 8 | namespace MauiApp1 9 | { 10 | /// 11 | /// AppDelegate. 12 | /// 13 | [Register("AppDelegate")] 14 | public class AppDelegate : MauiUIApplicationDelegate 15 | { 16 | /// 17 | /// Creates the maui application. 18 | /// 19 | /// MauiApp. 20 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/Platforms/MacCatalyst/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved. 2 | // Licensed to the .NET Foundation under one or more agreements. 3 | // The .NET Foundation licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using Foundation; 7 | 8 | namespace MauiApp1 9 | { 10 | /// 11 | /// AppDelegate. 12 | /// 13 | [Register("AppDelegate")] 14 | public class AppDelegate : MauiUIApplicationDelegate 15 | { 16 | /// 17 | /// Creates the maui application. 18 | /// 19 | /// MauiApp. 20 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactiveProperties#TestNs.TestVM.Properties.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM.Properties.g.cs 2 | // 3 | using ReactiveUI; 4 | 5 | #pragma warning disable 6 | #nullable enable 7 | 8 | namespace TestNs 9 | { 10 | 11 | public partial class TestVM 12 | { 13 | 14 | /// 15 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 16 | public int Test1 17 | { 18 | get => _test1; 19 | [global::System.Diagnostics.CodeAnalysis.MemberNotNull("_test1")] 20 | set 21 | { 22 | this.RaiseAndSetIfChanged(ref _test1, value); 23 | } 24 | } 25 | } 26 | } 27 | #nullable restore 28 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Execute/TestWinFormsVMCHost.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using System.Diagnostics.CodeAnalysis; 7 | using ReactiveUI.SourceGenerators.WinForms; 8 | 9 | namespace SGReactiveUI.SourceGenerators.Test; 10 | 11 | /// 12 | /// TestWinFormsVMCHost. 13 | /// 14 | /// 15 | /// 16 | /// 17 | [ViewModelControlHost(nameof(UserControl))] 18 | public partial class TestWinFormsVMCHost; 19 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Execute/TestViewModel2.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using System.Diagnostics.CodeAnalysis; 7 | using ReactiveUI; 8 | using ReactiveUI.SourceGenerators; 9 | 10 | namespace SGReactiveUI.SourceGenerators.Test; 11 | 12 | /// 13 | /// TestViewModel2. 14 | /// 15 | /// the type. 16 | /// 17 | [ExcludeFromCodeCoverage] 18 | public partial class TestViewModel2 : ReactiveObject 19 | { 20 | [Reactive] 21 | private bool _IsTrue; 22 | } 23 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactivePropertiesWithAccess#TestNs.TestVM.Properties.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM.Properties.g.cs 2 | // 3 | using ReactiveUI; 4 | 5 | #pragma warning disable 6 | #nullable enable 7 | 8 | namespace TestNs 9 | { 10 | 11 | public partial class TestVM 12 | { 13 | 14 | /// 15 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 16 | public int Test2 17 | { 18 | get => _test2; 19 | [global::System.Diagnostics.CodeAnalysis.MemberNotNull("_test2")] 20 | set 21 | { 22 | this.RaiseAndSetIfChanged(ref _test2, value); 23 | } 24 | } 25 | } 26 | } 27 | #nullable restore 28 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Execute/TestWinFormsVMCHost.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SGReactiveUI.SourceGenerators.Test 2 | { 3 | partial class TestWinFormsVMCHost 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | #region Component Designer generated code 11 | 12 | /// 13 | /// Required method for Designer support - do not modify 14 | /// the contents of this method with the code editor. 15 | /// 16 | private void InitializeComponent() 17 | { 18 | components = new System.ComponentModel.Container(); 19 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 20 | } 21 | 22 | #endregion 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactiveFromPartialWithAlsoNotify#TestNs.TestVM.Properties.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM.Properties.g.cs 2 | // 3 | using ReactiveUI; 4 | 5 | #pragma warning disable 6 | #nullable enable 7 | 8 | namespace TestNs 9 | { 10 | 11 | public partial class TestVM 12 | { 13 | 14 | /// 15 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 16 | public int Test4 17 | { 18 | get => _test4; 19 | [global::System.Diagnostics.CodeAnalysis.MemberNotNull("_test4")] 20 | set 21 | { 22 | this.RaiseAndSetIfChanged(ref _test4, value); 23 | } 24 | } 25 | } 26 | } 27 | #nullable restore 28 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Roslyn/Generated/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute.g.cs: -------------------------------------------------------------------------------- 1 | // 2 | #pragma warning disable 3 | #nullable enable annotations 4 | 5 | // Licensed to the .NET Foundation under one or more agreements. 6 | // The .NET Foundation licenses this file to you under the MIT license. 7 | 8 | namespace System.Diagnostics.CodeAnalysis 9 | { 10 | /// 11 | /// Applied to a method that will never return under any circumstance. 12 | /// 13 | [global::System.AttributeUsage(global::System.AttributeTargets.Method, Inherited = false)] 14 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 15 | internal sealed class DoesNotReturnAttribute : global::System.Attribute 16 | { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactivePropertiesCalledValue#TestNs.TestVM.Properties.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM.Properties.g.cs 2 | // 3 | using ReactiveUI; 4 | 5 | #pragma warning disable 6 | #nullable enable 7 | 8 | namespace TestNs 9 | { 10 | 11 | public partial class TestVM 12 | { 13 | 14 | /// 15 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 16 | public string Value 17 | { 18 | get => value; 19 | [global::System.Diagnostics.CodeAnalysis.MemberNotNull("this.value")] 20 | set 21 | { 22 | this.RaiseAndSetIfChanged(ref this.value, value); 23 | } 24 | } 25 | } 26 | } 27 | #nullable restore 28 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactivePropertiesWithInit#TestNs.TestVM.Properties.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM.Properties.g.cs 2 | // 3 | using ReactiveUI; 4 | 5 | #pragma warning disable 6 | #nullable enable 7 | 8 | namespace TestNs 9 | { 10 | 11 | public partial class TestVM 12 | { 13 | 14 | /// 15 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 16 | public string MustBeSet 17 | { 18 | get => _mustBeSet; 19 | [global::System.Diagnostics.CodeAnalysis.MemberNotNull("_mustBeSet")] 20 | set 21 | { 22 | this.RaiseAndSetIfChanged(ref _mustBeSet, value); 23 | } 24 | } 25 | } 26 | } 27 | #nullable restore 28 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Roslyn/Generated/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Runtime.CompilerServices.IsExternalInit.g.cs: -------------------------------------------------------------------------------- 1 | // 2 | #pragma warning disable 3 | #nullable enable annotations 4 | 5 | // Licensed to the .NET Foundation under one or more agreements. 6 | // The .NET Foundation licenses this file to you under the MIT license. 7 | 8 | namespace System.Runtime.CompilerServices 9 | { 10 | /// 11 | /// Reserved to be used by the compiler for tracking metadata. 12 | /// This class should not be used by developers in source code. 13 | /// 14 | [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] 15 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 16 | internal static class IsExternalInit 17 | { 18 | } 19 | } -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/AppShell.xaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved. 2 | // Licensed to the .NET Foundation under one or more agreements. 3 | // The .NET Foundation licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | namespace MauiApp1 7 | { 8 | /// 9 | /// AppShell. 10 | /// 11 | /// 12 | public partial class AppShell : Shell 13 | { 14 | /// 15 | /// Initializes a new instance of the class. 16 | /// 17 | /// 18 | /// To be added. 19 | /// 20 | public AppShell() 21 | { 22 | InitializeComponent(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/IVIEWFOR/IViewForGeneratorTests.FromIViewFor#ReactiveUI.ReactiveUISourceGeneratorsExtensions.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: ReactiveUI.ReactiveUISourceGeneratorsExtensions.g.cs 2 | // 3 | #pragma warning disable 4 | #nullable enable 5 | 6 | using global::ReactiveUI; 7 | using global::Splat; 8 | 9 | namespace ReactiveUI.SourceGenerators 10 | { 11 | /// 12 | /// Source-generated registration extensions for ReactiveUI views. 13 | /// 14 | internal static class ReactiveUISourceGeneratorsExtensions 15 | { 16 | public static void RegisterViewsForViewModelsSourceGenerated(this global::Splat.IMutableDependencyResolver resolver) 17 | { 18 | if (resolver is null) throw new global::System.ArgumentNullException(nameof(resolver)); 19 | } 20 | } 21 | } 22 | #nullable restore 23 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPGeneratorTests.FromFieldNestedClass#TestNs.TestVM+TestVMInner2+TestVMInner3.ObservableAsProperties.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM+TestVMInner2+TestVMInner3.ObservableAsProperties.g.cs 2 | // 3 | #pragma warning disable 4 | #nullable enable 5 | namespace TestNs 6 | { 7 | public partial class TestVM 8 | { 9 | public partial class TestVMInner2 10 | { 11 | 12 | public partial class TestVMInner3 13 | { 14 | /// 15 | private readonly ReactiveUI.ObservableAsPropertyHelper _testIn3Helper; 16 | 17 | /// 18 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 19 | public int TestIn3 { get => _testIn3 = _testIn3Helper?.Value ?? _testIn3; } 20 | } 21 | } 22 | } 23 | 24 | } 25 | #nullable restore 26 | #pragma warning restore -------------------------------------------------------------------------------- /src/TestApps/TestAvaloniaApplication.Desktop/TestAvaloniaApplication.Desktop.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | 6 | net8.0 7 | enable 8 | true 9 | app.manifest 10 | false 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/TestApps/TestWinFormsApplication/Program.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved. 2 | // Licensed to the .NET Foundation under one or more agreements. 3 | // The .NET Foundation licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | namespace WinFormsApp1 7 | { 8 | internal static class Program 9 | { 10 | /// 11 | /// The main entry point for the application. 12 | /// 13 | [STAThread] 14 | private static void Main() 15 | { 16 | // To customize application configuration such as set high DPI settings or default font, 17 | // see https://aka.ms/applicationconfiguration. 18 | ApplicationConfiguration.Initialize(); 19 | Application.Run(new Form1()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/TestApps/TestAvaloniaApplication/Views/MainView.axaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved. 2 | // Licensed to the .NET Foundation under one or more agreements. 3 | // The .NET Foundation licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using Avalonia.Controls; 7 | 8 | namespace AvaloniaApplication1.Views; 9 | 10 | /// 11 | /// MainView. 12 | /// 13 | /// 14 | [ReactiveUI.SourceGenerators.IViewFor] 15 | public partial class MainView : UserControl 16 | { 17 | /// 18 | /// Initializes a new instance of the class. 19 | /// 20 | public MainView() 21 | { 22 | InitializeComponent(); 23 | ViewModel = new ViewModels.MainViewModel(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/App.xaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved. 2 | // Licensed to the .NET Foundation under one or more agreements. 3 | // The .NET Foundation licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | namespace MauiApp1 7 | { 8 | /// 9 | /// App. 10 | /// 11 | /// 12 | public partial class App : Application 13 | { 14 | /// 15 | /// Initializes a new instance of the class. 16 | /// 17 | /// 18 | /// To be added. 19 | /// 20 | public App() 21 | { 22 | InitializeComponent(); 23 | MainPage = new AppShell(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/TestApps/TestAvaloniaApplication/ViewModels/MainViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved. 2 | // Licensed to the .NET Foundation under one or more agreements. 3 | // The .NET Foundation licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | namespace AvaloniaApplication1.ViewModels; 7 | 8 | /// 9 | /// MainViewModel. 10 | /// 11 | /// 12 | public class MainViewModel : ViewModelBase 13 | { 14 | /// 15 | /// Gets the greeting. 16 | /// 17 | /// 18 | /// The greeting. 19 | /// 20 | #pragma warning disable CA1822 // Mark members as static 21 | public string Greeting => "Welcome to Avalonia!"; 22 | #pragma warning restore CA1822 // Mark members as static 23 | } 24 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Roslyn/RoutedControlHost/Models/RoutedControlHostInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using ReactiveUI.SourceGenerators.Helpers; 7 | 8 | namespace ReactiveUI.SourceGenerators.Input.Models; 9 | 10 | /// 11 | /// A model with gathered info on a given command method. 12 | /// 13 | internal sealed record RoutedControlHostInfo( 14 | string FileHintName, 15 | string TargetName, 16 | string TargetNamespace, 17 | string TargetNamespaceWithNamespace, 18 | string TargetVisibility, 19 | string TargetType, 20 | string BaseTypeName, 21 | EquatableArray ForwardedAttributes); 22 | -------------------------------------------------------------------------------- /src/TestApps/TestWpfApplication/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved. 2 | // Licensed to the .NET Foundation under one or more agreements. 3 | // The .NET Foundation licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using System.Windows; 7 | 8 | namespace WpfApp1 9 | { 10 | /// 11 | /// Interaction logic for MainWindow.xaml. 12 | /// 13 | [ReactiveUI.SourceGenerators.IViewFor] 14 | public partial class MainWindow : Window 15 | { 16 | /// 17 | /// Initializes a new instance of the class. 18 | /// 19 | public MainWindow() 20 | { 21 | InitializeComponent(); 22 | DataContext = ViewModel = new MainViewModel(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/Platforms/Android/MainActivity.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved. 2 | // Licensed to the .NET Foundation under one or more agreements. 3 | // The .NET Foundation licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using Android.App; 7 | using Android.Content.PM; 8 | 9 | namespace MauiApp1 10 | { 11 | /// 12 | /// MainActivity. 13 | /// 14 | /// 15 | [Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, LaunchMode = LaunchMode.SingleTop, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)] 16 | public class MainActivity : MauiAppCompatActivity; 17 | } 18 | -------------------------------------------------------------------------------- /.github/workflows/lock.yml: -------------------------------------------------------------------------------- 1 | name: 'Lock Threads' 2 | 3 | on: 4 | schedule: 5 | - cron: '0 0 * * *' 6 | workflow_dispatch: 7 | 8 | permissions: 9 | issues: write 10 | pull-requests: write 11 | 12 | concurrency: 13 | group: lock 14 | 15 | jobs: 16 | action: 17 | runs-on: ubuntu-latest 18 | steps: 19 | - uses: dessant/lock-threads@v6 20 | with: 21 | github-token: ${{ github.token }} 22 | issue-inactive-days: '14' 23 | pr-inactive-days: '14' 24 | issue-comment: > 25 | This issue has been automatically locked since there 26 | has not been any recent activity after it was closed. 27 | Please open a new issue for related bugs. 28 | pr-comment: > 29 | This pull request has been automatically locked since there 30 | has not been any recent activity after it was closed. 31 | Please open a new issue for related bugs. -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Execute/Program.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using System.Diagnostics.CodeAnalysis; 7 | using ReactiveUI.SourceGenerators; 8 | using Splat; 9 | 10 | namespace SGReactiveUI.SourceGenerators.Test; 11 | 12 | /// 13 | /// EntryPoint. 14 | /// 15 | [ExcludeFromCodeCoverage] 16 | public static class Program 17 | { 18 | /// 19 | /// Defines the entry point of the application. 20 | /// 21 | public static void Main() 22 | { 23 | AppLocator.CurrentMutable.RegisterViewsForViewModelsSourceGenerated(); 24 | Application.Run(new TestViewWinForms()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Execute/TestAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using System.Diagnostics.CodeAnalysis; 7 | 8 | namespace SGReactiveUI.SourceGenerators.Test; 9 | 10 | /// 11 | /// TestAttribute. 12 | /// 13 | /// 14 | [ExcludeFromCodeCoverage] 15 | [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)] 16 | public sealed class TestAttribute : Attribute 17 | { 18 | /// 19 | /// Gets a parameter. 20 | /// 21 | /// 22 | /// a parameter. 23 | /// 24 | public string? AParameter { get; init; } 25 | } 26 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Roslyn/ViewModelControlHost/Models/ViewModelControlHostInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using ReactiveUI.SourceGenerators.Helpers; 7 | 8 | namespace ReactiveUI.SourceGenerators.Input.Models; 9 | 10 | /// 11 | /// A model with gathered info on a given command method. 12 | /// 13 | internal sealed record ViewModelControlHostInfo( 14 | string FileHintName, 15 | string TargetName, 16 | string TargetNamespace, 17 | string TargetNamespaceWithNamespace, 18 | string TargetVisibility, 19 | string TargetType, 20 | string ViewModelTypeName, 21 | EquatableArray ForwardedAttributes); 22 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Execute/TestViewModel{partTwo}.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using System.Diagnostics.CodeAnalysis; 7 | using ReactiveUI.SourceGenerators; 8 | 9 | namespace SGReactiveUI.SourceGenerators.Test 10 | { 11 | /// 12 | /// TestViewModel. 13 | /// 14 | /// 15 | [ExcludeFromCodeCoverage] 16 | public partial class TestViewModel 17 | { 18 | /// 19 | /// Test2s this instance. 20 | /// 21 | /// Rectangle. 22 | [ReactiveCommand] 23 | private Point Test2() => default; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPFromObservableGeneratorTests.FromField#TestNs.TestVM.ObservableAsProperties.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM.ObservableAsProperties.g.cs 2 | // 3 | #pragma warning disable 4 | #nullable enable 5 | namespace TestNs 6 | { 7 | 8 | public partial class TestVM 9 | { 10 | /// 11 | private readonly ReactiveUI.ObservableAsPropertyHelper _testPropertyHelper; 12 | 13 | /// 14 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 15 | [global::System.Runtime.Serialization.DataMemberAttribute()] 16 | [global::System.Text.Json.Serialization.JsonIncludeAttribute()] 17 | public double? TestProperty { get => _testProperty = (_testPropertyHelper == null ? _testProperty : _testPropertyHelper.Value); } 18 | } 19 | } 20 | #nullable restore 21 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Roslyn/Core/Models/Result.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using System; 7 | using ReactiveUI.SourceGenerators.Helpers; 8 | 9 | namespace ReactiveUI.SourceGenerators.Models; 10 | 11 | /// 12 | /// A model representing a value and an associated set of diagnostic errors. 13 | /// 14 | /// The type of the wrapped value. 15 | /// The wrapped value for the current result. 16 | /// The associated diagnostic errors, if any. 17 | internal sealed record Result(TValue Value, EquatableArray Errors) 18 | where TValue : IEquatable?; 19 | -------------------------------------------------------------------------------- /src/TestApps/TestAvaloniaApplication/Views/MainView.axaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/Platforms/iOS/Program.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved. 2 | // Licensed to the .NET Foundation under one or more agreements. 3 | // The .NET Foundation licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using UIKit; 7 | 8 | namespace MauiApp1 9 | { 10 | /// 11 | /// Program. 12 | /// 13 | public static class Program 14 | { 15 | /// 16 | /// Defines the entry point of the application. 17 | /// 18 | /// The arguments. 19 | private static void Main(string[] args) 20 | { 21 | // if you want to use a different Application Delegate class from "AppDelegate" 22 | // you can specify it here. 23 | UIApplication.Main(args, null, typeof(AppDelegate)); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/DERIVEDLIST/ReactiveCollectionGeneratorTests.FromReactiveCollectionField#ReactiveUI.SourceGenerators.BindableDerivedListAttribute.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: ReactiveUI.SourceGenerators.BindableDerivedListAttribute.g.cs 2 | // Copyright (c) 2025 .NET Foundation and Contributors. All rights reserved. 3 | // Licensed to the .NET Foundation under one or more agreements. 4 | // The .NET Foundation licenses this file to you under the MIT license. 5 | // See the LICENSE file in the project root for full license information. 6 | 7 | using System; 8 | 9 | // 10 | #pragma warning disable 11 | #nullable enable 12 | namespace ReactiveUI.SourceGenerators; 13 | 14 | /// 15 | /// ReactiveAttribute. 16 | /// 17 | /// 18 | [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = false)] 19 | internal sealed class BindableDerivedListAttribute : Attribute; 20 | #nullable restore 21 | #pragma warning restore -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/Platforms/MacCatalyst/Program.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved. 2 | // Licensed to the .NET Foundation under one or more agreements. 3 | // The .NET Foundation licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using UIKit; 7 | 8 | namespace MauiApp1 9 | { 10 | /// 11 | /// Program. 12 | /// 13 | public static class Program 14 | { 15 | /// 16 | /// Defines the entry point of the application. 17 | /// 18 | /// The arguments. 19 | private static void Main(string[] args) 20 | { 21 | // if you want to use a different Application Delegate class from "AppDelegate" 22 | // you can specify it here. 23 | UIApplication.Main(args, null, typeof(AppDelegate)); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactiveProperiesWithAttributes#TestNs.TestVM.Properties.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM.Properties.g.cs 2 | // 3 | using ReactiveUI; 4 | 5 | #pragma warning disable 6 | #nullable enable 7 | 8 | namespace TestNs 9 | { 10 | 11 | public partial class TestVM 12 | { 13 | 14 | /// 15 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 16 | [global::System.Runtime.Serialization.DataMemberAttribute()] 17 | [global::System.Text.Json.Serialization.JsonIncludeAttribute()] 18 | public int Test3 19 | { 20 | get => _test3; 21 | [global::System.Diagnostics.CodeAnalysis.MemberNotNull("_test3")] 22 | set 23 | { 24 | this.RaiseAndSetIfChanged(ref _test3, value); 25 | } 26 | } 27 | } 28 | } 29 | #nullable restore 30 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/REACTIVEOBJ/ReactiveObjectGeneratorTests.FromReactiveObject#ReactiveUI.SourceGenerators.IReactiveObjectAttribute.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: ReactiveUI.SourceGenerators.IReactiveObjectAttribute.g.cs 2 | // Copyright (c) 2025 .NET Foundation and Contributors. All rights reserved. 3 | // Licensed to the .NET Foundation under one or more agreements. 4 | // The .NET Foundation licenses this file to you under the MIT license. 5 | // See the LICENSE file in the project root for full license information. 6 | 7 | // 8 | #pragma warning disable 9 | #nullable enable 10 | namespace ReactiveUI.SourceGenerators; 11 | 12 | /// 13 | /// IReactiveObject Attribute. 14 | /// 15 | /// 16 | [global::System.AttributeUsage(global::System.AttributeTargets.Class, AllowMultiple = false, Inherited = false)] 17 | internal sealed class IReactiveObjectAttribute : global::System.Attribute; 18 | #nullable restore 19 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Execute/TestViewWpf2.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using System.Diagnostics.CodeAnalysis; 7 | using System.Windows; 8 | using ReactiveUI.SourceGenerators; 9 | 10 | namespace SGReactiveUI.SourceGenerators.Test; 11 | 12 | /// 13 | /// TestViewWpf2. 14 | /// 15 | /// 16 | [IViewFor("SGReactiveUI.SourceGenerators.Test.TestViewModel2", RegistrationType = SplatRegistrationType.PerRequest)] 17 | public partial class TestViewWpf2 : Window 18 | { 19 | /// 20 | /// Initializes a new instance of the class. 21 | /// 22 | public TestViewWpf2() => ViewModel = new(); 23 | } 24 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/DERIVEDLIST/BindableDerivedListGeneratorTests.FromReactiveProperties#ReactiveUI.SourceGenerators.BindableDerivedListAttribute.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: ReactiveUI.SourceGenerators.BindableDerivedListAttribute.g.cs 2 | // Copyright (c) 2025 .NET Foundation and Contributors. All rights reserved. 3 | // Licensed to the .NET Foundation under one or more agreements. 4 | // The .NET Foundation licenses this file to you under the MIT license. 5 | // See the LICENSE file in the project root for full license information. 6 | 7 | // 8 | #pragma warning disable 9 | #nullable enable 10 | namespace ReactiveUI.SourceGenerators; 11 | 12 | /// 13 | /// ReactiveAttribute. 14 | /// 15 | /// 16 | [global::System.AttributeUsage(global::System.AttributeTargets.Field, AllowMultiple = false, Inherited = false)] 17 | internal sealed class BindableDerivedListAttribute : global::System.Attribute; 18 | #nullable restore 19 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactivePropertiesWithIdenticalClass#TestNs1.TestVM.Properties.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs1.TestVM.Properties.g.cs 2 | // 3 | using ReactiveUI; 4 | 5 | #pragma warning disable 6 | #nullable enable 7 | 8 | namespace TestNs1 9 | { 10 | 11 | public partial class TestVM 12 | { 13 | 14 | /// 15 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 16 | [global::System.Runtime.Serialization.DataMemberAttribute()] 17 | [global::System.Text.Json.Serialization.JsonIncludeAttribute()] 18 | public string? Name 19 | { 20 | get => _name; 21 | [global::System.Diagnostics.CodeAnalysis.MemberNotNull("_name")] 22 | set 23 | { 24 | this.RaiseAndSetIfChanged(ref _name, value); 25 | } 26 | } 27 | } 28 | } 29 | #nullable restore 30 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactivePropertiesWithIdenticalClass#TestNs2.TestVM.Properties.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs2.TestVM.Properties.g.cs 2 | // 3 | using ReactiveUI; 4 | 5 | #pragma warning disable 6 | #nullable enable 7 | 8 | namespace TestNs2 9 | { 10 | 11 | public partial class TestVM 12 | { 13 | 14 | /// 15 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 16 | [global::System.Runtime.Serialization.DataMemberAttribute()] 17 | [global::System.Text.Json.Serialization.JsonIncludeAttribute()] 18 | public string? Name 19 | { 20 | get => _name; 21 | [global::System.Diagnostics.CodeAnalysis.MemberNotNull("_name")] 22 | set 23 | { 24 | this.RaiseAndSetIfChanged(ref _name, value); 25 | } 26 | } 27 | } 28 | } 29 | #nullable restore 30 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Roslyn/BindableDerivedList/Models/BindableDerivedListInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using ReactiveUI.SourceGenerators.Helpers; 7 | using ReactiveUI.SourceGenerators.Models; 8 | 9 | namespace ReactiveUI.SourceGenerators.BindableDerivedList.Models; 10 | 11 | /// 12 | /// A model with gathered info on a given field. 13 | /// 14 | internal sealed record BindableDerivedListInfo( 15 | TargetInfo TargetInfo, 16 | string TypeNameWithNullabilityAnnotations, 17 | string FieldName, 18 | string PropertyName, 19 | bool IsReferenceTypeOrUnconstrainedTypeParameter, 20 | bool IncludeMemberNotNullOnSetAccessor, 21 | EquatableArray ForwardedAttributes); 22 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Execute/Person.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using System.Diagnostics.CodeAnalysis; 7 | using ReactiveUI.SourceGenerators; 8 | 9 | namespace SGReactiveUI.SourceGenerators.Test; 10 | 11 | /// 12 | /// Person. 13 | /// 14 | /// 15 | [ExcludeFromCodeCoverage] 16 | [IReactiveObject] 17 | public partial class Person 18 | { 19 | /// 20 | /// Gets or sets a value indicating whether this is deleted. 21 | /// 22 | /// 23 | /// true if deleted; otherwise, false. 24 | /// 25 | [Reactive] 26 | public partial bool Deleted { get; set; } 27 | } 28 | -------------------------------------------------------------------------------- /src/TestApps/TestAvaloniaApplication.Desktop/app.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactivePropertiesWithAttributesAccessAndInheritance#TestNs.TestVM.Properties.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM.Properties.g.cs 2 | // 3 | using ReactiveUI; 4 | 5 | #pragma warning disable 6 | #nullable enable 7 | 8 | namespace TestNs 9 | { 10 | 11 | public partial class TestVM 12 | { 13 | 14 | /// 15 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 16 | [global::System.Runtime.Serialization.DataMemberAttribute()] 17 | [global::System.Text.Json.Serialization.JsonIncludeAttribute()] 18 | public string? Name 19 | { 20 | get => _name; 21 | [global::System.Diagnostics.CodeAnalysis.MemberNotNull("_name")] 22 | set 23 | { 24 | this.RaiseAndSetIfChanged(ref _name, value); 25 | } 26 | } 27 | } 28 | } 29 | #nullable restore 30 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Roslyn/ReactiveCollection/Models/ReactiveCollectionFieldInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using ReactiveUI.SourceGenerators.Helpers; 7 | using ReactiveUI.SourceGenerators.Models; 8 | 9 | namespace ReactiveUI.SourceGenerators.Reactive.Models; 10 | 11 | /// 12 | /// A model with gathered info on a given field. 13 | /// 14 | internal sealed record ReactiveCollectionFieldInfo( 15 | TargetInfo TargetInfo, 16 | string TypeNameWithNullabilityAnnotations, 17 | string FieldName, 18 | string PropertyName, 19 | string? Initializer, 20 | bool IsReferenceTypeOrUnconstrainedTypeParameter, 21 | bool IncludeMemberNotNullOnSetAccessor, 22 | EquatableArray ForwardedAttributes); 23 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/REACTIVECOLL/ReactiveCollectionGeneratorTests.FromReactiveCollectionField#ReactiveUI.SourceGenerators.ReactiveCollectionAttribute.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: ReactiveUI.SourceGenerators.ReactiveCollectionAttribute.g.cs 2 | // Copyright (c) 2025 .NET Foundation and Contributors. All rights reserved. 3 | // Licensed to the .NET Foundation under one or more agreements. 4 | // The .NET Foundation licenses this file to you under the MIT license. 5 | // See the LICENSE file in the project root for full license information. 6 | 7 | // 8 | #pragma warning disable 9 | #nullable enable 10 | namespace ReactiveUI.SourceGenerators; 11 | 12 | /// 13 | /// ReactiveAttribute. 14 | /// 15 | /// 16 | [global::System.AttributeUsage(global::System.AttributeTargets.Field | global::System.AttributeTargets.Property, AllowMultiple = false, Inherited = false)] 17 | internal sealed class ReactiveCollectionAttribute : global::System.Attribute; 18 | #nullable restore 19 | #pragma warning restore -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/Platforms/Windows/App.xaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved. 2 | // Licensed to the .NET Foundation under one or more agreements. 3 | // The .NET Foundation licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | namespace MauiApp1.WinUI 7 | { 8 | /// 9 | /// Provides application-specific behavior to supplement the default Application class. 10 | /// 11 | public partial class App : MauiWinUIApplication 12 | { 13 | /// 14 | /// Initializes a new instance of the class. 15 | /// 16 | public App() 17 | { 18 | InitializeComponent(); 19 | } 20 | 21 | /// 22 | /// Creates the maui application. 23 | /// 24 | /// MauiApp. 25 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Roslyn/Core/Helpers/SymbolHelpers.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using Microsoft.CodeAnalysis; 7 | 8 | namespace ReactiveUI.SourceGenerators.Helpers; 9 | 10 | /// 11 | /// Helper methods for working with symbols. 12 | /// 13 | internal static class SymbolHelpers 14 | { 15 | /// 16 | /// Default display format for symbols, omitting the global namespace and including nullable reference type modifiers. 17 | /// 18 | public static readonly SymbolDisplayFormat DefaultDisplay = 19 | SymbolDisplayFormat.FullyQualifiedFormat 20 | .WithGlobalNamespaceStyle(SymbolDisplayGlobalNamespaceStyle.Omitted) 21 | .WithMiscellaneousOptions(SymbolDisplayMiscellaneousOptions.IncludeNullableReferenceTypeModifier); 22 | } 23 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Roslyn/ObservableAsProperty/Models/ObservableFieldInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using ReactiveUI.SourceGenerators.Helpers; 7 | using ReactiveUI.SourceGenerators.Models; 8 | 9 | namespace ReactiveUI.SourceGenerators.Reactive.Models; 10 | 11 | /// 12 | /// A model with gathered info on a given field. 13 | /// 14 | internal sealed record ObservableFieldInfo( 15 | TargetInfo TargetInfo, 16 | string TypeNameWithNullabilityAnnotations, 17 | string FieldName, 18 | string PropertyName, 19 | string? Initializer, 20 | bool IsReferenceTypeOrUnconstrainedTypeParameter, 21 | bool IncludeMemberNotNullOnSetAccessor, 22 | EquatableArray ForwardedAttributes, 23 | string IsReadOnly, 24 | string AccessModifier, 25 | string Inheritance); 26 | -------------------------------------------------------------------------------- /src/TestApps/TestAvaloniaApplication/TestAvaloniaApplication.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net8.0 4 | enable 5 | latest 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Execute/TestViewWinForms.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using ReactiveUI.SourceGenerators; 7 | 8 | namespace SGReactiveUI.SourceGenerators.Test 9 | { 10 | /// 11 | /// TestViewWinForms. 12 | /// 13 | /// 14 | [IViewFor(RegistrationType = SplatRegistrationType.LazySingleton)] 15 | public partial class TestViewWinForms : Form 16 | { 17 | /// 18 | /// Initializes a new instance of the class. 19 | /// 20 | public TestViewWinForms() 21 | { 22 | InitializeComponent(); 23 | ViewModel = TestViewModel.Instance; 24 | ViewModel.Activator.Activate(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Roslyn/ReactiveUI.SourceGenerators.Roslyn.shproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | bc460daf-92ed-41d9-9eb4-2c92121d62a8 5 | 14.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Roslyn/Reactive/Models/PropertyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using ReactiveUI.SourceGenerators.Helpers; 7 | using ReactiveUI.SourceGenerators.Models; 8 | 9 | namespace ReactiveUI.SourceGenerators.Reactive.Models; 10 | 11 | /// 12 | /// A model with gathered info on a given field. 13 | /// 14 | internal sealed record PropertyInfo( 15 | TargetInfo TargetInfo, 16 | string TypeNameWithNullabilityAnnotations, 17 | string FieldName, 18 | string PropertyName, 19 | bool IsReferenceTypeOrUnconstrainedTypeParameter, 20 | bool IncludeMemberNotNullOnSetAccessor, 21 | EquatableArray ForwardedAttributes, 22 | string SetAccessModifier, 23 | string Inheritance, 24 | string UseRequired, 25 | bool IsProperty, 26 | string PropertyAccessModifier, 27 | EquatableArray AlsoNotify); 28 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Roslyn/Core/Extensions/SyntaxTokenExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using Microsoft.CodeAnalysis; 7 | using Microsoft.CodeAnalysis.CSharp; 8 | 9 | namespace ReactiveUI.SourceGenerators.Extensions; 10 | 11 | /// 12 | /// Extension methods for the type. 13 | /// 14 | internal static class SyntaxTokenExtensions 15 | { 16 | /// 17 | /// Deconstructs a into its value. 18 | /// 19 | /// The input value. 20 | /// The resulting value for . 21 | public static void Deconstruct(this in SyntaxToken syntaxToken, out SyntaxKind syntaxKind) => syntaxKind = syntaxToken.Kind(); 22 | } 23 | -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/Platforms/iOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | LSRequiresIPhoneOS 6 | 7 | UIDeviceFamily 8 | 9 | 1 10 | 2 11 | 12 | UIRequiredDeviceCapabilities 13 | 14 | arm64 15 | 16 | UISupportedInterfaceOrientations 17 | 18 | UIInterfaceOrientationPortrait 19 | UIInterfaceOrientationLandscapeLeft 20 | UIInterfaceOrientationLandscapeRight 21 | 22 | UISupportedInterfaceOrientations~ipad 23 | 24 | UIInterfaceOrientationPortrait 25 | UIInterfaceOrientationPortraitUpsideDown 26 | UIInterfaceOrientationLandscapeLeft 27 | UIInterfaceOrientationLandscapeRight 28 | 29 | XSAppIconAssets 30 | Assets.xcassets/appicon.appiconset 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPFromObservableGeneratorTests.FromObservableProp#TestNs.TestVM.ObservableAsPropertyFromObservable.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM.ObservableAsPropertyFromObservable.g.cs 2 | // 3 | using ReactiveUI; 4 | 5 | #pragma warning disable 6 | #nullable enable 7 | 8 | namespace TestNs 9 | { 10 | 11 | public partial class TestVM 12 | { 13 | /// 14 | private int _test1Property; 15 | 16 | /// 17 | private ReactiveUI.ObservableAsPropertyHelper? _test1PropertyHelper; 18 | 19 | /// 20 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 21 | public int Test1Property { get => _test1Property = _test1PropertyHelper?.Value ?? _test1Property; } 22 | 23 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 24 | protected void InitializeOAPH() 25 | { 26 | _test1PropertyHelper = Test1!.ToProperty(this, nameof(Test1Property)); 27 | } 28 | } 29 | } 30 | #nullable restore 31 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPFromObservableGeneratorTests.FromObservableMethods#TestNs.TestVM.ObservableAsPropertyFromObservable.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM.ObservableAsPropertyFromObservable.g.cs 2 | // 3 | using ReactiveUI; 4 | 5 | #pragma warning disable 6 | #nullable enable 7 | 8 | namespace TestNs 9 | { 10 | 11 | public partial class TestVM 12 | { 13 | /// 14 | private int _test2Property; 15 | 16 | /// 17 | private ReactiveUI.ObservableAsPropertyHelper? _test2PropertyHelper; 18 | 19 | /// 20 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 21 | public int Test2Property { get => _test2Property = _test2PropertyHelper?.Value ?? _test2Property; } 22 | 23 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 24 | protected void InitializeOAPH() 25 | { 26 | _test2PropertyHelper = Test2()!.ToProperty(this, nameof(Test2Property)); 27 | } 28 | } 29 | } 30 | #nullable restore 31 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPFromObservableGeneratorTests.FromObservableMethodsWithName#TestNs.TestVM.ObservableAsPropertyFromObservable.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM.ObservableAsPropertyFromObservable.g.cs 2 | // 3 | using ReactiveUI; 4 | 5 | #pragma warning disable 6 | #nullable enable 7 | 8 | namespace TestNs 9 | { 10 | 11 | public partial class TestVM 12 | { 13 | /// 14 | private int _test3Property; 15 | 16 | /// 17 | private ReactiveUI.ObservableAsPropertyHelper? _test3PropertyHelper; 18 | 19 | /// 20 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 21 | public int Test3Property { get => _test3Property = _test3PropertyHelper?.Value ?? _test3Property; } 22 | 23 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 24 | protected void InitializeOAPH() 25 | { 26 | _test3PropertyHelper = Test3()!.ToProperty(this, nameof(Test3Property)); 27 | } 28 | } 29 | } 30 | #nullable restore 31 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPFromObservableGeneratorTests.FromObservablePropNestedClasses#TestNs.TestVM.ObservableAsPropertyFromObservable.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM.ObservableAsPropertyFromObservable.g.cs 2 | // 3 | using ReactiveUI; 4 | 5 | #pragma warning disable 6 | #nullable enable 7 | 8 | namespace TestNs 9 | { 10 | 11 | public partial class TestVM 12 | { 13 | /// 14 | private int _test1Property; 15 | 16 | /// 17 | private ReactiveUI.ObservableAsPropertyHelper? _test1PropertyHelper; 18 | 19 | /// 20 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 21 | public int Test1Property { get => _test1Property = _test1PropertyHelper?.Value ?? _test1Property; } 22 | 23 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 24 | protected void InitializeOAPH() 25 | { 26 | _test1PropertyHelper = Test1!.ToProperty(this, nameof(Test1Property)); 27 | } 28 | } 29 | } 30 | #nullable restore 31 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPFromObservableGeneratorTests.FromObservablePropertiesWithName#TestNs.TestVM.ObservableAsPropertyFromObservable.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM.ObservableAsPropertyFromObservable.g.cs 2 | // 3 | using ReactiveUI; 4 | 5 | #pragma warning disable 6 | #nullable enable 7 | 8 | namespace TestNs 9 | { 10 | 11 | public partial class TestVM 12 | { 13 | /// 14 | private int _test4Property; 15 | 16 | /// 17 | private ReactiveUI.ObservableAsPropertyHelper? _test4PropertyHelper; 18 | 19 | /// 20 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 21 | public int Test4Property { get => _test4Property = _test4PropertyHelper?.Value ?? _test4Property; } 22 | 23 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 24 | protected void InitializeOAPH() 25 | { 26 | _test4PropertyHelper = Test4!.ToProperty(this, nameof(Test4Property)); 27 | } 28 | } 29 | } 30 | #nullable restore 31 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPFromObservableGeneratorTests.FromPartialProperty#TestNs.TestVM.ObservableAsPropertyFromObservable.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM.ObservableAsPropertyFromObservable.g.cs 2 | // 3 | using ReactiveUI; 4 | 5 | #pragma warning disable 6 | #nullable enable 7 | 8 | namespace TestNs 9 | { 10 | 11 | public partial class TestVM 12 | { 13 | /// 14 | private double? _testProperty; 15 | 16 | /// 17 | private readonly ReactiveUI.ObservableAsPropertyHelper _testPropertyHelper; 18 | 19 | /// 20 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 21 | [global::System.Runtime.Serialization.DataMemberAttribute()] 22 | public partial double? TestProperty { get => _testProperty = (_testPropertyHelper == null ? _testProperty : _testPropertyHelper.Value); } 23 | 24 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 25 | protected void InitializeOAPH() 26 | { 27 | 28 | } 29 | } 30 | } 31 | #nullable restore 32 | #pragma warning restore -------------------------------------------------------------------------------- /src/TestApps/TestAvaloniaApplication.Desktop/Program.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved. 2 | // Licensed to the .NET Foundation under one or more agreements. 3 | // The .NET Foundation licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using System; 7 | 8 | using Avalonia; 9 | using Avalonia.ReactiveUI; 10 | 11 | namespace AvaloniaApplication1.Desktop; 12 | 13 | /// 14 | /// Program. 15 | /// 16 | internal static class Program 17 | { 18 | // Initialization code. Don't use any Avalonia, third-party APIs or any 19 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 20 | // yet and stuff might break. 21 | [STAThread] 22 | public static void Main(string[] args) => BuildAvaloniaApp() 23 | .StartWithClassicDesktopLifetime(args); 24 | 25 | // Avalonia configuration, don't remove; also used by visual designer. 26 | public static AppBuilder BuildAvaloniaApp() 27 | => AppBuilder.Configure() 28 | .UsePlatformDetect() 29 | .WithInterFont() 30 | .LogToTrace() 31 | .UseReactiveUI(); 32 | } 33 | -------------------------------------------------------------------------------- /src/TestApps/TestWinFormsApplication/Form1.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace WinFormsApp1 2 | { 3 | [ReactiveUI.SourceGenerators.IViewFor] 4 | partial class Form1 5 | { 6 | /// 7 | /// Required designer variable. 8 | /// 9 | private System.ComponentModel.IContainer components = null; 10 | 11 | /// 12 | /// Clean up any resources being used. 13 | /// 14 | /// true if managed resources should be disposed; otherwise, false. 15 | protected override void Dispose(bool disposing) 16 | { 17 | if (disposing && (components != null)) 18 | { 19 | components.Dispose(); 20 | } 21 | base.Dispose(disposing); 22 | } 23 | 24 | #region Windows Form Designer generated code 25 | 26 | /// 27 | /// Required method for Designer support - do not modify 28 | /// the contents of this method with the code editor. 29 | /// 30 | private void InitializeComponent() 31 | { 32 | this.components = new System.ComponentModel.Container(); 33 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 34 | this.ClientSize = new System.Drawing.Size(800, 450); 35 | this.Text = "Form1"; 36 | } 37 | 38 | #endregion 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/MauiProgram.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved. 2 | // Licensed to the .NET Foundation under one or more agreements. 3 | // The .NET Foundation licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using Microsoft.Extensions.Logging; 7 | 8 | namespace MauiApp1 9 | { 10 | /// 11 | /// MauiProgram. 12 | /// 13 | public static class MauiProgram 14 | { 15 | /// 16 | /// Creates the maui application. 17 | /// 18 | /// MauiApp. 19 | public static MauiApp CreateMauiApp() 20 | { 21 | var builder = MauiApp.CreateBuilder(); 22 | builder 23 | .UseMauiApp() 24 | .ConfigureFonts(fonts => 25 | { 26 | fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); 27 | fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); 28 | }); 29 | 30 | #if DEBUG 31 | builder.Logging.AddDebug(); 32 | #endif 33 | 34 | return builder.Build(); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPFromObservableGeneratorTests.FromObservablePropNestedClasses#TestNs.TestVM+TestVMInner1.ObservableAsPropertyFromObservable.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM+TestVMInner1.ObservableAsPropertyFromObservable.g.cs 2 | // 3 | using ReactiveUI; 4 | 5 | #pragma warning disable 6 | #nullable enable 7 | 8 | namespace TestNs 9 | { 10 | public partial class TestVM 11 | { 12 | 13 | public partial class TestVMInner1 14 | { 15 | /// 16 | private int _testIn1Property; 17 | 18 | /// 19 | private ReactiveUI.ObservableAsPropertyHelper? _testIn1PropertyHelper; 20 | 21 | /// 22 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 23 | public int TestIn1Property { get => _testIn1Property = _testIn1PropertyHelper?.Value ?? _testIn1Property; } 24 | 25 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 26 | protected void InitializeOAPH() 27 | { 28 | _testIn1PropertyHelper = TestIn1!.ToProperty(this, nameof(TestIn1Property)); 29 | } 30 | } 31 | } 32 | 33 | } 34 | #nullable restore 35 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPFromObservableGeneratorTests.FromObservablePropNestedClasses#TestNs.TestVM+TestVMInner2.ObservableAsPropertyFromObservable.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM+TestVMInner2.ObservableAsPropertyFromObservable.g.cs 2 | // 3 | using ReactiveUI; 4 | 5 | #pragma warning disable 6 | #nullable enable 7 | 8 | namespace TestNs 9 | { 10 | public partial class TestVM 11 | { 12 | 13 | public partial class TestVMInner2 14 | { 15 | /// 16 | private int _testIn2Property; 17 | 18 | /// 19 | private ReactiveUI.ObservableAsPropertyHelper? _testIn2PropertyHelper; 20 | 21 | /// 22 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 23 | public int TestIn2Property { get => _testIn2Property = _testIn2PropertyHelper?.Value ?? _testIn2Property; } 24 | 25 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 26 | protected void InitializeOAPH() 27 | { 28 | _testIn2PropertyHelper = TestIn2!.ToProperty(this, nameof(TestIn2Property)); 29 | } 30 | } 31 | } 32 | 33 | } 34 | #nullable restore 35 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPFromObservableGeneratorTests.FromObservablePropertiesWithAttribute#TestNs.TestVM.ObservableAsPropertyFromObservable.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM.ObservableAsPropertyFromObservable.g.cs 2 | // 3 | using ReactiveUI; 4 | 5 | #pragma warning disable 6 | #nullable enable 7 | 8 | namespace TestNs 9 | { 10 | 11 | public partial class TestVM 12 | { 13 | /// 14 | private int _test5Property; 15 | 16 | /// 17 | private ReactiveUI.ObservableAsPropertyHelper? _test5PropertyHelper; 18 | 19 | /// 20 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 21 | [global::System.Runtime.Serialization.DataMemberAttribute()] 22 | [global::System.Text.Json.Serialization.JsonIncludeAttribute()] 23 | public int Test5Property { get => _test5Property = _test5PropertyHelper?.Value ?? _test5Property; } 24 | 25 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 26 | protected void InitializeOAPH() 27 | { 28 | _test5PropertyHelper = Test5!.ToProperty(this, nameof(Test5Property)); 29 | } 30 | } 31 | } 32 | #nullable restore 33 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPFromObservableGeneratorTests.FromObservablePropertiesWithAttributeRef#TestNs.TestVM.ObservableAsPropertyFromObservable.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM.ObservableAsPropertyFromObservable.g.cs 2 | // 3 | using ReactiveUI; 4 | 5 | #pragma warning disable 6 | #nullable enable 7 | 8 | namespace TestNs 9 | { 10 | 11 | public partial class TestVM 12 | { 13 | /// 14 | private object _test6Property; 15 | 16 | /// 17 | private ReactiveUI.ObservableAsPropertyHelper? _test6PropertyHelper; 18 | 19 | /// 20 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 21 | [global::System.Runtime.Serialization.DataMemberAttribute()] 22 | [global::System.Text.Json.Serialization.JsonIncludeAttribute()] 23 | public object Test6Property { get => _test6Property = _test6PropertyHelper?.Value ?? _test6Property; } 24 | 25 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 26 | protected void InitializeOAPH() 27 | { 28 | _test6PropertyHelper = Test6!.ToProperty(this, nameof(Test6Property)); 29 | } 30 | } 31 | } 32 | #nullable restore 33 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Roslyn/ReactiveCommand/Models/CommandInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using ReactiveUI.SourceGenerators.Helpers; 7 | using ReactiveUI.SourceGenerators.Models; 8 | 9 | namespace ReactiveUI.SourceGenerators.Input.Models; 10 | 11 | internal record CommandInfo( 12 | TargetInfo TargetInfo, 13 | string MethodName, 14 | string MethodReturnType, 15 | string? ArgumentType, 16 | bool IsTask, 17 | bool IsReturnTypeVoid, 18 | bool IsObservable, 19 | string? CanExecuteObservableName, 20 | CanExecuteTypeInfo? CanExecuteTypeInfo, 21 | string? OutputScheduler, 22 | EquatableArray ForwardedPropertyAttributes, 23 | string AccessModifier) 24 | { 25 | private const string UnitTypeName = "global::System.Reactive.Unit"; 26 | 27 | public string GetOutputTypeText() => IsReturnTypeVoid 28 | ? UnitTypeName 29 | : MethodReturnType; 30 | 31 | public string GetInputTypeText() => string.IsNullOrWhiteSpace(ArgumentType) 32 | ? UnitTypeName 33 | : ArgumentType!; 34 | } 35 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Execute/TestViewWpf.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using System.Diagnostics.CodeAnalysis; 7 | using System.Windows; 8 | using ReactiveUI; 9 | using ReactiveUI.SourceGenerators; 10 | using Splat; 11 | 12 | namespace SGReactiveUI.SourceGenerators.Test; 13 | 14 | /// 15 | /// TestView. 16 | /// 17 | [IViewFor(RegistrationType = SplatRegistrationType.PerRequest, ViewModelRegistrationType = SplatRegistrationType.Constant)] 18 | public partial class TestViewWpf : Window 19 | { 20 | /// 21 | /// Initializes a new instance of the class. 22 | /// 23 | public TestViewWpf() 24 | { 25 | AppLocator.CurrentMutable.RegisterLazySingleton>(() => new TestViewWpf()); 26 | ViewModel = TestViewModel.Instance; 27 | } 28 | 29 | /// 30 | /// Gets or sets the test property. 31 | /// 32 | /// 33 | /// The test property. 34 | /// 35 | public int TestProperty { get; set; } 36 | } 37 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPFromObservableGeneratorTests.FromObservablePropNestedClasses#TestNs.TestVM+TestVMInner2+TestVMInner3.ObservableAsPropertyFromObservable.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM+TestVMInner2+TestVMInner3.ObservableAsPropertyFromObservable.g.cs 2 | // 3 | using ReactiveUI; 4 | 5 | #pragma warning disable 6 | #nullable enable 7 | 8 | namespace TestNs 9 | { 10 | public partial class TestVM 11 | { 12 | public partial class TestVMInner2 13 | { 14 | 15 | public partial class TestVMInner3 16 | { 17 | /// 18 | private int _testIn3Property; 19 | 20 | /// 21 | private ReactiveUI.ObservableAsPropertyHelper? _testIn3PropertyHelper; 22 | 23 | /// 24 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 25 | public int TestIn3Property { get => _testIn3Property = _testIn3PropertyHelper?.Value ?? _testIn3Property; } 26 | 27 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 28 | protected void InitializeOAPH() 29 | { 30 | _testIn3PropertyHelper = TestIn3!.ToProperty(this, nameof(TestIn3Property)); 31 | } 32 | } 33 | } 34 | } 35 | 36 | } 37 | #nullable restore 38 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Execute.Nested3/Class1.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. 2 | // Licensed to the ReactiveUI and contributors under one or more agreements. 3 | // The ReactiveUI and contributors licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | using System.Diagnostics.CodeAnalysis; 7 | using ReactiveUI; 8 | using ReactiveUI.SourceGenerators; 9 | using SGReactiveUI.SourceGenerators.Execute.Nested2; 10 | 11 | namespace SGReactiveUI.SourceGenerators.Execute.Nested3; 12 | 13 | /// 14 | /// Class1. 15 | /// 16 | [ExcludeFromCodeCoverage] 17 | public partial class Class1 : ReactiveObject 18 | { 19 | [Reactive] 20 | private string? _property1; 21 | 22 | /// 23 | /// Initializes a new instance of the class. 24 | /// 25 | public Class1() 26 | { 27 | SetPropertyCommand.Execute(new Nested1.Class1 { Property1 = "Initial Value" }).Subscribe(); 28 | } 29 | 30 | [ReactiveCommand] 31 | private SGReactiveUI.SourceGenerators.Execute.Nested2.Class1? SetProperty(Nested1.Class1? class1) 32 | { 33 | if (class1 == null) 34 | { 35 | return null; 36 | } 37 | 38 | return new() { Property1 = class1.Property1 }; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/OAPH/OAPFromObservableGeneratorTests.FromObservablePropertiesWithAttributeNullableRef#TestNs.TestVM.ObservableAsPropertyFromObservable.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs.TestVM.ObservableAsPropertyFromObservable.g.cs 2 | // 3 | using ReactiveUI; 4 | 5 | #pragma warning disable 6 | #nullable enable 7 | 8 | namespace TestNs 9 | { 10 | 11 | public partial class TestVM 12 | { 13 | /// 14 | private object? _test7Property; 15 | 16 | /// 17 | private ReactiveUI.ObservableAsPropertyHelper? _test7PropertyHelper; 18 | 19 | /// 20 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 21 | [global::System.Runtime.Serialization.DataMemberAttribute()] 22 | [global::System.Text.Json.Serialization.JsonIncludeAttribute()] 23 | public object? Test7Property { get => _test7Property = (_test7PropertyHelper == null ? _test7Property : _test7PropertyHelper.Value); } 24 | 25 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 26 | protected void InitializeOAPH() 27 | { 28 | _test7PropertyHelper = Test7!.ToProperty(this, nameof(Test7Property)); 29 | } 30 | } 31 | } 32 | #nullable restore 33 | #pragma warning restore -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/MainPage.xaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved. 2 | // Licensed to the .NET Foundation under one or more agreements. 3 | // The .NET Foundation licenses this file to you under the MIT license. 4 | // See the LICENSE file in the project root for full license information. 5 | 6 | namespace MauiApp1 7 | { 8 | /// 9 | /// MainPage. 10 | /// 11 | /// 12 | [ReactiveUI.SourceGenerators.IViewFor] 13 | public partial class MainPage : ContentPage 14 | { 15 | private int _count; 16 | 17 | /// 18 | /// Initializes a new instance of the class. 19 | /// 20 | public MainPage() 21 | { 22 | InitializeComponent(); 23 | ViewModel = new MainViewModel(); 24 | } 25 | 26 | private void OnCounterClicked(object sender, EventArgs e) 27 | { 28 | _count++; 29 | 30 | if (_count == 1) 31 | { 32 | CounterBtn.Text = $"Clicked {_count} time"; 33 | } 34 | else 35 | { 36 | CounterBtn.Text = $"Clicked {_count} times"; 37 | } 38 | 39 | SemanticScreenReader.Announce(CounterBtn.Text); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactivePropertiesWithNestedClass#TestNs1.TestViewModel3.Properties.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs1.TestViewModel3.Properties.g.cs 2 | // 3 | using ReactiveUI; 4 | 5 | #pragma warning disable 6 | #nullable enable 7 | 8 | namespace TestNs1 9 | { 10 | 11 | public partial class TestViewModel3 12 | { 13 | 14 | /// 15 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 16 | public float TestVM3Property 17 | { 18 | get => _testVM3Property; 19 | [global::System.Diagnostics.CodeAnalysis.MemberNotNull("_testVM3Property")] 20 | set 21 | { 22 | this.RaiseAndSetIfChanged(ref _testVM3Property, value); 23 | } 24 | } 25 | 26 | /// 27 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 28 | public float TestVM3Property2 29 | { 30 | get => _testVM3Property2; 31 | [global::System.Diagnostics.CodeAnalysis.MemberNotNull("_testVM3Property2")] 32 | set 33 | { 34 | this.RaiseAndSetIfChanged(ref _testVM3Property2, value); 35 | } 36 | } 37 | } 38 | } 39 | #nullable restore 40 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Execute/TestViewWinForms.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace SGReactiveUI.SourceGenerators.Test 2 | { 3 | partial class TestViewWinForms 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 33 | this.ClientSize = new System.Drawing.Size(800, 450); 34 | this.Text = "TestViewWinForms"; 35 | } 36 | 37 | #endregion 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactivePropertiesWithNestedClass#TestNs1.TestViewModel3+TestInnerClass1.Properties.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs1.TestViewModel3+TestInnerClass1.Properties.g.cs 2 | // 3 | using ReactiveUI; 4 | 5 | #pragma warning disable 6 | #nullable enable 7 | 8 | namespace TestNs1 9 | { 10 | public partial class TestViewModel3 11 | { 12 | 13 | public partial class TestInnerClass1 14 | { 15 | 16 | /// 17 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 18 | public int TestInner1 19 | { 20 | get => _testInner1; 21 | [global::System.Diagnostics.CodeAnalysis.MemberNotNull("_testInner1")] 22 | set 23 | { 24 | this.RaiseAndSetIfChanged(ref _testInner1, value); 25 | } 26 | } 27 | 28 | /// 29 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 30 | public int TestInner11 31 | { 32 | get => _testInner11; 33 | [global::System.Diagnostics.CodeAnalysis.MemberNotNull("_testInner11")] 34 | set 35 | { 36 | this.RaiseAndSetIfChanged(ref _testInner11, value); 37 | } 38 | } 39 | } 40 | } 41 | 42 | } 43 | #nullable restore 44 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerator.Tests/REACTIVE/ReactiveGeneratorTests.FromReactivePropertiesWithNestedClass#TestNs1.TestViewModel3+TestInnerClass2.Properties.g.verified.cs: -------------------------------------------------------------------------------- 1 | //HintName: TestNs1.TestViewModel3+TestInnerClass2.Properties.g.cs 2 | // 3 | using ReactiveUI; 4 | 5 | #pragma warning disable 6 | #nullable enable 7 | 8 | namespace TestNs1 9 | { 10 | public partial class TestViewModel3 11 | { 12 | 13 | public partial class TestInnerClass2 14 | { 15 | 16 | /// 17 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 18 | public int TestInner2 19 | { 20 | get => _testInner2; 21 | [global::System.Diagnostics.CodeAnalysis.MemberNotNull("_testInner2")] 22 | set 23 | { 24 | this.RaiseAndSetIfChanged(ref _testInner2, value); 25 | } 26 | } 27 | 28 | /// 29 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 30 | public int TestInner22 31 | { 32 | get => _testInner22; 33 | [global::System.Diagnostics.CodeAnalysis.MemberNotNull("_testInner22")] 34 | set 35 | { 36 | this.RaiseAndSetIfChanged(ref _testInner22, value); 37 | } 38 | } 39 | } 40 | } 41 | 42 | } 43 | #nullable restore 44 | #pragma warning restore -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Roslyn/Generated/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Diagnostics.CodeAnalysis.NotNullWhenAttribute.g.cs: -------------------------------------------------------------------------------- 1 | // 2 | #pragma warning disable 3 | #nullable enable annotations 4 | 5 | // Licensed to the .NET Foundation under one or more agreements. 6 | // The .NET Foundation licenses this file to you under the MIT license. 7 | 8 | namespace System.Diagnostics.CodeAnalysis 9 | { 10 | /// 11 | /// Specifies that when a method returns , the parameter will not be null even if the corresponding type allows it. 12 | /// 13 | [global::System.AttributeUsage(global::System.AttributeTargets.Parameter, Inherited = false)] 14 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 15 | internal sealed class NotNullWhenAttribute : global::System.Attribute 16 | { 17 | /// 18 | /// Initializes the attribute with the specified return value condition. 19 | /// 20 | /// The return value condition. If the method returns this value, the associated parameter will not be null. 21 | public NotNullWhenAttribute(bool returnValue) 22 | { 23 | ReturnValue = returnValue; 24 | } 25 | 26 | /// Gets the return value condition. 27 | public bool ReturnValue { get; } 28 | } 29 | } -------------------------------------------------------------------------------- /src/ReactiveUI.SourceGenerators.Analyzers.CodeFixes/Core/Generated/PolySharp.SourceGenerators/PolySharp.SourceGenerators.PolyfillsGenerator/System.Diagnostics.CodeAnalysis.NotNullWhenAttribute.g.cs: -------------------------------------------------------------------------------- 1 | // 2 | #pragma warning disable 3 | #nullable enable annotations 4 | 5 | // Licensed to the .NET Foundation under one or more agreements. 6 | // The .NET Foundation licenses this file to you under the MIT license. 7 | 8 | namespace System.Diagnostics.CodeAnalysis 9 | { 10 | /// 11 | /// Specifies that when a method returns , the parameter will not be null even if the corresponding type allows it. 12 | /// 13 | [global::System.AttributeUsage(global::System.AttributeTargets.Parameter, Inherited = false)] 14 | [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] 15 | internal sealed class NotNullWhenAttribute : global::System.Attribute 16 | { 17 | /// 18 | /// Initializes the attribute with the specified return value condition. 19 | /// 20 | /// The return value condition. If the method returns this value, the associated parameter will not be null. 21 | public NotNullWhenAttribute(bool returnValue) 22 | { 23 | ReturnValue = returnValue; 24 | } 25 | 26 | /// Gets the return value condition. 27 | public bool ReturnValue { get; } 28 | } 29 | } -------------------------------------------------------------------------------- /src/TestApps/TestMauiApplication/MainPage.xaml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 10 | 15 | 16 |