diff --git a/.editorconfig b/.editorconfig index 15f564ea..68e3b8be 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,6 +7,7 @@ root = true # Default settings ############################################# [*] +charset = utf-8 end_of_line = lf insert_final_newline = true indent_style = space @@ -188,32 +189,32 @@ dotnet_diagnostic.AvoidAsyncVoid.severity = suggestion # Design dotnet_diagnostic.CA1000.severity = none # Do not declare static members on generic types — common factory pattern dotnet_diagnostic.CA1001.severity = error # Types that own disposable fields should be disposable -dotnet_diagnostic.CA1002.severity = none # Do not expose generic lists — we deliberately expose List; interface-based collections are an older convention we don't follow +dotnet_diagnostic.CA1002.severity = none # Do not expose generic lists — we expose List deliberately dotnet_diagnostic.CA1003.severity = none # Use generic event handler instances — covered by SST2304 -dotnet_diagnostic.CA1005.severity = none # Avoid excessive parameters on generic types — we deliberately expose 3+ type-parameter types (tuple-style handles, raw engine signals); the ergonomic guidance conflicts with that design +dotnet_diagnostic.CA1005.severity = none # Avoid excessive parameters on generic types — 3+ type parameters are deliberate dotnet_diagnostic.CA1008.severity = error # Enums should have zero value -dotnet_diagnostic.CA1010.severity = none # Collections should implement generic interface — we deliberately expose concrete collection types; interface-based collections are an older convention we don't follow +dotnet_diagnostic.CA1010.severity = none # Collections should implement generic interface — concrete types are deliberate dotnet_diagnostic.CA1012.severity = none # Abstract types should not have public constructors — covered by SST1428 -dotnet_diagnostic.CA1014.severity = none # Mark assemblies with CLSCompliantAttribute — we don't ship CLS-compliant assemblies +dotnet_diagnostic.CA1014.severity = none # Mark assemblies CLSCompliant — we don't ship CLS-compliant assemblies dotnet_diagnostic.CA1016.severity = error # Mark assemblies with AssemblyVersionAttribute dotnet_diagnostic.CA1017.severity = none # Mark assemblies with ComVisibleAttribute — we don't ship COM-visible assemblies -dotnet_diagnostic.CA1018.severity = error # Mark attributes with AttributeUsageAttribute -dotnet_diagnostic.CA1019.severity = none # Define accessors for attribute arguments — conflicts with SST2324, which caps an internal attribute's accessor at internal -dotnet_diagnostic.CA1021.severity = none # Avoid out parameters - disabled - needed for the zero-allocation idiom in Try/Find APIs and other performance-critical paths +dotnet_diagnostic.CA1018.severity = none # Mark attributes with AttributeUsageAttribute — covered by SST2336 +dotnet_diagnostic.CA1019.severity = none # Define accessors for attribute arguments — conflicts with SST2324 +dotnet_diagnostic.CA1021.severity = none # Avoid out parameters — needed for zero-allocation Try/Find APIs dotnet_diagnostic.CA1024.severity = error # Use properties where appropriate dotnet_diagnostic.CA1027.severity = error # Mark enums with FlagsAttribute dotnet_diagnostic.CA1028.severity = none # Enum storage should be Int32 — covered by SST2313 dotnet_diagnostic.CA1030.severity = none # Use events where appropriate — we use Rx observables instead of CLR events dotnet_diagnostic.CA1031.severity = none # Do not catch general exception types — required at logging/dispose/IO boundaries dotnet_diagnostic.CA1032.severity = none # Implement standard exception constructors — covered by SST1488 -dotnet_diagnostic.CA1033.severity = none # Interface methods should be callable by child types — explicit interface implementations are a deliberate design choice -dotnet_diagnostic.CA1034.severity = none # Nested types should not be visible — public nested types are sometimes the cleanest API (e.g. interface-scoped exception helpers) -dotnet_diagnostic.CA1036.severity = none # Override methods on comparable types — relational operators rarely meaningful for our types -dotnet_diagnostic.CA1040.severity = none # Avoid empty interfaces — duplicate of SST1437 (canonical); marker interfaces (IActivatableView etc.) are deliberate public API +dotnet_diagnostic.CA1033.severity = none # Interface methods callable by child types — explicit impls are deliberate +dotnet_diagnostic.CA1034.severity = none # Nested types should not be visible — sometimes the cleanest API +dotnet_diagnostic.CA1036.severity = none # Override methods on comparable types — relational operators rarely meaningful +dotnet_diagnostic.CA1040.severity = none # Avoid empty interfaces — covered by SST1437; marker interfaces are deliberate dotnet_diagnostic.CA1041.severity = none # Provide ObsoleteAttribute message — covered by SST2308 dotnet_diagnostic.CA1043.severity = error # Use integral or string argument for indexers dotnet_diagnostic.CA1044.severity = none # Properties should not be write only — covered by SST1421 -dotnet_diagnostic.CA1045.severity = none # Do not pass types by reference — we deliberately use ref-passing static helpers so they carry only the data they touch; data-oriented layout is the default here +dotnet_diagnostic.CA1045.severity = none # Do not pass types by reference — ref-passing helpers are the chosen layout dotnet_diagnostic.CA1046.severity = error # Do not overload operator equals on reference types dotnet_diagnostic.CA1047.severity = none # Do not declare protected member in sealed type — covered by SST1427 dotnet_diagnostic.CA1048.severity = none # Do not declare virtual members in sealed types — covered by SST1491 @@ -228,20 +229,20 @@ dotnet_diagnostic.CA1058.severity = error # Types should not extend certain base dotnet_diagnostic.CA1059.severity = error # Members should not expose certain concrete types dotnet_diagnostic.CA1060.severity = error # Move P/Invokes to NativeMethods class dotnet_diagnostic.CA1061.severity = none # Do not hide base class methods — covered by SST2427 -dotnet_diagnostic.CA1062.severity = none # Validate arguments of public methods - Nullable=enable + we own every consumer, so the compiler already guarantees non-null params +dotnet_diagnostic.CA1062.severity = none # Validate arguments of public methods — nullable annotations already guarantee it dotnet_diagnostic.CA1063.severity = none # Implement IDisposable correctly — covered by SST2300 dotnet_diagnostic.CA1064.severity = error # Exceptions should be public dotnet_diagnostic.CA1065.severity = none # Do not raise exceptions in unexpected locations — covered by SST1485 dotnet_diagnostic.CA1066.severity = error # Implement IEquatable when overriding Equals dotnet_diagnostic.CA1067.severity = error # Override Equals when implementing IEquatable dotnet_diagnostic.CA1068.severity = error # CancellationToken parameters must come last -dotnet_diagnostic.CA1069.severity = error # Enums should not have duplicate values +dotnet_diagnostic.CA1069.severity = none # Enums should not have duplicate values — covered by SST2455 dotnet_diagnostic.CA1070.severity = error # Do not declare event fields as virtual # Globalization dotnet_diagnostic.CA1303.severity = none # Do not pass literals as localized parameters — we don't ship localized resources dotnet_diagnostic.CA1307.severity = none # Covered by PSH1207 (canonical) -dotnet_diagnostic.CA1308.severity = none # Normalize strings to uppercase — ToLowerInvariant is correct for filesystem path / cache key normalization +dotnet_diagnostic.CA1308.severity = none # Normalize strings to uppercase — ToLowerInvariant is right for path/cache keys dotnet_diagnostic.CA1310.severity = none # Covered by PSH1207 (canonical) # Interoperability @@ -252,7 +253,7 @@ dotnet_diagnostic.CA1500.severity = none # Variable names should not match field dotnet_diagnostic.CA1501.severity = none # Covered by SST1446 (canonical) dotnet_diagnostic.CA1502.severity = none # Covered by SST1442 (canonical) dotnet_diagnostic.CA1505.severity = error # Avoid unmaintainable code -dotnet_diagnostic.CA1506.severity = none # Avoid excessive class coupling — adds little signal here, mostly trips on legitimate orchestration code +dotnet_diagnostic.CA1506.severity = none # Avoid excessive class coupling — little signal, trips on orchestration code dotnet_diagnostic.CA1507.severity = none # Use nameof in place of string — covered by SST1463 dotnet_diagnostic.CA1508.severity = error # Avoid dead conditional code dotnet_diagnostic.CA1509.severity = error # Invalid entry in code metrics configuration file @@ -261,23 +262,23 @@ dotnet_diagnostic.CA1511.severity = none # Covered by PSH1409 (canonical) dotnet_diagnostic.CA1512.severity = none # Covered by PSH1409 (canonical) dotnet_diagnostic.CA1513.severity = none # Covered by PSH1409 (canonical) dotnet_diagnostic.CA1514.severity = none # Avoid redundant length argument — covered by PSH1220 -dotnet_diagnostic.CA1515.severity = none # Consider making public types internal — interferes with tests and reflection-discovered types (BenchmarkDotNet, TUnit, etc.) +dotnet_diagnostic.CA1515.severity = none # Consider making public types internal — breaks tests and reflection discovery dotnet_diagnostic.CA1516.severity = error # Use cross-platform intrinsics # Naming dotnet_diagnostic.CA1710.severity = suggestion # Identifiers should have correct suffix -dotnet_diagnostic.CA1724.severity = none # Type Names Should Not Match Namespaces — namespace/type name overlap is intentional API surface +dotnet_diagnostic.CA1724.severity = none # Type names should not match namespaces — the overlap is intentional # Performance dotnet_diagnostic.CA1802.severity = none # Use literals where appropriate — covered by PSH1402 dotnet_diagnostic.CA1805.severity = none # Do not initialize unnecessarily — covered by PSH1403 dotnet_diagnostic.CA1806.severity = error # Do not ignore method results -dotnet_diagnostic.CA1810.severity = none # Initialize reference type static fields inline — explicit static constructors are deliberate in some types +dotnet_diagnostic.CA1810.severity = none # Initialize static fields inline — explicit static constructors are deliberate dotnet_diagnostic.CA1812.severity = error # Avoid uninstantiated internal classes dotnet_diagnostic.CA1813.severity = none # Avoid unsealed attributes — covered by PSH1401 dotnet_diagnostic.CA1814.severity = none # Prefer jagged arrays over multidimensional — covered by PSH1020 dotnet_diagnostic.CA1815.severity = none # Override equals and operator equals on value types — covered by PSH1005 -dotnet_diagnostic.CA1819.severity = none # Properties should not return arrays — incompatible with the RxUI/sqlite-net mapping style we use throughout the codebase +dotnet_diagnostic.CA1819.severity = none # Properties should not return arrays — incompatible with our mapping style dotnet_diagnostic.CA1820.severity = none # Test for empty strings using string length — covered by PSH1204 dotnet_diagnostic.CA1821.severity = none # Remove empty finalizers — covered by PSH1002 dotnet_diagnostic.CA1822.severity = none # Mark members as static — covered by PSH1414 @@ -286,14 +287,14 @@ dotnet_diagnostic.CA1824.severity = error # Mark assemblies with NeutralResource dotnet_diagnostic.CA1825.severity = none # Avoid zero-length array allocations — covered by PSH1001 dotnet_diagnostic.CA1826.severity = none # Use property instead of Linq Enumerable method — covered by PSH1103 dotnet_diagnostic.CA1827.severity = none # Do not use Count/LongCount when Any can be used — covered by PSH1119 -dotnet_diagnostic.CA1828.severity = none # Do not use CountAsync/LongCountAsync when AnyAsync can be used — covered by PSH1126 +dotnet_diagnostic.CA1828.severity = none # Use AnyAsync instead of CountAsync — covered by PSH1126 dotnet_diagnostic.CA1829.severity = none # Use Length/Count property instead of Enumerable.Count — covered by PSH1103 -dotnet_diagnostic.CA1830.severity = none # Prefer strongly-typed Append/Insert overloads on StringBuilder — covered by PSH1202 +dotnet_diagnostic.CA1830.severity = none # Use strongly-typed StringBuilder overloads — covered by PSH1202 dotnet_diagnostic.CA1831.severity = none # Use AsSpan instead of Range-based indexers for string — covered by PSH1212 -dotnet_diagnostic.CA1832.severity = none # Use AsSpan or AsMemory instead of Range-based indexers for getting ReadOnlySpan or ReadOnlyMemory portion of an array — covered by PSH1019 -dotnet_diagnostic.CA1833.severity = none # Use AsSpan or AsMemory instead of Range-based indexers for getting Span or Memory portion of an array — conflicts with PSH1019, which owns the array range-indexer rewrite and refuses it for mutable Span/Memory targets +dotnet_diagnostic.CA1832.severity = none # AsSpan/AsMemory over range indexers for read-only slices — covered by PSH1019 +dotnet_diagnostic.CA1833.severity = none # AsSpan/AsMemory over range indexers for mutable slices — conflicts with PSH1019 dotnet_diagnostic.CA1834.severity = none # Use StringBuilder.Append(char) for single character strings — covered by PSH1202 -dotnet_diagnostic.CA1835.severity = none # Prefer the memory-based overloads of ReadAsync/WriteAsync methods in stream-based classes — covered by PSH1314 +dotnet_diagnostic.CA1835.severity = none # Prefer memory-based ReadAsync/WriteAsync overloads — covered by PSH1314 dotnet_diagnostic.CA1836.severity = none # Prefer IsEmpty over Count when available — covered by PSH1117 dotnet_diagnostic.CA1837.severity = none # Use Environment.ProcessId — covered by PSH1405 dotnet_diagnostic.CA1838.severity = error # Avoid StringBuilder parameters for P/Invokes @@ -321,7 +322,7 @@ dotnet_diagnostic.CA1858.severity = none # Use 'StartsWith' instead of 'IndexOf' dotnet_diagnostic.CA1859.severity = error # Use concrete types when possible for improved performance dotnet_diagnostic.CA1860.severity = none # Avoid using 'Enumerable.Any()' extension method — covered by PSH1103 dotnet_diagnostic.CA1861.severity = none # Avoid constant arrays as arguments — covered by PSH1004 -dotnet_diagnostic.CA1862.severity = none # Use the 'StringComparison' overloads for case-insensitive comparisons — covered by PSH1200 +dotnet_diagnostic.CA1862.severity = none # StringComparison overloads for case-insensitive compares — covered by PSH1200 dotnet_diagnostic.CA1863.severity = none # Use 'CompositeFormat' — covered by PSH1223 dotnet_diagnostic.CA1864.severity = none # Prefer the 'IDictionary.TryAdd' method — covered by PSH1115 dotnet_diagnostic.CA1865.severity = none # Covered by PSH1201 (canonical) @@ -331,8 +332,8 @@ dotnet_diagnostic.CA1868.severity = none # Unnecessary call to 'Contains' for se dotnet_diagnostic.CA1869.severity = none # Cache and reuse 'JsonSerializerOptions' instances — covered by PSH1416 dotnet_diagnostic.CA1870.severity = none # Use a cached 'SearchValues' instance — covered by PSH1213 dotnet_diagnostic.CA1871.severity = error # Do not pass a nullable struct to 'ArgumentNullException.ThrowIfNull' -dotnet_diagnostic.CA1872.severity = none # Prefer 'Convert.ToHexString' and 'Convert.ToHexStringLower' over call chains based on 'BitConverter.ToString' — covered by PSH1224 -dotnet_diagnostic.CA1873.severity = none # Avoid potentially expensive evaluation of arguments to 'Debug.Assert' — covered by PSH1417 +dotnet_diagnostic.CA1872.severity = none # Convert.ToHexString over BitConverter.ToString chains — covered by PSH1224 +dotnet_diagnostic.CA1873.severity = none # Avoid expensive Debug.Assert arguments — covered by PSH1417 dotnet_diagnostic.CA1874.severity = none # Use 'Regex.IsMatch' — covered by PSH1406 dotnet_diagnostic.CA1875.severity = none # Use 'Regex.Count' — covered by PSH1406 dotnet_diagnostic.CA1877.severity = none # Use 'Encoding.GetString' instead of 'Encoding.GetChars' — covered by PSH1225 @@ -340,7 +341,7 @@ dotnet_diagnostic.CA1877.severity = none # Use 'Encoding.GetString' instead of ' # Reliability dotnet_diagnostic.CA2000.severity = suggestion # Dispose objects before losing scope dotnet_diagnostic.CA2002.severity = error # Do not lock on objects with weak identity -dotnet_diagnostic.CA2007.severity = none # Do not directly await a Task — Rx and library callers drive synchronization context themselves +dotnet_diagnostic.CA2007.severity = none # Do not directly await a Task — callers drive the synchronization context dotnet_diagnostic.CA2008.severity = error # Do not create tasks without passing a TaskScheduler dotnet_diagnostic.CA2009.severity = error # Do not call ToImmutableCollection on an ImmutableCollection value dotnet_diagnostic.CA2011.severity = error # Do not assign property within its setter @@ -350,7 +351,7 @@ dotnet_diagnostic.CA2014.severity = error # Do not use stackalloc in loops dotnet_diagnostic.CA2015.severity = error # Do not define finalizers for types derived from MemoryManager dotnet_diagnostic.CA2016.severity = error # Forward the CancellationToken parameter to methods that take one dotnet_diagnostic.CA2017.severity = error # Parameter count mismatch -dotnet_diagnostic.CA2018.severity = error # The 'count' argument to 'Buffer.BlockCopy' should specify the number of bytes to copy +dotnet_diagnostic.CA2018.severity = error # The Buffer.BlockCopy 'count' argument should be a byte count dotnet_diagnostic.CA2019.severity = error # Improper 'ThreadStatic' field initialization dotnet_diagnostic.CA2020.severity = error # Prevent behavioral change caused by built-in operators of IntPtr/UIntPtr dotnet_diagnostic.CA2021.severity = error # Don't call Enumerable.Cast or Enumerable.OfType with incompatible types @@ -358,28 +359,28 @@ dotnet_diagnostic.CA2022.severity = error # Avoid inexact read with 'Stream.Read dotnet_diagnostic.CA2023.severity = error # Invalid braces in message template dotnet_diagnostic.CA2024.severity = error # Do not use 'StreamReader.EndOfStream' in async methods dotnet_diagnostic.CA2025.severity = error # Do not pass 'IDisposable' instances into unawaited tasks -dotnet_diagnostic.CA2026.severity = error # Do not use methods or types annotated with [RequiresDynamicCode] in code that uses [RequiresDynamicCode] +dotnet_diagnostic.CA2026.severity = error # A [RequiresDynamicCode] member is used from code that also requires it # Usage -dotnet_diagnostic.CA1801.severity = error # Review unused parameters +dotnet_diagnostic.CA1801.severity = none # Review unused parameters — covered by SST1461 dotnet_code_quality.CA1801.api_surface = private, internal # only flag non-public APIs so we don't break public signatures dotnet_diagnostic.CA1816.severity = error # Call GC.SuppressFinalize correctly dotnet_diagnostic.CA2200.severity = none # Rethrow to preserve stack details — covered by SST1430 dotnet_diagnostic.CA2201.severity = error # Do not raise reserved exception types dotnet_diagnostic.CA2207.severity = error # Initialize value type static fields inline -dotnet_diagnostic.CA2208.severity = none # Instantiate argument exceptions correctly — too sensitive: flags valid context-forwarding nameof(arg.Property) patterns +dotnet_diagnostic.CA2208.severity = none # Instantiate argument exceptions correctly — flags valid nameof forwarding dotnet_diagnostic.CA2211.severity = none # Non-constant fields should not be visible — covered by SST1499 dotnet_diagnostic.CA2213.severity = error # Disposable fields should be disposed dotnet_diagnostic.CA2214.severity = none # Do not call overridable methods in constructors — covered by SST1483 dotnet_diagnostic.CA2215.severity = error # Dispose methods should call base class dispose -dotnet_diagnostic.CA2216.severity = none # Disposable types should declare finalizer — conflicts with SST2317, which owns the owned-native-handle shape and prescribes a SafeHandle instead of a finalizer +dotnet_diagnostic.CA2216.severity = none # Disposable types should declare finalizer — conflicts with SST2317 (SafeHandle) dotnet_diagnostic.CA2217.severity = none # Do not mark enums with FlagsAttribute — covered by SST2303 dotnet_diagnostic.CA2218.severity = error # Override GetHashCode on overriding Equals dotnet_diagnostic.CA2219.severity = error # Do not raise exceptions in finally clauses dotnet_diagnostic.CA2224.severity = none # Override Equals on overloading operator equals — covered by SST2302 dotnet_diagnostic.CA2225.severity = error # Operator overloads have named alternates dotnet_diagnostic.CA2226.severity = error # Operators should have symmetrical overloads -dotnet_diagnostic.CA2227.severity = none # Collection properties should be read only — settable collection properties are common in our DTOs and config types +dotnet_diagnostic.CA2227.severity = none # Collection properties should be read only — settable ones are common in our DTOs dotnet_diagnostic.CA2231.severity = error # Overload operator equals on overriding ValueType.Equals dotnet_diagnostic.CA2234.severity = error # Pass System.Uri objects instead of strings dotnet_diagnostic.CA2241.severity = error # Provide correct arguments to formatting methods @@ -388,7 +389,7 @@ dotnet_diagnostic.CA2243.severity = error # Attribute string literals should par dotnet_diagnostic.CA2244.severity = error # Do not duplicate indexed element initializations dotnet_diagnostic.CA2245.severity = none # Do not assign a property to itself — covered by SST1189 dotnet_diagnostic.CA2246.severity = error # Do not assign a symbol and its member in the same statement -dotnet_diagnostic.CA2247.severity = error # Argument passed to TaskCompletionSource constructor should be TaskCreationOptions enum +dotnet_diagnostic.CA2247.severity = error # TaskCompletionSource argument should be a TaskCreationOptions value dotnet_diagnostic.CA2248.severity = error # Provide correct enum argument to Enum.HasFlag dotnet_diagnostic.CA2249.severity = error # Use String.Contains instead of String.IndexOf for substring checks dotnet_diagnostic.CA2250.severity = error # Use ThrowIfCancellationRequested @@ -397,9 +398,9 @@ dotnet_diagnostic.CA2252.severity = error # Opt in to preview features before us dotnet_diagnostic.CA2253.severity = error # Named placeholders should not be numeric values dotnet_diagnostic.CA2254.severity = error # Template should be a static expression dotnet_diagnostic.CA2255.severity = error # The 'ModuleInitializer' attribute should not be used in libraries -dotnet_diagnostic.CA2256.severity = error # All members declared in parent interfaces must have an implementation in a 'DynamicInterfaceCastableImplementation' interface -dotnet_diagnostic.CA2257.severity = error # Members defined in a type with the 'DynamicInterfaceCastableImplementationAttribute' should be 'static' -dotnet_diagnostic.CA2258.severity = error # Providing a 'DynamicInterfaceCastableImplementation' interface in Visual Basic is unsupported +dotnet_diagnostic.CA2256.severity = error # A DynamicInterfaceCastable type must implement all parent interface members +dotnet_diagnostic.CA2257.severity = error # Members of a DynamicInterfaceCastableImplementation type should be static +dotnet_diagnostic.CA2258.severity = error # DynamicInterfaceCastableImplementation is unsupported in Visual Basic dotnet_diagnostic.CA2259.severity = error # 'ThreadStatic' only affects static fields dotnet_diagnostic.CA2260.severity = error # Implement generic math interfaces correctly dotnet_diagnostic.CA2261.severity = error # Do not use 'ConfigureAwaitOptions.SuppressThrowing' with 'Task' @@ -409,9 +410,8 @@ dotnet_diagnostic.CA2264.severity = error # Do not pass a non-nullable value to dotnet_diagnostic.CA2265.severity = error # Do not compare Span to 'null' or 'default' dotnet_diagnostic.CA2266.severity = error # Do not consume the result of 'Span.Enumerator.MoveNext()' more than once dotnet_diagnostic.CA2267.severity = error # Member should not be marked with 'StaticAttribute' -dotnet_diagnostic.CA2268.severity = error # Use 'string.Equals(string, string, StringComparison)' instead of the implicit ordinal overload -# Skipped (deprecated ISerializable formatter): CA2229 Implement serialization constructors, -# CA2235 Mark all non-serializable fields, CA2237 Mark ISerializable types with SerializableAttribute. +dotnet_diagnostic.CA2268.severity = error # Use string.Equals with StringComparison, not the implicit ordinal overload +# Skipped, deprecated ISerializable formatter: CA2229, CA2235, CA2237. # Security @@ -546,18 +546,18 @@ dotnet_diagnostic.SYSLIB0004.severity = error # Constrained Execution Region (CE dotnet_diagnostic.SYSLIB0005.severity = error # Global Assembly Cache is not supported dotnet_diagnostic.SYSLIB0006.severity = error # Thread.Abort is not supported and throws PlatformNotSupportedException dotnet_diagnostic.SYSLIB0007.severity = error # The default implementation of this cryptography algorithm is not supported -dotnet_diagnostic.SYSLIB0008.severity = error # The CreatePdbGenerator API is not supported and throws PlatformNotSupportedException -dotnet_diagnostic.SYSLIB0009.severity = error # The AuthenticationManager Authenticate and PreAuthenticate methods are not supported +dotnet_diagnostic.SYSLIB0008.severity = error # CreatePdbGenerator is not supported and throws +dotnet_diagnostic.SYSLIB0009.severity = error # AuthenticationManager Authenticate/PreAuthenticate are not supported dotnet_diagnostic.SYSLIB0010.severity = error # This Remoting API is not supported and throws PlatformNotSupportedException dotnet_diagnostic.SYSLIB0011.severity = error # BinaryFormatter serialization is obsolete dotnet_diagnostic.SYSLIB0012.severity = error # Assembly.CodeBase and Assembly.EscapedCodeBase are obsolete dotnet_diagnostic.SYSLIB0013.severity = error # Uri.EscapeUriString can corrupt the Uri string -dotnet_diagnostic.SYSLIB0014.severity = error # WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete — use HttpClient +dotnet_diagnostic.SYSLIB0014.severity = error # WebRequest, ServicePoint and WebClient are obsolete — use HttpClient dotnet_diagnostic.SYSLIB0015.severity = error # DisablePrivateReflectionAttribute is not honored dotnet_diagnostic.SYSLIB0016.severity = error # Use Marshal.GetExceptionPointers instead dotnet_diagnostic.SYSLIB0017.severity = error # Strong name signing is not supported on .NET Core dotnet_diagnostic.SYSLIB0018.severity = error # ReflectionOnly loading is not supported -dotnet_diagnostic.SYSLIB0019.severity = error # RuntimeEnvironment members SystemConfigurationFile, GetSystemVersion, and FromGlobalAccessCache are not supported +dotnet_diagnostic.SYSLIB0019.severity = error # RuntimeEnvironment configuration and GAC members are not supported dotnet_diagnostic.SYSLIB0020.severity = error # JsonSerializerOptions.IgnoreNullValues is obsolete — use DefaultIgnoreCondition dotnet_diagnostic.SYSLIB0021.severity = error # Derived cryptographic types are obsolete — use the Create factory methods dotnet_diagnostic.SYSLIB0022.severity = error # Rijndael types are obsolete — use Aes @@ -566,31 +566,31 @@ dotnet_diagnostic.SYSLIB0024.severity = error # Creating and unloading AppDomain dotnet_diagnostic.SYSLIB0025.severity = error # SuppressIldasmAttribute has no effect in .NET 6.0+ dotnet_diagnostic.SYSLIB0026.severity = error # X509Certificate and X509Certificate2 parameterless constructors are obsolete dotnet_diagnostic.SYSLIB0027.severity = error # PublicKey.Key is obsolete — use the appropriate method to get the public key -dotnet_diagnostic.SYSLIB0028.severity = error # X509Certificate2.PrivateKey is obsolete — use the appropriate method to get the private key +dotnet_diagnostic.SYSLIB0028.severity = error # X509Certificate2.PrivateKey is obsolete dotnet_diagnostic.SYSLIB0029.severity = error # ProduceLegacyHmacValues is obsolete dotnet_diagnostic.SYSLIB0030.severity = error # HMACSHA1 always uses the algorithm implementation provided by the platform dotnet_diagnostic.SYSLIB0031.severity = error # EncodingProvider.GetEncoding(int, EncoderFallback, DecoderFallback) is obsolete dotnet_diagnostic.SYSLIB0032.severity = error # Recovery from corrupted process state exceptions is not supported dotnet_diagnostic.SYSLIB0033.severity = error # Rfc2898DeriveBytes.CryptDeriveKey is obsolete -dotnet_diagnostic.SYSLIB0034.severity = error # CmsSigner has been deprecated — use a constructor that accepts a SubjectIdentifierType +dotnet_diagnostic.SYSLIB0034.severity = error # CmsSigner is deprecated — pass a SubjectIdentifierType dotnet_diagnostic.SYSLIB0035.severity = error # ComputeCounterSignature without specifying a CmsSigner is obsolete -dotnet_diagnostic.SYSLIB0036.severity = error # Regex.CompileToAssembly is obsolete and not supported — use the RegexGenerator source generator -dotnet_diagnostic.SYSLIB0037.severity = error # AssemblyName members HashAlgorithm, ProcessorArchitecture, and VersionCompatibility are obsolete +dotnet_diagnostic.SYSLIB0036.severity = error # Regex.CompileToAssembly is obsolete — use the source generator +dotnet_diagnostic.SYSLIB0037.severity = error # AssemblyName HashAlgorithm and ProcessorArchitecture members are obsolete dotnet_diagnostic.SYSLIB0038.severity = error # SerializationFormat.Binary is obsolete dotnet_diagnostic.SYSLIB0039.severity = error # TLS versions 1.0 and 1.1 have known vulnerabilities and are not recommended dotnet_diagnostic.SYSLIB0040.severity = error # EncryptionPolicy.NoEncryption and AllowEncryption significantly reduce security -dotnet_diagnostic.SYSLIB0041.severity = error # The default iteration count for Rfc2898DeriveBytes parameters is outdated and insecure +dotnet_diagnostic.SYSLIB0041.severity = error # The default Rfc2898DeriveBytes iteration count is insecure dotnet_diagnostic.SYSLIB0042.severity = error # ToXmlString and FromXmlString have no implementation for ECC types -dotnet_diagnostic.SYSLIB0043.severity = error # ECDiffieHellmanPublicKey.ToByteArray() and the associated constructor do not have a consistent and interoperable implementation +dotnet_diagnostic.SYSLIB0043.severity = error # ECDiffieHellmanPublicKey.ToByteArray is not interoperable dotnet_diagnostic.SYSLIB0044.severity = error # AssemblyName.CodeBase and AssemblyName.EscapedCodeBase are obsolete dotnet_diagnostic.SYSLIB0045.severity = error # Cryptographic factory methods accepting an algorithm name are obsolete -dotnet_diagnostic.SYSLIB0046.severity = error # ControlledExecution.Run may corrupt the process and should not be used in production code +dotnet_diagnostic.SYSLIB0046.severity = error # ControlledExecution.Run may corrupt the process dotnet_diagnostic.SYSLIB0047.severity = error # XmlSecureResolver is obsolete -dotnet_diagnostic.SYSLIB0048.severity = error # RSA.EncryptValue and RSA.DecryptValue are not supported and throw NotSupportedException +dotnet_diagnostic.SYSLIB0048.severity = error # RSA.EncryptValue and RSA.DecryptValue are not supported dotnet_diagnostic.SYSLIB0049.severity = error # JsonSerializerOptions.AddContext is obsolete -dotnet_diagnostic.SYSLIB0050.severity = error # Formatter-based serialization (ISerializable, FormatterServices, etc.) is obsolete -dotnet_diagnostic.SYSLIB0051.severity = error # The Exception API ISerializable / GetObjectData formatter-based serialization is obsolete -dotnet_diagnostic.SYSLIB0052.severity = error # Members for assigning to AssemblyName.CodeBase or AssemblyName.EscapedCodeBase are obsolete +dotnet_diagnostic.SYSLIB0050.severity = error # Formatter-based serialization is obsolete +dotnet_diagnostic.SYSLIB0051.severity = error # Exception ISerializable and GetObjectData serialization is obsolete +dotnet_diagnostic.SYSLIB0052.severity = error # Assigning AssemblyName.CodeBase is obsolete dotnet_diagnostic.SYSLIB0053.severity = error # AesGcm should indicate the required tag size for encryption and decryption dotnet_diagnostic.SYSLIB0054.severity = error # Strong name signing is not supported and throws PlatformNotSupportedException dotnet_diagnostic.SYSLIB0055.severity = error # 'Memory.Pin' may be incorrectly used with structures @@ -598,7 +598,7 @@ dotnet_diagnostic.SYSLIB0056.severity = error # LoadFromHash and related members dotnet_diagnostic.SYSLIB0057.severity = error # Use X509CertificateLoader instead to load certificates dotnet_diagnostic.SYSLIB0058.severity = error # KeyExchangeAlgorithm and KeyExchangeStrength are obsolete on SslStream dotnet_diagnostic.SYSLIB0059.severity = error # SystemEvents.EventsThreadShutdown event is obsolete -dotnet_diagnostic.SYSLIB0060.severity = error # Constructors of DirectoryServices.ActiveDirectory.ConfigurationContext are obsolete +dotnet_diagnostic.SYSLIB0060.severity = error # ActiveDirectory ConfigurationContext constructors are obsolete dotnet_diagnostic.SYSLIB0061.severity = error # CryptographyConfig.AddOID and AddAlgorithm methods are obsolete # Source generators @@ -617,7 +617,7 @@ dotnet_diagnostic.SYSLIB1011.severity = error # Logging methods cannot be generi dotnet_diagnostic.SYSLIB1012.severity = error # Logging methods must not have a body dotnet_diagnostic.SYSLIB1013.severity = error # Missing logger argument to logging method dotnet_diagnostic.SYSLIB1015.severity = error # Argument is not referenced from the logging message -dotnet_diagnostic.SYSLIB1016.severity = error # Logging methods cannot have a parameter named the same as one of the template parameters +dotnet_diagnostic.SYSLIB1016.severity = error # A logging method parameter shadows a template parameter name dotnet_diagnostic.SYSLIB1017.severity = error # Logging methods cannot have more than one parameter of type LogLevel dotnet_diagnostic.SYSLIB1018.severity = error # Logging method parameter doesn't appear in template dotnet_diagnostic.SYSLIB1019.severity = error # Couldn't find a field of type ILogger @@ -658,7 +658,7 @@ dotnet_diagnostic.SYSLIB1050.severity = error # Method should be marked 'Library dotnet_diagnostic.SYSLIB1051.severity = error # Specified type is not supported by source-generated P/Invokes dotnet_diagnostic.SYSLIB1052.severity = error # Specified configuration is not supported by source-generated P/Invokes dotnet_diagnostic.SYSLIB1053.severity = error # 'LibraryImportAttribute' requires unsafe code -dotnet_diagnostic.SYSLIB1054.severity = error # Use 'LibraryImportAttribute' instead of 'DllImportAttribute' to generate P/Invoke marshalling code at compile time +dotnet_diagnostic.SYSLIB1054.severity = error # Use LibraryImport over DllImport for compile-time marshalling dotnet_diagnostic.SYSLIB1055.severity = error # Invalid 'CustomMarshallerAttribute' usage dotnet_diagnostic.SYSLIB1056.severity = error # Specified marshaller type is invalid dotnet_diagnostic.SYSLIB1057.severity = error # Marshaller type does not have the required shape @@ -678,7 +678,7 @@ dotnet_diagnostic.SYSLIB1093.severity = error # Method on 'GeneratedComInterface dotnet_diagnostic.SYSLIB1094.severity = error # Method on 'GeneratedComInterface' has unsupported parameter dotnet_diagnostic.SYSLIB1095.severity = error # Type implements 'GeneratedComInterface' but is not partial dotnet_diagnostic.SYSLIB1096.severity = error # 'GeneratedComClassAttribute' must be applied to a partial type -dotnet_diagnostic.SYSLIB1097.severity = error # 'GeneratedComClassAttribute' type must implement at least one 'GeneratedComInterface' +dotnet_diagnostic.SYSLIB1097.severity = error # A GeneratedComClass type must implement a GeneratedComInterface dotnet_diagnostic.SYSLIB1098.severity = error # 'GeneratedComInterface' interface inheritance not supported # Configuration binding source generator @@ -692,11 +692,7 @@ dotnet_diagnostic.SYSLIB1104.severity = error # Configuration binding source gen # Microsoft .NET Code Style Analyzers (IDE) ################### # Language rules -# EnforceCodeStyleInBuild=true (set in Directory.Build.props) promotes these -# IDE rules into `dotnet build` so they fire at compile time, not just in the -# IDE. We enable the ones that are unambiguous wins and skip the rules that -# conflict with an existing convention (SA1101, SA1200, SA1206, SA1400, SA1633, -# etc.) so we don't double-report. +# EnforceCodeStyleInBuild promotes these into the build; double-reporting rules are off. # Bug catchers — always error. dotnet_diagnostic.IDE0035.severity = none # Remove unreachable code — covered by SST1453 @@ -707,7 +703,7 @@ dotnet_diagnostic.IDE0052.severity = none # Remove unread private member — cov dotnet_diagnostic.IDE0002.severity = none # Simplify member access — covered by SST1117 dotnet_diagnostic.IDE0004.severity = none # Remove unnecessary cast — covered by SST1175 dotnet_diagnostic.IDE0016.severity = none # Use throw expression — covered by SST2207 -dotnet_diagnostic.IDE0019.severity = none # Use pattern matching to avoid 'as' followed by a 'null' check — covered by SST2005/SST2274 +dotnet_diagnostic.IDE0019.severity = none # Use pattern matching over 'as' plus null check — covered by SST2005/SST2274 dotnet_diagnostic.IDE0028.severity = none # Use collection initializers — covered by SST1194 dotnet_diagnostic.IDE0031.severity = none # Use null propagation — covered by SST1196 dotnet_diagnostic.IDE0038.severity = none # Use pattern matching ('is' check without a cast) — covered by SST2007 @@ -715,10 +711,10 @@ dotnet_diagnostic.IDE0041.severity = none # Use 'is null' check — covered by S dotnet_diagnostic.IDE0042.severity = none # Deconstruct variable declaration — covered by SST2214 dotnet_diagnostic.IDE0044.severity = none # Add readonly modifier — covered by SST1424 dotnet_diagnostic.IDE0047.severity = none # Remove unnecessary parentheses — covered by SST1459 -dotnet_diagnostic.IDE0049.severity = none # Use language keywords instead of framework type names for type references — covered by SST1121 +dotnet_diagnostic.IDE0049.severity = none # Use language keywords over framework type names — covered by SST1121 dotnet_diagnostic.IDE0057.severity = none # Use range operator — covered by SST2204 dotnet_diagnostic.IDE0059.severity = none # Remove unnecessary value assignment — covered by SST2222 -dotnet_diagnostic.IDE0064.severity = none # Make struct fields writable — flag readonly-but-mutable struct fields where intent diverges from declaration +dotnet_diagnostic.IDE0064.severity = none # Make struct fields writable — flags readonly-but-mutable struct fields dotnet_diagnostic.IDE0066.severity = none # Use switch expression — covered by SST2201 dotnet_diagnostic.IDE0075.severity = none # Simplify conditional expression — covered by SST1182 dotnet_diagnostic.IDE0078.severity = none # Use pattern matching — covered by SST2006/SST2231 @@ -741,7 +737,7 @@ dotnet_diagnostic.IDE0026.severity = none # Use expression body for indexers — dotnet_diagnostic.IDE0048.severity = none # Add parentheses for clarity — preference not enforced dotnet_diagnostic.IDE0055.severity = none # Formatting — StyleCop SA rules own formatting dotnet_diagnostic.IDE0058.severity = none # Remove unnecessary expression value — covered by SST2221 -dotnet_diagnostic.IDE0060.severity = none # Remove unused parameter — CA1801 handles (with api_surface config) +dotnet_diagnostic.IDE0060.severity = none # Remove unused parameter — covered by SST1461 dotnet_diagnostic.IDE0061.severity = none # Use expression body for local function — covered by SST2281 dotnet_diagnostic.IDE0079.severity = none # Remove unnecessary suppression — can misfire on multi-TFM suppressions dotnet_diagnostic.IDE0130.severity = none # Namespace does not match folder structure — we don't enforce strict mirror @@ -754,7 +750,7 @@ dotnet_diagnostic.IDE0320.severity = none # Make anonymous function static — c dotnet_diagnostic.IDE0050.severity = none # Convert anonymous type to tuple — covered by SST2224 dotnet_diagnostic.IDE0310.severity = none # Convert lambda expression to method group — handled by RCS1207 dotnet_diagnostic.IDE0360.severity = none # Simplify property accessor — covered by SST2219 -dotnet_diagnostic.IDE0370.severity = none # Remove unnecessary suppression (null-forgiving operator) — disabled for the same reason as RCS1249: multi-TFM nullability annotations can differ per platform +dotnet_diagnostic.IDE0370.severity = none # Remove unnecessary null-forgiving suppression — multi-TFM nullability differs # Language and unnecessary code rules. dotnet_diagnostic.IDE0001.severity = none # Simplify name @@ -821,12 +817,7 @@ dotnet_diagnostic.IDE0380.severity = none # Remove unnecessary unsafe modifier dotnet_diagnostic.IDE1005.severity = none # Use conditional delegate call # Naming and miscellaneous -# Naming conventions — SA1300 family already enforces PascalCase / interface -# prefix / field casing (with our _underscore convention on SA1306/1309/1311 -# deliberately disabled). Leaving IDE1006 off because configuring -# `dotnet_naming_rule.*` would duplicate what SA already enforces and could -# conflict with the _underscore convention. -dotnet_diagnostic.IDE1006.severity = none # Naming rule violation — SA1300 family handles naming +dotnet_diagnostic.IDE1006.severity = none # Naming rule violation — the SA1300 family owns casing and prefixes dotnet_diagnostic.IDE3000.severity = none # Disabled per project convention — not enforced ################### @@ -834,11 +825,11 @@ dotnet_diagnostic.IDE3000.severity = none # Disabled per project convention — ################### # Code simplification dotnet_diagnostic.RCS1001.severity = none # Add braces (when expression spans over multiple lines) — covered by SST1519 -dotnet_diagnostic.RCS1003.severity = none # Add braces to if-else (when expression spans over multiple lines) — covered by SST1519 -dotnet_diagnostic.RCS1005.severity = error # Simplify nested using statement +dotnet_diagnostic.RCS1003.severity = none # Add braces to if-else spanning multiple lines — covered by SST1519 +dotnet_diagnostic.RCS1005.severity = none # Simplify nested using — the stacked form trips SST1503; SST2236 owns this dotnet_diagnostic.RCS1006.severity = none # Merge 'else' with nested 'if' — covered by SST1465 dotnet_diagnostic.RCS1007.severity = error # Add braces -dotnet_diagnostic.RCS1031.severity = none # Remove unnecessary braces in switch section -- we don't mind braces in switch statements +dotnet_diagnostic.RCS1031.severity = none # Remove unnecessary braces in switch section — braces there are deliberate dotnet_diagnostic.RCS1032.severity = error # Remove redundant parentheses dotnet_diagnostic.RCS1033.severity = none # Remove redundant boolean literal — covered by SST1143 dotnet_diagnostic.RCS1039.severity = none # Remove argument list from attribute — covered by SST1411 @@ -855,27 +846,27 @@ dotnet_diagnostic.RCS1071.severity = none # Remove redundant base constructor ca dotnet_diagnostic.RCS1072.severity = none # Remove empty namespace declaration — covered by SST1435 dotnet_diagnostic.RCS1073.severity = none # Convert 'if' to 'return' statement — covered by SST1197 dotnet_diagnostic.RCS1074.severity = none # Remove redundant constructor — covered by SST1433 -dotnet_diagnostic.RCS1078.severity = none # Use "" or 'string.Empty' — conflicts with SST1122, which owns the string.Empty direction +dotnet_diagnostic.RCS1078.severity = none # Use "" or string.Empty — conflicts with SST1122, which owns the direction dotnet_diagnostic.RCS1084.severity = none # Use coalesce expression instead of conditional expression — covered by SST1195 dotnet_diagnostic.RCS1085.severity = none # Use auto-implemented property — covered by SST1420 -dotnet_diagnostic.RCS1089.severity = error # Use --/++ operator instead of assignment -dotnet_diagnostic.RCS1097.severity = error # Remove redundant 'ToString' call +dotnet_diagnostic.RCS1089.severity = none # Use --/++ operator instead of assignment — covered by SST2284 +dotnet_diagnostic.RCS1097.severity = none # Remove redundant 'ToString' call — covered by SST2286 dotnet_diagnostic.RCS1103.severity = error # Convert 'if' to assignment -dotnet_diagnostic.RCS1104.severity = none # Simplify conditional expression — covered by SST1182 +dotnet_diagnostic.RCS1104.severity = none # Simplify conditional expression — covered by SST1182/SST2288 dotnet_diagnostic.RCS1105.severity = error # Unnecessary interpolation dotnet_diagnostic.RCS1106.severity = none # Remove empty destructor — covered by PSH1002 dotnet_diagnostic.RCS1107.severity = none # Remove redundant 'ToCharArray' call — covered by PSH1217 dotnet_diagnostic.RCS1114.severity = error # Remove redundant delegate creation -dotnet_diagnostic.RCS1124.severity = error # Inline local variable +dotnet_diagnostic.RCS1124.severity = none # Inline local variable — duplicates SST2266 and cannot hold with SST2275 dotnet_diagnostic.RCS1126.severity = error # Add braces to if-else dotnet_diagnostic.RCS1128.severity = error # Use coalesce expression dotnet_diagnostic.RCS1129.severity = none # Remove redundant field initialization — covered by SST1176 dotnet_diagnostic.RCS1132.severity = none # Remove redundant overriding member — covered by SST1181 dotnet_diagnostic.RCS1133.severity = error # Remove redundant Dispose/Close call dotnet_diagnostic.RCS1134.severity = none # Remove redundant statement — covered by SST1174 -dotnet_diagnostic.RCS1143.severity = error # Simplify coalesce expression +dotnet_diagnostic.RCS1143.severity = none # Simplify coalesce expression — covered by SST2453 dotnet_diagnostic.RCS1145.severity = error # Remove redundant 'as' operator -dotnet_diagnostic.RCS1146.severity = error # Use conditional access +dotnet_diagnostic.RCS1146.severity = none # Use conditional access — covered by SST2285 dotnet_diagnostic.RCS1151.severity = none # Remove redundant cast — covered by SST1175 dotnet_diagnostic.RCS1171.severity = error # Simplify lazy initialization dotnet_diagnostic.RCS1173.severity = error # Use coalesce expression instead of 'if' @@ -886,37 +877,37 @@ dotnet_diagnostic.RCS1188.severity = none # Remove redundant auto-property initi dotnet_diagnostic.RCS1192.severity = none # Unnecessary usage of verbatim string literal — covered by SST1184 dotnet_diagnostic.RCS1199.severity = error # Unnecessary null check dotnet_diagnostic.RCS1206.severity = error # Use conditional access instead of conditional expression -dotnet_diagnostic.RCS1207.severity = none # Use anonymous function or method group — conflicts with SST2239, which owns the method-group direction +dotnet_diagnostic.RCS1207.severity = none # Use anonymous function or method group — conflicts with SST2239 dotnet_diagnostic.RCS1211.severity = none # Remove unnecessary 'else' — covered by SST1464 dotnet_diagnostic.RCS1212.severity = error # Remove redundant assignment dotnet_diagnostic.RCS1214.severity = none # Unnecessary interpolated string — covered by SST1183 -dotnet_diagnostic.RCS1216.severity = error # Unnecessary unsafe context -dotnet_diagnostic.RCS1217.severity = none # Convert interpolated string to concatenation — reverses SST2249, which owns the concatenation-to-interpolation direction +dotnet_diagnostic.RCS1216.severity = none # Unnecessary unsafe context — covered by SST1455 +dotnet_diagnostic.RCS1217.severity = none # Convert interpolated string to concatenation — reverses SST2249 dotnet_diagnostic.RCS1218.severity = error # Simplify code branching -dotnet_diagnostic.RCS1220.severity = none # Use pattern matching instead of combination of 'is' and cast — covered by SST2007 -dotnet_diagnostic.RCS1221.severity = error # Use pattern matching instead of combination of 'as' and null check +dotnet_diagnostic.RCS1220.severity = none # Use pattern matching over 'is' plus cast — covered by SST2007 +dotnet_diagnostic.RCS1221.severity = none # Use pattern matching instead of combination of 'as' and null check — covered by SST2274 dotnet_diagnostic.RCS1238.severity = none # Avoid nested ?: operators — covered by SST1147 dotnet_diagnostic.RCS1244.severity = none # Simplify 'default' expression — covered by SST1188 -dotnet_diagnostic.RCS1249.severity = none # Unnecessary null-forgiving operator — disabled because multi-TFM nullability annotations can differ per platform, leading to false positives +dotnet_diagnostic.RCS1249.severity = none # Unnecessary null-forgiving operator — multi-TFM nullability differs dotnet_diagnostic.RCS1251.severity = error # Remove unnecessary braces from record declaration dotnet_diagnostic.RCS1259.severity = error # Remove empty syntax (replaces RCS1066) dotnet_diagnostic.RCS1262.severity = error # Unnecessary raw string literal dotnet_diagnostic.RCS1265.severity = none # Remove redundant catch block — covered by SST1470 -dotnet_diagnostic.RCS1268.severity = error # Simplify numeric comparison +dotnet_diagnostic.RCS1268.severity = none # Simplify numeric comparison — covered by SST2447 # Code quality dotnet_diagnostic.RCS1013.severity = none # Use predefined type — covered by SST1121 dotnet_diagnostic.RCS1014.severity = error # Use explicitly/implicitly typed array dotnet_diagnostic.RCS1015.severity = error # Use nameof operator -dotnet_diagnostic.RCS1016.severity = none # Use block body or expression body — conflicts with SST2219, which owns the expression-bodied accessor direction +dotnet_diagnostic.RCS1016.severity = none # Use block body or expression body — conflicts with SST2219 dotnet_diagnostic.RCS1020.severity = none # Covered by SST2234 (canonical) dotnet_diagnostic.RCS1021.severity = error # Convert lambda expression body to expression body dotnet_diagnostic.RCS1044.severity = none # Remove original exception from throw statement — covered by SST1430 -dotnet_diagnostic.RCS1046.severity = none # Asynchronous method name should end with 'Async' — TUnit test method naming convention doesn't follow the Async suffix — covered by SST1317 +dotnet_diagnostic.RCS1046.severity = none # Async method name should end with 'Async' — covered by SST1317 dotnet_diagnostic.RCS1047.severity = error # Non-asynchronous method name should not end with 'Async' dotnet_diagnostic.RCS1048.severity = none # Use lambda expression instead of anonymous method — covered by SST1130 dotnet_diagnostic.RCS1050.severity = error # Include/omit parentheses when creating new object -dotnet_diagnostic.RCS1051.severity = none # Add/remove parentheses from condition in conditional operator — conflicts with SST1459, which owns the non-grouping-parenthesis removal direction +dotnet_diagnostic.RCS1051.severity = none # Parentheses around a conditional's condition — conflicts with SST1459 dotnet_diagnostic.RCS1056.severity = none # Avoid usage of using alias directive - used to avoid conflicts dotnet_diagnostic.RCS1059.severity = none # Avoid locking on publicly accessible instance — covered by SST1901 dotnet_diagnostic.RCS1075.severity = none # Avoid empty catch clause that catches System.Exception — covered by SST1429 @@ -925,21 +916,21 @@ dotnet_diagnostic.RCS1081.severity = error # Split variable declaration dotnet_diagnostic.RCS1093.severity = error # File contains no code dotnet_diagnostic.RCS1094.severity = none # Declare using directive on top level — covered by SST1200 dotnet_diagnostic.RCS1096.severity = none # Use 'HasFlag' method or bitwise operator — covered by PSH1016 -dotnet_diagnostic.RCS1098.severity = none # Constant values should be placed on right side of comparisons — covered by SST1186 +dotnet_diagnostic.RCS1098.severity = none # Constant should be on the right of a comparison — covered by SST1186 dotnet_diagnostic.RCS1099.severity = none # Default label should be the last label in a switch section — covered by SST1466 dotnet_diagnostic.RCS1102.severity = none # Make class static — covered by SST1432 dotnet_diagnostic.RCS1108.severity = error # Add 'static' modifier to all partial class declarations -dotnet_diagnostic.RCS1111.severity = error # Add braces to switch section with multiple statements -dotnet_diagnostic.RCS1113.severity = error # Use 'string.IsNullOrEmpty' method +dotnet_diagnostic.RCS1111.severity = none # Add braces to switch section with multiple statements — covered by SST1525 +dotnet_diagnostic.RCS1113.severity = none # Use 'string.IsNullOrEmpty' method — covered by SST2255 dotnet_diagnostic.RCS1118.severity = none # Mark local variable as const — covered by PSH1402 dotnet_diagnostic.RCS1123.severity = none # Add parentheses when necessary — covered by SST1407 dotnet_diagnostic.RCS1130.severity = none # Bitwise operation on enum without Flags attribute — covered by SST2458 -dotnet_diagnostic.RCS1135.severity = error # Declare enum member with zero value (when enum has FlagsAttribute) +dotnet_diagnostic.RCS1135.severity = none # Declare enum member with zero value (when enum has FlagsAttribute) — covered by SST2329 dotnet_diagnostic.RCS1136.severity = none # Merge switch sections with equivalent content — covered by SST2414 -dotnet_diagnostic.RCS1154.severity = error # Sort enum members +dotnet_diagnostic.RCS1154.severity = none # Sort enum members — covered by SST1222 dotnet_diagnostic.RCS1155.severity = none # Use StringComparison when comparing strings — covered by PSH1207 dotnet_diagnostic.RCS1156.severity = none # Use string.Length instead of comparison with empty string — covered by PSH1204 -dotnet_diagnostic.RCS1157.severity = none # Composite enum value contains undefined flag — covered by SST2303 +dotnet_diagnostic.RCS1157.severity = none # Composite enum value contains undefined flag — covered by SST2461 dotnet_diagnostic.RCS1159.severity = error # Use EventHandler dotnet_diagnostic.RCS1160.severity = none # Abstract type should not have public constructors — covered by SST1428 dotnet_diagnostic.RCS1161.severity = none # Enum should declare explicit values - do not need explicit values @@ -947,43 +938,43 @@ dotnet_diagnostic.RCS1162.severity = none # Avoid chain of assignments — cover dotnet_diagnostic.RCS1166.severity = none # Value type object is never equal to null — covered by SST1469 dotnet_diagnostic.RCS1168.severity = none # Parameter name differs from base name — covered by SST1318 dotnet_diagnostic.RCS1169.severity = error # Make field read-only -dotnet_diagnostic.RCS1170.severity = error # Use read-only auto-implemented property +dotnet_diagnostic.RCS1170.severity = none # Use read-only auto-implemented property — covered by SST2332 dotnet_diagnostic.RCS1172.severity = none # Use 'is' operator instead of 'as' operator — covered by SST2005 dotnet_diagnostic.RCS1187.severity = none # Use constant instead of field — covered by PSH1402 dotnet_diagnostic.RCS1191.severity = error # Declare enum value as combination of names dotnet_diagnostic.RCS1193.severity = none # Overriding member should not change 'params' modifier — covered by SST2426 -dotnet_diagnostic.RCS1196.severity = error # Call extension method as instance method +dotnet_diagnostic.RCS1196.severity = none # Call extension method as instance method — covered by SST2256 dotnet_diagnostic.RCS1200.severity = none # Call 'Enumerable.ThenBy' instead of 'Enumerable.OrderBy' — covered by PSH1108 dotnet_diagnostic.RCS1201.severity = error # Use method chaining -dotnet_diagnostic.RCS1202.severity = error # Avoid NullReferenceException -dotnet_diagnostic.RCS1204.severity = error # Use EventArgs.Empty -dotnet_diagnostic.RCS1205.severity = error # Order named arguments according to the order of parameters +dotnet_diagnostic.RCS1202.severity = none # Avoid NullReferenceException — covered by SST2454 +dotnet_diagnostic.RCS1204.severity = none # Use EventArgs.Empty — covered by PSH1022 +dotnet_diagnostic.RCS1205.severity = none # Order named arguments according to the order of parameters — covered by SST1220 dotnet_diagnostic.RCS1208.severity = error # Reduce 'if' nesting -dotnet_diagnostic.RCS1209.severity = error # Order type parameter constraints +dotnet_diagnostic.RCS1209.severity = none # Order type parameter constraints — covered by SST1221 dotnet_diagnostic.RCS1210.severity = none # Return completed task instead of returning null — covered by PSH1312 dotnet_diagnostic.RCS1215.severity = error # Expression is always equal to true/false dotnet_diagnostic.RCS1222.severity = error # Merge preprocessor directives -dotnet_diagnostic.RCS1223.severity = suggestion # Mark publicly visible type with DebuggerDisplay attribute — only data types benefit; the rule is too broad to be an error +dotnet_diagnostic.RCS1223.severity = suggestion # Mark visible types with DebuggerDisplay — too broad to be an error dotnet_diagnostic.RCS1224.severity = error # Make method an extension method dotnet_diagnostic.RCS1225.severity = error # Make class sealed dotnet_diagnostic.RCS1227.severity = none # Validate arguments correctly — covered by SST2404 dotnet_diagnostic.RCS1229.severity = error # Use async/await when necessary dotnet_diagnostic.RCS1231.severity = none # Make parameter ref read-only — covered by PSH1007 dotnet_diagnostic.RCS1233.severity = none # Use short-circuiting operator — covered by SST1468 -dotnet_diagnostic.RCS1234.severity = error # Duplicate enum value -dotnet_diagnostic.RCS1239.severity = error # Use 'for' statement instead of 'while' statement +dotnet_diagnostic.RCS1234.severity = none # Duplicate enum value — covered by SST2455 +dotnet_diagnostic.RCS1239.severity = none # Use 'for' statement instead of 'while' statement — covered by SST2287 dotnet_diagnostic.RCS1240.severity = error # Operator is unnecessary dotnet_diagnostic.RCS1242.severity = none # Do not pass non-read-only struct by read-only reference — covered by PSH1003 dotnet_diagnostic.RCS1243.severity = none # Duplicate word in a comment — covered by SST1658 (documentation comments) dotnet_diagnostic.RCS1247.severity = error # Fix documentation comment tag -dotnet_diagnostic.RCS1248.severity = none # Normalize null check — conflicts with SST1149, which owns the 'is null' pattern direction -dotnet_diagnostic.RCS1250.severity = none # Use implicit/explicit object creation — conflicts with SST2202, which owns the implicit-target-type direction +dotnet_diagnostic.RCS1248.severity = none # Normalize null check — conflicts with SST1149, which owns 'is null' +dotnet_diagnostic.RCS1250.severity = none # Use implicit/explicit object creation — conflicts with SST2202 dotnet_diagnostic.RCS1252.severity = error # Normalize usage of infinite loop dotnet_diagnostic.RCS1254.severity = error # Normalize format of enum flag value -dotnet_diagnostic.RCS1255.severity = none # Simplify argument null check — conflicts with our ArgumentExceptionHelper helper pattern +dotnet_diagnostic.RCS1255.severity = none # Simplify argument null check — conflicts with our ArgumentExceptionHelper dotnet_diagnostic.RCS1257.severity = error # Use enum field explicitly dotnet_diagnostic.RCS1258.severity = error # Unnecessary enum flag -dotnet_diagnostic.RCS1260.severity = none # Add/remove trailing comma — conflicts with SST1413, which owns the trailing-comma direction +dotnet_diagnostic.RCS1260.severity = none # Add/remove trailing comma — conflicts with SST1413 dotnet_diagnostic.RCS1261.severity = none # Resource can be disposed asynchronously — covered by PSH1310 dotnet_diagnostic.RCS1264.severity = error # Use 'var' or explicit type (replaces RCS1010, RCS1176, RCS1177) dotnet_diagnostic.RCS1266.severity = none # Use raw string literal — covered by SST2243 @@ -993,32 +984,32 @@ dotnet_diagnostic.RCS1267.severity = error # Use string interpolation instead of dotnet_diagnostic.RCS1077.severity = none # Covered by the PSH1101-PSH1111 family (canonical) dotnet_diagnostic.RCS1080.severity = none # Covered by PSH1106 (canonical) dotnet_diagnostic.RCS1112.severity = none # Combine 'Enumerable.Where' method chain — covered by PSH1109 -dotnet_diagnostic.RCS1186.severity = error # Use Regex instance instead of static method -dotnet_diagnostic.RCS1190.severity = none # Join string expressions — conflicts with SST2470, which reports the fused-literal seam this would create -dotnet_diagnostic.RCS1195.severity = error # Use ^ operator +dotnet_diagnostic.RCS1186.severity = none # Use Regex instance instead of static method — covered by PSH1421 +dotnet_diagnostic.RCS1190.severity = none # Join string expressions — conflicts with SST2470 (fused literal seam) +dotnet_diagnostic.RCS1195.severity = none # Use ^ operator — covered by SST2261 dotnet_diagnostic.RCS1197.severity = none # Optimize StringBuilder.Append/AppendLine call — covered by PSH1203/PSH1214 -dotnet_diagnostic.RCS1198.severity = none # Avoid unnecessary boxing of value type — boxing is unavoidable bridging Rx and IEnumerable +dotnet_diagnostic.RCS1198.severity = none # Avoid unnecessary boxing — unavoidable bridging Rx and IEnumerable dotnet_diagnostic.RCS1230.severity = none # Unnecessary explicit use of enumerator — covered by SST1467 dotnet_diagnostic.RCS1235.severity = error # Optimize method call dotnet_diagnostic.RCS1236.severity = none # Use exception filter — covered by SST2009 dotnet_diagnostic.RCS1246.severity = none # Use element access — covered by PSH1106 # Maintainability -dotnet_diagnostic.RCS1158.severity = none # Static member in generic type should use a type parameter — common factory pattern — covered by SST1431 -dotnet_diagnostic.RCS1163.severity = none # Unused parameter — interface implementations and Rx selectors often have unused parameters -dotnet_diagnostic.RCS1164.severity = none # Unused type parameter - DUPLICATE IDE0060 (UnusedParameter analyzer 210ms; IDE0060 bundled at lower cost) -dotnet_diagnostic.RCS1165.severity = none # Unconstrained type parameter checked for null - we validate all parameters for non-nullable enabled platforms +dotnet_diagnostic.RCS1158.severity = none # Static member in generic type should use a type parameter — covered by SST1431 +dotnet_diagnostic.RCS1163.severity = none # Unused parameter — interface impls and Rx selectors often have them +dotnet_diagnostic.RCS1164.severity = none # Unused type parameter — covered by IDE0060 at lower cost +dotnet_diagnostic.RCS1165.severity = none # Unconstrained type parameter checked for null — we validate all parameters dotnet_diagnostic.RCS1182.severity = none # Remove redundant base interface — covered by SST1177 dotnet_diagnostic.RCS1213.severity = none # Remove unused member declaration - DUPLICATE IDE0051 (slower: 230ms vs 75ms) dotnet_diagnostic.RCS1241.severity = error # Implement non-generic counterpart -dotnet_diagnostic.RCS1256.severity = none # Invalid argument null check — conflicts with our ArgumentExceptionHelper helper pattern +dotnet_diagnostic.RCS1256.severity = none # Invalid argument null check — conflicts with our ArgumentExceptionHelper # Documentation dotnet_diagnostic.RCS1181.severity = error # Convert comment to documentation comment -dotnet_diagnostic.RCS1189.severity = error # Add or remove region name -dotnet_diagnostic.RCS1226.severity = none # Add paragraph to documentation comment — <para> wrapping is subjective and adds noise +dotnet_diagnostic.RCS1189.severity = none # Add or remove region name — covered by SST1124 +dotnet_diagnostic.RCS1226.severity = none # Add paragraph to documentation comment — para wrapping adds noise dotnet_diagnostic.RCS1228.severity = error # Unused element in a documentation comment -dotnet_diagnostic.RCS1232.severity = error # Order elements in documentation comment +dotnet_diagnostic.RCS1232.severity = none # Order elements in documentation comment — covered by SST1666 dotnet_diagnostic.RCS1253.severity = error # Format documentation comment summary dotnet_diagnostic.RCS1263.severity = none # Invalid reference in a documentation comment @@ -1038,7 +1029,7 @@ dotnet_diagnostic.RCS1141.severity = none # Add 'param' element to documentation dotnet_diagnostic.RCS1142.severity = none # Add 'typeparam' element to documentation comment — covered by SA1618 dotnet_diagnostic.RCS1175.severity = none # Unused 'this' parameter — covered by CA1822 dotnet_diagnostic.RCS1194.severity = none # Implement exception constructors — covered by CA1032 -dotnet_diagnostic.RCS1203.severity = none # Use AttributeUsageAttribute — covered by CA1018 +dotnet_diagnostic.RCS1203.severity = none # Use AttributeUsageAttribute — covered by SST2336 # Formatting dotnet_diagnostic.RCS0001.severity = none # Add blank line after embedded statement — covered by StyleCop layout rules @@ -1050,9 +1041,9 @@ dotnet_diagnostic.RCS0007.severity = none # Add blank line between accessors — dotnet_diagnostic.RCS0008.severity = none # Add blank line between closing brace and next statement — covered by SA1513 dotnet_diagnostic.RCS0009.severity = none # Add blank line between declaration and documentation comment — covered by SA1514 dotnet_diagnostic.RCS0010.severity = none # Add blank line between declarations — covered by SA1516 -dotnet_diagnostic.RCS0011.severity = none # Add/remove blank line between single-line accessors — StyleCop already governs this +dotnet_diagnostic.RCS0011.severity = none # Blank line between single-line accessors — covered by the layout rules dotnet_diagnostic.RCS0012.severity = none # Add blank line between single-line declarations — covered by SA1516 -dotnet_diagnostic.RCS0013.severity = none # Add blank line between single-line declarations of different kind — covered by SA1516 +dotnet_diagnostic.RCS0013.severity = none # Blank line between single-line declarations of different kind — SA1516 dotnet_diagnostic.RCS0015.severity = none # Add/remove blank line between using directives — covered by SA1209 / SA1210 dotnet_diagnostic.RCS0016.severity = none # Put attribute list on its own line — StyleCop SA1133 governs attribute lists dotnet_diagnostic.RCS0020.severity = none # Format accessor's braces — covered by SA1500 @@ -1067,12 +1058,12 @@ dotnet_diagnostic.RCS0030.severity = none # Put embedded statement on its own li dotnet_diagnostic.RCS0031.severity = none # Put enum member on its own line — covered by SA1136 dotnet_diagnostic.RCS0032.severity = none # Place new line after/before arrow token — StyleCop wrapping rules cover this dotnet_diagnostic.RCS0033.severity = none # Put statement on its own line — covered by SA1505 family -dotnet_diagnostic.RCS0034.severity = none # Put type parameter constraint on its own line — StyleCop wrapping rules cover this -dotnet_diagnostic.RCS0036.severity = none # Remove blank line between single-line declarations of same kind — covered by SA1516 +dotnet_diagnostic.RCS0034.severity = none # Put type parameter constraint on its own line — covered by wrapping rules +dotnet_diagnostic.RCS0036.severity = none # Remove blank line between single-line declarations — covered by SA1516 dotnet_diagnostic.RCS0039.severity = none # Remove new line before base list — StyleCop wrapping rules cover this -dotnet_diagnostic.RCS0041.severity = none # Remove new line between 'if' keyword and 'else' keyword — StyleCop layout rules cover this +dotnet_diagnostic.RCS0041.severity = none # Remove new line between 'if' and 'else' — covered by the layout rules dotnet_diagnostic.RCS0042.severity = none # Put auto-accessors on a single line — formatting preference, not enforced -dotnet_diagnostic.RCS0044.severity = none # Use carriage return + linefeed as new line — handled by .gitattributes / editorconfig end_of_line +dotnet_diagnostic.RCS0044.severity = none # Use CRLF as new line — handled by .gitattributes / end_of_line dotnet_diagnostic.RCS0045.severity = none # Use linefeed as new line — handled by .gitattributes / editorconfig end_of_line dotnet_diagnostic.RCS0046.severity = none # Use spaces instead of tab — handled by editorconfig indent_style dotnet_diagnostic.RCS0048.severity = none # Put initializer on a single line — formatting preference, not enforced @@ -1086,7 +1077,7 @@ dotnet_diagnostic.RCS0055.severity = none # Fix formatting of a binary expressio dotnet_diagnostic.RCS0056.severity = none # A line is too long — line-length not enforced dotnet_diagnostic.RCS0057.severity = none # Normalize whitespace at the beginning of a file — handled by editorconfig dotnet_diagnostic.RCS0058.severity = none # Normalize whitespace at the end of a file — covered by SST1518 -dotnet_diagnostic.RCS0059.severity = none # Place new line after/before null-conditional operator — StyleSharp wrapping rules cover this +dotnet_diagnostic.RCS0059.severity = none # New line around the null-conditional operator — covered by wrapping rules dotnet_diagnostic.RCS0060.severity = none # Add/remove line after file scoped namespace declaration — formatting preference dotnet_diagnostic.RCS0061.severity = none # Add/remove blank line between switch sections — formatting preference dotnet_diagnostic.RCS0062.severity = none # Put expression body on its own line — formatting preference @@ -1098,25 +1089,23 @@ dotnet_diagnostic.RCS0063.severity = none # Remove unnecessary blank line — co file_header_template = Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved.\nReactiveUI Association Incorporated licenses this file to you under the MIT license.\nSee the LICENSE file in the project root for full license information. stylesharp.summary_single_line_max_length = 120 -# SonarAnalyzer's S4022 only ever flagged storage narrower than int; uint, long and ulong -# passed silently. Match that, so retiring S4022 for SST2313 does not fail a build on an -# enum that was deliberately widened. -stylesharp.SST2313.allowed_enum_storage = int, uint, long, ulong +stylesharp.SST2313.allowed_enum_storage = int, uint, long, ulong # deliberately widened enums stay legal -# Documentation coverage scope (SST1600/SST1601/SST1602/SST1654). -# Require documentation on every element, including private members. -stylesharp.document_exposed_elements = true +stylesharp.document_exposed_elements = true # Documentation coverage — every element, private members included stylesharp.document_internal_elements = true stylesharp.document_private_elements = true stylesharp.document_private_fields = true stylesharp.document_interfaces = all stylesharp.SST1305.allowed_hungarian_prefixes = rx +stylesharp.tuple_element_naming = pascal_case # SST1316 stylesharp.instance_member_qualification = omit_this +stylesharp.use_var = always # SST2271; matches the csharp_style_var_* preferences above stylesharp.max_cyclomatic_complexity = 10 stylesharp.max_cognitive_complexity = 15 stylesharp.max_property_cognitive_complexity = 3 -# SST1484 also reports a field that shadows one inherited from a base type. -stylesharp.SST1484.check_base_types = true +stylesharp.SST1484.check_base_types = true # also report a field shadowed from a base type + +stylesharp.SST2403.allowed_escape_methods = WhenActivated, ToProperty # both hand this straight back, so nothing observes a half-built instance stylesharp.max_line_length = 200 # SST1521 (characters; keeps the limit this repo has always enforced) stylesharp.max_file_lines = 1000 # SST1522 (code lines; blank lines and comments do not count) # stylesharp.max_member_lines = 60 # SST1523 (code lines) @@ -1135,7 +1124,7 @@ dotnet_diagnostic.SST1006.severity = error # A preprocessor keyword is preceded dotnet_diagnostic.SST1007.severity = error # An operator keyword is not followed by a space dotnet_diagnostic.SST1008.severity = error # An opening parenthesis is followed by a space dotnet_diagnostic.SST1009.severity = error # A closing parenthesis is preceded by a space -dotnet_diagnostic.SST1010.severity = none # An opening square bracket has adjacent whitespace — conflicts with modern collection expressions +dotnet_diagnostic.SST1010.severity = none # Opening square bracket has adjacent whitespace — collection expressions need it dotnet_diagnostic.SST1011.severity = error # A closing square bracket is preceded by a space dotnet_diagnostic.SST1012.severity = error # An opening brace is not followed by a space on a single line dotnet_diagnostic.SST1013.severity = error # A closing brace is not preceded by a space on a single line @@ -1172,15 +1161,15 @@ dotnet_diagnostic.SST1114.severity = error # A blank line separates the declarat dotnet_diagnostic.SST1115.severity = error # A blank line separates a parameter from the preceding comma dotnet_diagnostic.SST1116.severity = error # A qualified name can be shortened without changing the symbol it binds to dotnet_diagnostic.SST1117.severity = error # Instance member access follows the configured this. qualification style -dotnet_diagnostic.SST1118.severity = none # A parameter should not span multiple lines +dotnet_diagnostic.SST1118.severity = none # A parameter spanning multiple lines — collides with the 200-char line limit dotnet_diagnostic.SST1119.severity = error # A numeric literal groups its digit separators irregularly dotnet_diagnostic.SST1120.severity = error # A comment contains no text -dotnet_diagnostic.SST1121.severity = error # A framework type name is used instead of its built-in alias (opt-in rule, enabled here) +dotnet_diagnostic.SST1121.severity = error # A framework type name is used instead of its built-in alias dotnet_diagnostic.SST1122.severity = error # An empty string literal is used instead of string.Empty dotnet_diagnostic.SST1123.severity = error # A #region is placed inside a code element body dotnet_diagnostic.SST1124.severity = error # A #region directive is used dotnet_diagnostic.SST1125.severity = error # A Nullable type is written in long form instead of the T? shorthand -dotnet_diagnostic.SST1127.severity = error # A generic type constraint shares a line with the declaration or another constraint +dotnet_diagnostic.SST1127.severity = error # A generic type constraint shares a line with another constraint dotnet_diagnostic.SST1128.severity = error # A constructor initializer shares a line with the constructor signature dotnet_diagnostic.SST1129.severity = error # A value type is created with a parameterless constructor call instead of default dotnet_diagnostic.SST1130.severity = error # An anonymous delegate is used where a lambda expression is clearer @@ -1245,7 +1234,7 @@ dotnet_diagnostic.SST1188.severity = error # Use the 'default' literal instead o dotnet_diagnostic.SST1189.severity = error # Variables should not be self-assigned dotnet_diagnostic.SST1190.severity = error # Doubled negation operators should be removed dotnet_diagnostic.SST1191.severity = error # Long numeric literals should use digit separators -dotnet_diagnostic.SST1192.severity = none # Control characters in string literals should be escaped +dotnet_diagnostic.SST1192.severity = error # Control characters in string literals should be escaped dotnet_diagnostic.SST1193.severity = error # Keep initial member values with construction dotnet_diagnostic.SST1194.severity = error # Keep initial collection values with construction dotnet_diagnostic.SST1195.severity = error # Write null fallback with ?? @@ -1275,31 +1264,32 @@ dotnet_diagnostic.SST1216.severity = error # Using static directives should be p dotnet_diagnostic.SST1217.severity = error # Using static directives should be ordered alphabetically dotnet_diagnostic.SST1218.severity = error # Other members separate a method's overloads dotnet_diagnostic.SST1219.severity = error # A switch default clause is not placed last -dotnet_diagnostic.SST1220.severity = error # An all-named argument list is in a different order than the parameters. Code fix reorders it to declaration order. Info. -dotnet_diagnostic.SST1221.severity = error # `where` constraint clauses are not ordered to match the type-parameter list. Code fix reorders them. Info. +dotnet_diagnostic.SST1220.severity = error # An all-named argument list is not in declaration order +dotnet_diagnostic.SST1221.severity = error # where constraint clauses do not match the type-parameter order +dotnet_diagnostic.SST1222.severity = error # An enum with explicit values declares them out of ascending order # Naming -dotnet_diagnostic.SST1300.severity = none # Types and members should be PascalCase — naming duplicates existing analyzers +dotnet_diagnostic.SST1300.severity = error # Types and members should be PascalCase dotnet_diagnostic.SST1302.severity = error # Interface names should begin with I dotnet_diagnostic.SST1303.severity = error # Const names should be PascalCase dotnet_diagnostic.SST1304.severity = error # Non-private readonly fields should be PascalCase dotnet_diagnostic.SST1305.severity = error # Field names should not use Hungarian notation -dotnet_diagnostic.SST1306.severity = none # Field names should begin with a lower-case letter — private fields use _camelCase here +dotnet_diagnostic.SST1306.severity = none # Field names should begin lower-case — private fields use _camelCase here dotnet_diagnostic.SST1307.severity = error # Accessible fields should be PascalCase -dotnet_diagnostic.SST1308.severity = none # Field names should not be prefixed with m_ or s_ — too broad for existing conventions +dotnet_diagnostic.SST1308.severity = none # Field names should not use m_ or s_ prefixes — too broad for our conventions dotnet_diagnostic.SST1309.severity = error # Private fields should be _camelCase dotnet_diagnostic.SST1310.severity = none # Field names should not contain underscores — conflicts with _camelCase -dotnet_diagnostic.SST1311.severity = none # Static readonly fields should be PascalCase — we use _camelCase for private static readonly too +dotnet_diagnostic.SST1311.severity = none # Static readonly fields should be PascalCase — we use _camelCase there too dotnet_diagnostic.SST1312.severity = error # Local variables should be camelCase dotnet_diagnostic.SST1313.severity = error # Parameters should be camelCase dotnet_diagnostic.SST1314.severity = error # Type parameters should begin with T dotnet_diagnostic.SST1315.severity = error # Union member names should match the configured casing -dotnet_diagnostic.SST1316.severity = none # Tuple element names should use the configured casing — tuple naming is not enforced here -dotnet_diagnostic.SST1317.severity = none # Asynchronous method names should end with 'Async' — conflicts with this project's Rx-compatibility and naming mechanism +dotnet_diagnostic.SST1316.severity = error # Tuple element names should use the configured casing +dotnet_diagnostic.SST1317.severity = none # Async method names should end with 'Async' — conflicts with our Rx naming dotnet_diagnostic.SST1318.severity = error # Overriding parameter names should match the base declaration dotnet_diagnostic.SST1319.severity = error # An enumeration's type name is not PascalCase dotnet_diagnostic.SST1320.severity = error # A parameter name matches its method's name -dotnet_diagnostic.SST1321.severity = none # Public APIs intentionally use Async to describe asynchronous observable behavior without returning an awaitable. +dotnet_diagnostic.SST1321.severity = none # Async naming without an awaitable return — deliberate on our public APIs # Maintainability dotnet_diagnostic.SST1400.severity = error # An element does not declare an access modifier @@ -1313,12 +1303,12 @@ dotnet_diagnostic.SST1407.severity = error # Mixed-precedence arithmetic is not dotnet_diagnostic.SST1408.severity = error # Mixed conditional operators are not parenthesized dotnet_diagnostic.SST1410.severity = error # An anonymous method has an empty parameter list dotnet_diagnostic.SST1411.severity = error # An attribute uses an empty argument list -dotnet_diagnostic.SST1412.severity = none # Store files as UTF-8 with a byte order mark — conflicts with SST1450 (UTF-8 without BOM) -dotnet_diagnostic.SST1413.severity = none # A multi-line initializer omits the trailing comma — trailing commas are not required here +dotnet_diagnostic.SST1412.severity = none # Store files as UTF-8 with a BOM — conflicts with SST1450 (no BOM) +dotnet_diagnostic.SST1413.severity = error # A multi-line initializer omits the trailing comma dotnet_diagnostic.SST1414.severity = error # A tuple type in a member signature has an unnamed element -dotnet_diagnostic.SST1415.severity = error # An argument-exception constructor uses a string literal where nameof would track renames -dotnet_diagnostic.SST1416.severity = none # Do not declare public members in a non-public type -dotnet_diagnostic.SST1417.severity = suggestion # Namespace should match the folder structure +dotnet_diagnostic.SST1415.severity = error # An argument-exception constructor uses a literal instead of nameof +dotnet_diagnostic.SST1416.severity = none # Public members in a non-public type — reflection binding needs them public +dotnet_diagnostic.SST1417.severity = none # Namespace should match the folder — BCL-namespace types cannot comply dotnet_diagnostic.SST1418.severity = error # Declare precedence when mixing the null-coalescing operator dotnet_diagnostic.SST1419.severity = error # Remove redundant modifiers dotnet_diagnostic.SST1420.severity = error # Trivial properties should be auto-implemented @@ -1360,9 +1350,9 @@ dotnet_diagnostic.SST1455.severity = error # Unsafe modifiers should be used onl dotnet_diagnostic.SST1456.severity = error # Readonly fields should not store mutable source-defined structs dotnet_diagnostic.SST1457.severity = error # Global suppressions should point at real declarations dotnet_diagnostic.SST1458.severity = error # Global suppression targets should use declaration ids directly -dotnet_diagnostic.SST1459.severity = error # Grouping parentheses should be removed when the parent syntax already isolates the expression +dotnet_diagnostic.SST1459.severity = error # Grouping parentheses the parent syntax already isolates dotnet_diagnostic.SST1460.severity = error # Non-mutating struct members should be readonly -dotnet_diagnostic.SST1461.severity = error # Private parameters that are never read should be removed +dotnet_diagnostic.SST1461.severity = error # A parameter is never read anywhere in the member body dotnet_diagnostic.SST1462.severity = error # Suppressions for diagnostics already disabled by config should be removed dotnet_diagnostic.SST1463.severity = error # Symbol-name strings should use nameof dotnet_diagnostic.SST1464.severity = error # An else clause follows a branch that always jumps and can be unwrapped @@ -1374,7 +1364,7 @@ dotnet_diagnostic.SST1469.severity = error # A non-nullable value type is compar dotnet_diagnostic.SST1470.severity = error # A trailing catch clause that only rethrows should be removed dotnet_diagnostic.SST1471.severity = error # Magic numbers should be named constants dotnet_diagnostic.SST1472.severity = error # Signatures should not declare too many parameters -dotnet_diagnostic.SST1473.severity = error # A floating-point value is compared for exact equality (zero comparison allowed by default) +dotnet_diagnostic.SST1473.severity = error # A floating-point value is compared for exact equality dotnet_diagnostic.SST1474.severity = error # Both sides of an operator are the same expression dotnet_diagnostic.SST1475.severity = error # A condition repeats an earlier one in the chain, so its branch cannot run dotnet_diagnostic.SST1476.severity = error # Every branch of a conditional has the same body @@ -1389,8 +1379,8 @@ dotnet_diagnostic.SST1484.severity = error # A declaration shadows an outer fiel dotnet_diagnostic.SST1485.severity = error # A member that must not throw throws dotnet_diagnostic.SST1486.severity = error # The same string literal is repeated instead of being named dotnet_diagnostic.SST1487.severity = error # A collection element is assigned twice with nothing reading it in between -dotnet_diagnostic.SST1488.severity = error # An exception type does not declare the standard constructors (parameterless waivable) -dotnet_diagnostic.SST1489.severity = error # An exception type carries serialization members the target framework has obsoleted +dotnet_diagnostic.SST1488.severity = error # An exception type does not declare the standard constructors +dotnet_diagnostic.SST1489.severity = error # An exception type carries obsoleted serialization members dotnet_diagnostic.SST1490.severity = error # A base list names an interface the rest of the list already implies dotnet_diagnostic.SST1491.severity = error # A modifier restates the declaration's default dotnet_diagnostic.SST1492.severity = error # A value is tested against what it is then assigned, so the guard decides nothing @@ -1400,13 +1390,13 @@ dotnet_diagnostic.SST1495.severity = error # '==' compares references on a type dotnet_diagnostic.SST1496.severity = error # An abstract type declares nothing abstract dotnet_diagnostic.SST1497.severity = error # A local is declared and never read dotnet_diagnostic.SST1498.severity = error # Only a nested type uses a private member -dotnet_diagnostic.SST1499.severity = error # A static field visible outside its type can still be changed (internal fields included by default) +dotnet_diagnostic.SST1499.severity = error # A static field visible outside its type can still be changed # Layout dotnet_diagnostic.SST1500.severity = error # A brace in a multi-line construct shares its line with other code dotnet_diagnostic.SST1501.severity = error # A statement block is collapsed onto a single line dotnet_diagnostic.SST1502.severity = error # An element body is collapsed onto a single line -dotnet_diagnostic.SST1503.severity = none # A control-flow statement omits the braces around its child statement — duplicate with existing brace preferences +dotnet_diagnostic.SST1503.severity = error # A control-flow statement omits the braces around its child statement dotnet_diagnostic.SST1504.severity = error # The accessors of a property/event mix single-line and multi-line forms dotnet_diagnostic.SST1505.severity = error # An opening brace is followed by a blank line dotnet_diagnostic.SST1506.severity = error # An element documentation header is followed by a blank line @@ -1428,15 +1418,19 @@ dotnet_diagnostic.SST1521.severity = error # A line is longer than the configure dotnet_diagnostic.SST1522.severity = error # A file has more code lines than the configured maximum (default 500) dotnet_diagnostic.SST1523.severity = error # A member has more code lines than the configured maximum (default 60) dotnet_diagnostic.SST1524.severity = error # A switch section has more code lines than the configured maximum (default 20) -dotnet_diagnostic.SST1525.severity = error # A multi-statement `switch` section has no braces; the braces-on policy extends to switch sections. Code fix wraps it. -dotnet_diagnostic.SST1526.severity = error # A wrapped binary expression places the operator inconsistently. Configurable (`before`/`after`, default before). Opt-in. -dotnet_diagnostic.SST1527.severity = error # The `=>` of an expression-bodied member wraps inconsistently. Configurable. Opt-in. +dotnet_diagnostic.SST1525.severity = error # A multi-statement switch section has no braces +dotnet_diagnostic.SST1526.severity = error # A wrapped binary expression places the operator inconsistently +dotnet_diagnostic.SST1527.severity = error # The => of an expression-bodied member wraps inconsistently dotnet_diagnostic.SST1528.severity = error # The `=` of a wrapped initializer wraps inconsistently. Configurable. Opt-in. -dotnet_diagnostic.SST1529.severity = error # A wrapped `?.`/`.` call chain places the break inconsistently. Configurable. Opt-in. -dotnet_diagnostic.SST1530.severity = error # A newline sits between a type declaration and its base list. Code fix pulls the base list onto the declaration line. Opt-in. -dotnet_diagnostic.SST1531.severity = error # A short object initializer is split across lines. Code fix collapses it when it fits. Opt-in. +dotnet_diagnostic.SST1529.severity = error # A wrapped call chain places the break inconsistently +dotnet_diagnostic.SST1530.severity = error # A newline sits between a type declaration and its base list +dotnet_diagnostic.SST1531.severity = error # A short object initializer is split across lines dotnet_diagnostic.SST1532.severity = error # A file mixes line endings. Configurable (`lf`/`crlf`, default lf). Opt-in. -dotnet_diagnostic.SST1533.severity = error # A source file contains no code. Opt-in. +dotnet_diagnostic.SST1533.severity = none # A source file contains no code — a polyfill behind #if is empty by design +dotnet_diagnostic.SST1534.severity = none # Switch braces that scope nothing — conflicts with SST1525's braces-on policy +dotnet_diagnostic.SST1535.severity = error # A constructor initializer colon should not be followed by a blank line +dotnet_diagnostic.SST1536.severity = error # A conditional operator token should not be followed by a blank line +dotnet_diagnostic.SST1537.severity = error # An expression-body arrow should not be followed by a blank line # Documentation dotnet_diagnostic.SST1600.severity = error # Externally visible members should be documented @@ -1447,7 +1441,7 @@ dotnet_diagnostic.SST1605.severity = error # Partial element documentation shoul dotnet_diagnostic.SST1606.severity = error # The summary should have text dotnet_diagnostic.SST1607.severity = error # Partial element summary should have text dotnet_diagnostic.SST1608.severity = error # Documentation should not use the default placeholder summary -dotnet_diagnostic.SST1609.severity = none # Property documentation should have a value +dotnet_diagnostic.SST1609.severity = none # Property docs should have a value — it only restates the summary dotnet_diagnostic.SST1610.severity = error # Property value documentation should have text dotnet_diagnostic.SST1611.severity = error # Parameters should be documented dotnet_diagnostic.SST1612.severity = error # Parameter documentation should match the parameters @@ -1483,14 +1477,16 @@ dotnet_diagnostic.SST1653.severity = error # Keep short documentation summaries dotnet_diagnostic.SST1654.severity = error # Extension blocks should be documented with a summary dotnet_diagnostic.SST1655.severity = error # Extension block parameters should be documented dotnet_diagnostic.SST1656.severity = error # Extension block type parameters should be documented -dotnet_diagnostic.SST1657.severity = error # Extension block documentation should reference a real parameter or type parameter +dotnet_diagnostic.SST1657.severity = error # Extension block docs name an unknown parameter or type parameter dotnet_diagnostic.SST1658.severity = error # Documentation text repeats a word dotnet_diagnostic.SST1659.severity = error # A comment has no text at all dotnet_diagnostic.SST1660.severity = error # The `` tags are not in parameter order. Code fix reorders them. Info. -dotnet_diagnostic.SST1661.severity = error # A snippet uses ``/`` mismatched to single- vs multi-line content. Code fix swaps the tag. Info. -dotnet_diagnostic.SST1662.severity = none # A thrown exception type has no `` documentation. Code fix adds the skeleton. Opt-in. -dotnet_diagnostic.SST1663.severity = none # A `//` comment before a public member reads like a summary; use `///`. Code fix converts it. Opt-in. -dotnet_diagnostic.SST1664.severity = none # A summary separates paragraphs with blank lines instead of ``. Code fix wraps them. Opt-in. +dotnet_diagnostic.SST1661.severity = error # A snippet uses / mismatched to its content +dotnet_diagnostic.SST1662.severity = error # A thrown exception type has no documentation +dotnet_diagnostic.SST1663.severity = error # A // comment before a public member reads like a summary +dotnet_diagnostic.SST1664.severity = error # A summary separates paragraphs with blank lines instead of +dotnet_diagnostic.SST1665.severity = error # An names a type but says nothing about what triggers it +dotnet_diagnostic.SST1666.severity = error # Documentation elements are out of the conventional order # Concurrency and modernization dotnet_diagnostic.SST1900.severity = error # see docs/rules/SST1900.md @@ -1499,11 +1495,11 @@ dotnet_diagnostic.SST1902.severity = error # Do not lock on 'this', a Type, or a dotnet_diagnostic.SST1903.severity = error # Do not lock on a newly-created object dotnet_diagnostic.SST1904.severity = error # A lock targets a non-readonly field dotnet_diagnostic.SST1905.severity = error # An async method or converted delegate returns void -dotnet_diagnostic.SST2000.severity = suggestion # A null check plus throw should use ArgumentNullException.ThrowIfNull +dotnet_diagnostic.SST2000.severity = error # A null check plus throw should use ArgumentNullException.ThrowIfNull dotnet_diagnostic.SST2001.severity = error # Use ArgumentException.ThrowIfNullOrEmpty dotnet_diagnostic.SST2002.severity = error # Use ArgumentException.ThrowIfNullOrWhiteSpace -dotnet_diagnostic.SST2003.severity = suggestion # A disposed check should use ObjectDisposedException.ThrowIf -dotnet_diagnostic.SST2004.severity = suggestion # A range check should use an ArgumentOutOfRangeException.ThrowIf... helper +dotnet_diagnostic.SST2003.severity = error # A disposed check should use ObjectDisposedException.ThrowIf +dotnet_diagnostic.SST2004.severity = error # A range check should use an ArgumentOutOfRangeException.ThrowIf... helper dotnet_diagnostic.SST2005.severity = error # Use the 'is' type pattern instead of comparing an 'as' cast to null dotnet_diagnostic.SST2006.severity = error # Use the 'is not' pattern instead of negating an 'is' check dotnet_diagnostic.SST2007.severity = error # Use declaration patterns instead of an is check followed by a cast local @@ -1516,41 +1512,42 @@ dotnet_diagnostic.SST2013.severity = error # An if whose entire body is another dotnet_diagnostic.SST2014.severity = error # A goto jumps to a label dotnet_diagnostic.SST2015.severity = error # A ++ or -- is buried inside a larger expression dotnet_diagnostic.SST2016.severity = error # A DateTime on a visible signature loses its offset at the boundary -dotnet_diagnostic.SST2017.severity = error # A .Date or .TimeOfDay read proves the value is only a date, or only a time of day +dotnet_diagnostic.SST2017.severity = error # A .Date or .TimeOfDay read proves the value is only one of the two dotnet_diagnostic.SST2018.severity = error # A redundant null check sits beside an is type pattern +dotnet_diagnostic.SST2019.severity = error # Test for null rather than for the object type # Modern language and library usage dotnet_diagnostic.SST1700.severity = error # An extension block declares no members dotnet_diagnostic.SST1701.severity = error # Two extension blocks in a type share the same receiver type dotnet_diagnostic.SST1702.severity = error # Extension blocks in a type are separated by other members -dotnet_diagnostic.SST1703.severity = error # A classic this-parameter extension method is used where an extension block could be +dotnet_diagnostic.SST1703.severity = error # A classic this-parameter extension method could be an extension block dotnet_diagnostic.SST1704.severity = error # A class declaring extension blocks is not named with an Extensions suffix dotnet_diagnostic.SST1705.severity = error # A class mixes classic extension methods with extension blocks dotnet_diagnostic.SST1706.severity = error # An extension block targets a broad receiver type such as object or dynamic dotnet_diagnostic.SST1707.severity = error # Extension blocks should be ordered by receiver type -dotnet_diagnostic.SST1708.severity = error # An extension method never uses its `this` receiver, so it need not be an extension. -dotnet_diagnostic.SST1709.severity = none # A method in a `*Extensions` class whose first parameter lacks `this`. Code fix converts it to an extension block. Opt-in. +dotnet_diagnostic.SST1708.severity = error # An extension method never uses its this receiver +dotnet_diagnostic.SST1709.severity = error # A method in an *Extensions class whose first parameter lacks this dotnet_diagnostic.SST1800.severity = error # Record classes should be sealed dotnet_diagnostic.SST1801.severity = error # A positional record parameter does not match the configured casing dotnet_diagnostic.SST1802.severity = error # A record declares a settable rather than init-only instance property dotnet_diagnostic.SST1803.severity = error # A record struct is not declared readonly -dotnet_diagnostic.SST1804.severity = error # A positional record has an empty `{ }` body where `;` would do. Code fix rewrites it. Info. +dotnet_diagnostic.SST1804.severity = error # A positional record has an empty { } body where ; would do dotnet_diagnostic.SST2100.severity = error # An empty collection creation can use [] dotnet_diagnostic.SST2101.severity = error # An explicit collection creation can use [...] dotnet_diagnostic.SST2102.severity = error # A span-targeted stackalloc initializer can use a collection expression dotnet_diagnostic.SST2103.severity = error # A collection-builder factory call can use a collection expression dotnet_diagnostic.SST2104.severity = error # A short builder-local sequence can return a collection expression -dotnet_diagnostic.SST2105.severity = error # A literal array materialized with LINQ can use the target collection expression directly +dotnet_diagnostic.SST2105.severity = error # A literal array materialized with LINQ can use a collection expression dotnet_diagnostic.SST2200.severity = error # A single-use backing field can use the C# 14 field keyword dotnet_diagnostic.SST2201.severity = error # A return-only switch statement can use a switch expression dotnet_diagnostic.SST2202.severity = error # An object creation repeats an explicit target type dotnet_diagnostic.SST2203.severity = error # An array or string index can use from-end indexing dotnet_diagnostic.SST2204.severity = error # A string slice can use range syntax -dotnet_diagnostic.SST2205.severity = none # An enum switch statement omits named enum values — duplicate of IDE0010 (disabled: too noisy for default/fallthrough) and S131; statement switches deliberately no-op omitted values, and a default to satisfy it is rejected by SST1179/S3532. SST2206 keeps the valuable switch-expression exhaustiveness check. +dotnet_diagnostic.SST2205.severity = none # Enum switch statement omits named values — deliberate; SST2206 covers these dotnet_diagnostic.SST2206.severity = error # An enum switch expression omits named enum values dotnet_diagnostic.SST2207.severity = error # A null guard and return can keep the throw in the returned expression dotnet_diagnostic.SST2208.severity = error # An out variable can be declared at the call site -dotnet_diagnostic.SST2209.severity = none # A null-forgiving operator has no local effect +dotnet_diagnostic.SST2209.severity = error # A null-forgiving operator has no local effect dotnet_diagnostic.SST2210.severity = error # A nullable directive repeats the current file-local state dotnet_diagnostic.SST2211.severity = error # A nullable restore directive has no file-local state to restore dotnet_diagnostic.SST2212.severity = error # Literal UTF-8 byte data can use a u8 string literal @@ -1583,63 +1580,68 @@ dotnet_diagnostic.SST2238.severity = error # Nested property patterns can use ex dotnet_diagnostic.SST2239.severity = error # Forwarding lambdas can use method groups dotnet_diagnostic.SST2240.severity = error # Delegate null checks can use conditional invocation dotnet_diagnostic.SST2241.severity = error # Constructors that only store parameters can use primary-constructor storage -dotnet_diagnostic.SST2242.severity = error # Enum switch statement mappings should name every enum value or include a catch-all +dotnet_diagnostic.SST2242.severity = error # Enum switch mappings should name every value or include a catch-all dotnet_diagnostic.SST2243.severity = error # A verbatim string with escapes or line breaks can use a raw string literal dotnet_diagnostic.SST2244.severity = error # A numeric literal's suffix is lower case dotnet_diagnostic.SST2245.severity = error # A for loop with only a condition should be a while loop -dotnet_diagnostic.SST2246.severity = error # A chain of conditional expressions testing one value against constants can be a switch expression +dotnet_diagnostic.SST2246.severity = error # A chain of conditionals against constants can be a switch expression dotnet_diagnostic.SST2247.severity = error # Consecutive locals copying one value's members in order can be a deconstruction dotnet_diagnostic.SST2248.severity = error # Two constant comparisons of the same value can fold into one is-pattern -dotnet_diagnostic.SST2249.severity = error # A literal-format string.Format or literal concatenation can be an interpolated string -dotnet_diagnostic.SST2250.severity = error # A bare local assigned once by the next statement can be an initialized declaration +dotnet_diagnostic.SST2249.severity = error # A literal string.Format or concatenation can be interpolated +dotnet_diagnostic.SST2250.severity = error # A bare local assigned by the next statement can be an initialized declaration dotnet_diagnostic.SST2251.severity = error # A method call names type arguments that inference would supply dotnet_diagnostic.SST2252.severity = error # A switch statement is nested inside another switch statement -dotnet_diagnostic.SST2254.severity = none # A target-typed `new()` is written where an explicit type reads more clearly; the code fix restores `new TypeName(...)`. Opt-in — the counterpart to SST2202's target-typed direction, so a team enables at most one. +dotnet_diagnostic.SST2254.severity = none # Explicit type where new() is written — counterpart to SST2202, enable one dotnet_diagnostic.SST2255.severity = error # A hand-written null-or-empty string test. Code fix uses `string.IsNullOrEmpty`. -dotnet_diagnostic.SST2256.severity = error # An extension method called in static form. Code fix rewrites to instance form. Info. -dotnet_diagnostic.SST2257.severity = error # A lambda block body that is a single `return`. Code fix uses an expression body. Info. -dotnet_diagnostic.SST2258.severity = error # A redundant explicit delegate wrapper (`new EventHandler(M)`). Code fix drops it. Info. +dotnet_diagnostic.SST2256.severity = error # An extension method called in static form +dotnet_diagnostic.SST2257.severity = error # A lambda block body that is a single return +dotnet_diagnostic.SST2258.severity = error # A redundant explicit delegate wrapper dotnet_diagnostic.SST2259.severity = error # A stray `;` after a type declaration. Code fix removes it. Info. dotnet_diagnostic.SST2260.severity = error # An `as` cast to a type the operand already has. Code fix removes it. Info. dotnet_diagnostic.SST2261.severity = error # `(x && !y) -dotnet_diagnostic.SST2262.severity = error # A raw string literal whose content needs no raw syntax. Code fix demotes it. Info. -dotnet_diagnostic.SST2263.severity = error # An infinite loop whose body re-derives its stop condition. Code fix hoists the condition into the header. Info. +dotnet_diagnostic.SST2262.severity = error # A raw string literal whose content needs no raw syntax +dotnet_diagnostic.SST2263.severity = error # An infinite loop whose body re-derives its stop condition dotnet_diagnostic.SST2264.severity = error # A numeric literal cast to an enum. Code fix names the member. -dotnet_diagnostic.SST2265.severity = none # Consecutive fluent calls on one receiver can fold into a chain. Opt-in. -dotnet_diagnostic.SST2266.severity = none # A local read exactly once can be inlined into that use. Opt-in. -dotnet_diagnostic.SST2267.severity = none # Infinite loops written in mixed `while(true)`/`for(;;)` styles. Configurable. Opt-in. -dotnet_diagnostic.SST2268.severity = none # Inconsistent `()` on object creation with an initializer. Configurable. Opt-in. -dotnet_diagnostic.SST2269.severity = none # Inconsistent parentheses around a conditional's condition. Configurable. Opt-in. -dotnet_diagnostic.SST2270.severity = none # Inconsistent explicit-vs-implicit array-creation type. Configurable. Opt-in. -dotnet_diagnostic.SST2271.severity = none # `var`-vs-explicit local type per the configured preference. Configurable. Opt-in. -dotnet_diagnostic.SST2272.severity = none # `[Flags]` member values written as mixed decimals and shifts. Configurable. Opt-in. -dotnet_diagnostic.SST2273.severity = none # A function or loop body wraps its work in a trailing `if` that could be an early-exit guard clause. Code fix inverts it. Configurable threshold. Opt-in. -dotnet_diagnostic.SST2274.severity = error # A value assigned with `as` and then null-checked is an `is` declaration pattern in one step. Code fix rewrites it. -dotnet_diagnostic.SST2275.severity = error # A method whose block body is a single statement can use an expression body `=> expr`. Code fix rewrites it. -dotnet_diagnostic.SST2276.severity = none # A constructor whose block body is a single statement can use an expression body. Code fix rewrites it. Opt-in. -dotnet_diagnostic.SST2277.severity = none # An operator whose block body is a single `return` can use an expression body. Code fix rewrites it. Opt-in. -dotnet_diagnostic.SST2278.severity = none # A conversion operator whose block body is a single `return` can use an expression body. Code fix rewrites it. Opt-in. -dotnet_diagnostic.SST2279.severity = error # A get-only property whose getter is a single `return` can use a whole-member expression body. Code fix rewrites it. -dotnet_diagnostic.SST2280.severity = error # A get-only indexer whose getter is a single `return` can use a whole-member expression body. Code fix rewrites it. -dotnet_diagnostic.SST2281.severity = error # A local function whose block body is a single statement can use an expression body. Code fix rewrites it. -dotnet_diagnostic.SST2282.severity = error # A reference-type `ReferenceEquals` check against `null` reads as an `is null` / `is not null` pattern. Code fix rewrites it. -dotnet_diagnostic.SST2283.severity = error # A null guard that throws right before assigning the guarded value can fold into the assignment as `?? throw`. Code fix rewrites it. +dotnet_diagnostic.SST2265.severity = error # Consecutive fluent calls on one receiver can fold into a chain +dotnet_diagnostic.SST2266.severity = error # A local read exactly once can be inlined into that use +dotnet_diagnostic.SST2267.severity = error # Infinite loops written in mixed `while(true)`/`for(;;)` styles. Configurable. +dotnet_diagnostic.SST2268.severity = error # Inconsistent `()` on object creation with an initializer. Configurable. +dotnet_diagnostic.SST2269.severity = error # Inconsistent parentheses around a conditional's condition. Configurable. +dotnet_diagnostic.SST2270.severity = error # Inconsistent explicit-vs-implicit array-creation type. Configurable. +dotnet_diagnostic.SST2271.severity = error # `var`-vs-explicit local type per the configured preference. Configurable. +dotnet_diagnostic.SST2272.severity = error # `[Flags]` member values written as mixed decimals and shifts. Configurable. +dotnet_diagnostic.SST2273.severity = error # A trailing if that could be an early-exit guard clause +dotnet_diagnostic.SST2274.severity = error # An 'as' assignment plus null check is one is-declaration pattern +dotnet_diagnostic.SST2275.severity = error # A method whose block body is a single statement can use => expr +dotnet_diagnostic.SST2276.severity = error # A constructor whose block body is a single statement can use => +dotnet_diagnostic.SST2277.severity = error # An operator whose block body is a single return can use => +dotnet_diagnostic.SST2278.severity = error # A conversion operator whose block body is a single return can use => +dotnet_diagnostic.SST2279.severity = error # A get-only property whose getter is a single return can use => +dotnet_diagnostic.SST2280.severity = error # A get-only indexer whose getter is a single return can use => +dotnet_diagnostic.SST2281.severity = error # A local function whose block body is a single statement can use => +dotnet_diagnostic.SST2282.severity = error # A ReferenceEquals check against null reads as an is null pattern +dotnet_diagnostic.SST2283.severity = error # A null guard before an assignment can fold into it as ?? throw +dotnet_diagnostic.SST2284.severity = error # A statement steps a value by one through a compound assignment +dotnet_diagnostic.SST2285.severity = error # A null guard is conjoined with a member read on the same value +dotnet_diagnostic.SST2286.severity = error # ToString is called on a receiver already typed as string +dotnet_diagnostic.SST2287.severity = error # A while loop owns its counter, so a for header would gather it +dotnet_diagnostic.SST2288.severity = error # A conditional expression has a boolean literal in exactly one branch # Design dotnet_diagnostic.SST2300.severity = error # A class implements IDisposable but builds only half of the disposal pattern dotnet_diagnostic.SST2301.severity = error # A class implementing IEquatable for itself can still be derived from dotnet_diagnostic.SST2302.severity = error # A type overloads an operator without the rest of the set it belongs to dotnet_diagnostic.SST2303.severity = error # A [Flags] enum's members are not distinct bit values -dotnet_diagnostic.SST2304.severity = error # An event's delegate does not have the standard (object sender, TEventArgs e) shape +dotnet_diagnostic.SST2304.severity = error # An event delegate lacks the (object sender, TEventArgs e) shape dotnet_diagnostic.SST2305.severity = error # A mutable collection property declares a caller-visible setter dotnet_diagnostic.SST2306.severity = error # A collection-returning member hands back null -dotnet_diagnostic.SST2307.severity = error # A generic method's type parameter appears in no parameter, so no caller can infer it +dotnet_diagnostic.SST2307.severity = error # A generic method type parameter appears in no parameter and cannot be inferred dotnet_diagnostic.SST2308.severity = error # An [Obsolete] attribute carries no message -dotnet_diagnostic.SST2309.severity = error # An externally visible member declares an optional parameter, so callers bake in the default +dotnet_diagnostic.SST2309.severity = error # An externally visible member declares an optional parameter dotnet_diagnostic.SST2310.severity = error # Deprecated code is still here; remove it once its last caller is gone dotnet_diagnostic.SST2311.severity = error # A visible const is copied into every assembly that reads it dotnet_diagnostic.SST2312.severity = error # A type is declared outside any namespace dotnet_diagnostic.SST2313.severity = error # An enum is stored as a type the project does not allow -dotnet_diagnostic.SST2314.severity = none # An [Obsolete] has a message but no DiagnosticId — unusable here: ObsoleteAttribute.DiagnosticId is .NET 5+, and this source is shared with net462 +dotnet_diagnostic.SST2314.severity = none # [Obsolete] with a message but no DiagnosticId — the property is .NET 5+ only dotnet_diagnostic.SST2315.severity = error # A type owns a disposable field but does not implement IDisposable dotnet_diagnostic.SST2316.severity = error # A type declares Dispose or DisposeAsync without implementing IDisposable dotnet_diagnostic.SST2317.severity = error # A disposable type owns a raw IntPtr without a SafeHandle or finalizer @@ -1648,19 +1650,20 @@ dotnet_diagnostic.SST2319.severity = error # An overload's optional default can dotnet_diagnostic.SST2320.severity = error # An interface inherits two interfaces that declare the same member dotnet_diagnostic.SST2321.severity = error # Environment.Exit or Environment.FailFast is called from library code dotnet_diagnostic.SST2322.severity = error # A non-private readonly field holds a mutable collection callers can still change -dotnet_diagnostic.SST2323.severity = error # A stateless abstract class declaring only public abstract members should be an interface +dotnet_diagnostic.SST2323.severity = error # A stateless abstract class with only public abstract members dotnet_diagnostic.SST2324.severity = error # A member is declared more accessible than its containing type dotnet_diagnostic.SST2325.severity = error # An async method checks an argument after its first await -dotnet_diagnostic.SST2326.severity = none # An interface-typed value is narrowed to a concrete implementation — this is a high-performance core library, not strictly SOLID code, and narrowing to a known runtime type is a normal fast-path technique here: foreach over IEnumerable boxes List's struct enumerator (40 bytes per call, measured) where the indexed loop behind the type test allocates nothing -dotnet_diagnostic.SST2327.severity = error # A type tests its own runtime type against a class instead of dispatching through a virtual member +dotnet_diagnostic.SST2326.severity = none # Interface value narrowed to a concrete type — a deliberate fast path here +dotnet_diagnostic.SST2327.severity = error # A type tests its own runtime type instead of dispatching virtually dotnet_diagnostic.SST2328.severity = error # A raw native pointer handle is exposed instead of a SafeHandle dotnet_diagnostic.SST2329.severity = error # A `[Flags]` enum declares no zero-valued member. Code fix adds `None = 0`. -dotnet_diagnostic.SST2330.severity = error # A `[Flags]` member is a numeric literal equal to a combination of others (`All = 7`). Code fix writes `A -dotnet_diagnostic.SST2331.severity = none # An enum leaves member values implicit, so their numbers depend on declaration order. Opt-in. -dotnet_diagnostic.SST2332.severity = error # An auto-property's `private set` is only written during construction; make it get-only. -dotnet_diagnostic.SST2333.severity = none # A generic comparison/equality contract is implemented without its non-generic counterpart. Opt-in. -dotnet_diagnostic.SST2334.severity = none # A publicly visible type has no `[DebuggerDisplay]`. Opt-in. -dotnet_diagnostic.SST2335.severity = none # Parts of a partial type disagree on the `static` modifier. Opt-in. +dotnet_diagnostic.SST2330.severity = error # A [Flags] member literal equal to a combination of other members +dotnet_diagnostic.SST2331.severity = error # An enum leaves member values implicit, so numbering follows declaration order +dotnet_diagnostic.SST2332.severity = error # An auto-property private set is only written during construction +dotnet_diagnostic.SST2333.severity = error # A generic equality contract lacks its non-generic counterpart +dotnet_diagnostic.SST2334.severity = error # A publicly visible type has no `[DebuggerDisplay]` +dotnet_diagnostic.SST2335.severity = error # Parts of a partial type disagree on the `static` modifier +dotnet_diagnostic.SST2336.severity = error # A concrete attribute type declares no [AttributeUsage] # Correctness dotnet_diagnostic.SST2400.severity = error # Two arguments name each other's parameters and have been transposed @@ -1672,7 +1675,7 @@ dotnet_diagnostic.SST2405.severity = error # A [DebuggerDisplay] string names a dotnet_diagnostic.SST2406.severity = error # A loop's stop condition reads only variables the loop never writes dotnet_diagnostic.SST2407.severity = error # A declared event is never raised dotnet_diagnostic.SST2408.severity = error # A StringBuilder is filled and never read -dotnet_diagnostic.SST2409.severity = error # A throw constructs a general exception type (Exception/SystemException/ApplicationException) +dotnet_diagnostic.SST2409.severity = error # A throw constructs a general exception type dotnet_diagnostic.SST2410.severity = error # A created disposable is never disposed and never leaves the method dotnet_diagnostic.SST2411.severity = error # A for loop declares and tests a counter it never steps dotnet_diagnostic.SST2412.severity = error # A for loop update moves the counter away from its stop condition @@ -1698,40 +1701,46 @@ dotnet_diagnostic.SST2431.severity = error # A ToString override can return null dotnet_diagnostic.SST2432.severity = error # GetType is called on a value that is already a System.Type dotnet_diagnostic.SST2433.severity = error # A caller-info parameter is not last in the list dotnet_diagnostic.SST2434.severity = error # An array is assigned through a covariant element type -dotnet_diagnostic.SST2435.severity = error # A non-object base's value-equality Equals is used as a reference-equality fast path +dotnet_diagnostic.SST2435.severity = error # A non-object base's value Equals used as a reference fast path dotnet_diagnostic.SST2436.severity = error # An event is raised with a null sender or null args dotnet_diagnostic.SST2437.severity = error # A generic type inherits from itself recursively dotnet_diagnostic.SST2438.severity = error # A catch that discards its exception logs at Error or Critical without it -dotnet_diagnostic.SST2439.severity = error # An exception is passed as a log template argument instead of the exception parameter +dotnet_diagnostic.SST2439.severity = error # An exception is passed as a log template argument dotnet_diagnostic.SST2440.severity = error # Log template arguments are transposed dotnet_diagnostic.SST2441.severity = error # A log template has an empty or non-identifier placeholder dotnet_diagnostic.SST2442.severity = error # A log template repeats a named placeholder dotnet_diagnostic.SST2443.severity = error # An ILogger is injected or created with the wrong category type dotnet_diagnostic.SST2444.severity = error # A regular expression pattern is invalid -dotnet_diagnostic.SST2445.severity = error # A culture-sensitive custom date or time format is used without an invariant culture +dotnet_diagnostic.SST2445.severity = error # A culture-sensitive date or time format without an invariant culture dotnet_diagnostic.SST2446.severity = error # A Stream.ReadAsync result is discarded through ConfigureAwait or a local -dotnet_diagnostic.SST2448.severity = error # A combined or opaque delegate is removed with - or -=, which strips only a contiguous run +dotnet_diagnostic.SST2447.severity = error # An integer subtraction is compared against literal zero +dotnet_diagnostic.SST2448.severity = error # A combined delegate removed with -= strips only a contiguous run dotnet_diagnostic.SST2449.severity = error # A lambda or anonymous-method handler is removed with -=, which never matches it -dotnet_diagnostic.SST2450.severity = error # A Debug.Assert condition performs a side effect that a release build compiles out +dotnet_diagnostic.SST2450.severity = error # A Debug.Assert condition performs a side effect dotnet_diagnostic.SST2451.severity = error # Every constructor is private and no member ever creates an instance dotnet_diagnostic.SST2452.severity = error # A [Pure] method returns void, Task, or ValueTask, so it has no observable result +dotnet_diagnostic.SST2453.severity = error # A ?? whose right operand is a constant null substitutes null for null +dotnet_diagnostic.SST2454.severity = error # The result of an 'as' conversion is dereferenced with no null check +dotnet_diagnostic.SST2455.severity = error # Two enum members hold the same number without saying so dotnet_diagnostic.SST2456.severity = error # An override or new field-like event gets its own backing delegate field dotnet_diagnostic.SST2457.severity = error # An integer Sum wrapped in unchecked still throws on overflow dotnet_diagnostic.SST2458.severity = error # A bitwise operator is applied to an enum not declared [Flags] dotnet_diagnostic.SST2459.severity = error # [Optional] on a ref or out parameter advertises an optionality no caller can use dotnet_diagnostic.SST2460.severity = error # [DefaultValue] on a method or record parameter is inert +dotnet_diagnostic.SST2461.severity = error # A [Flags] member sets a bit that no member of the enum declares dotnet_diagnostic.SST2462.severity = error # A new member is less accessible than the inherited member it hides dotnet_diagnostic.SST2463.severity = error # A field differs from an inherited accessible field only by case -dotnet_diagnostic.SST2464.severity = error # A mutable class declares a value-equality operator ==, so it is lost as a hash key +dotnet_diagnostic.SST2464.severity = error # A mutable class declares value-equality ==, so it is lost as a hash key dotnet_diagnostic.SST2465.severity = error # A for loop body reassigns the counter or the local its condition tests -dotnet_diagnostic.SST2467.severity = error # A params overload is shadowed by a same-arity overload with a more specific last parameter -dotnet_diagnostic.SST2468.severity = error # A classic partial method is declared but never implemented, so its calls are removed -dotnet_diagnostic.SST2470.severity = error # Two string literals concatenate with no space, fusing a SQL keyword into the next token +dotnet_diagnostic.SST2466.severity = error # A finally clause contains no statements +dotnet_diagnostic.SST2467.severity = error # A params overload is shadowed by a same-arity overload +dotnet_diagnostic.SST2468.severity = error # A classic partial method is declared but never implemented +dotnet_diagnostic.SST2470.severity = error # Two string literals concatenate with no space, fusing keywords dotnet_diagnostic.SST2472.severity = error # A type is exported for a contract it neither implements nor inherits dotnet_diagnostic.SST2473.severity = error # A shared export part is constructed with new, bypassing the container dotnet_diagnostic.SST2474.severity = error # A part-creation-policy attribute is applied to a type with no [Export] dotnet_diagnostic.SST2475.severity = error # An entity's primary key is typed DateTime or DateTimeOffset -dotnet_diagnostic.SST2479.severity = error # A loop variable captured by a callback stored beyond the iteration reads its final value +dotnet_diagnostic.SST2479.severity = error # A loop variable captured beyond the iteration reads its final value dotnet_diagnostic.SST2481.severity = error # A GetHashCode override folds the base identity hash into a value hash dotnet_diagnostic.SST2484.severity = error # A handle read through DangerousGetHandle is not reference-counted dotnet_diagnostic.SST2485.severity = error # A NotImplementedException is left in shipped code @@ -1740,17 +1749,19 @@ dotnet_diagnostic.SST2487.severity = error # A [ConstructorArgument] does not na dotnet_diagnostic.SST2488.severity = error # An exception is logged and rethrown, duplicating the record dotnet_diagnostic.SST2489.severity = error # A relational comparison is decided by the operand's type rather than its value dotnet_diagnostic.SST2490.severity = error # Adjacent try statements with identical handling should be merged -dotnet_diagnostic.SST2491.severity = error # A non-`async` method returns an awaitable from inside `using`/`try-finally`/`lock`, so the resource is torn down before the task completes. Code fix makes it `async`. +dotnet_diagnostic.SST2491.severity = error # A non-async method returns an awaitable from inside using or lock dotnet_diagnostic.SST2492.severity = error # A null-guard throws on a parameter the signature declares may be null. -dotnet_diagnostic.SST2493.severity = error # `== null`/`!= null` on an unconstrained generic `T`. Code fix uses `is null`/`is not null`. -dotnet_diagnostic.SST2494.severity = error # A `??` whose left operand is a constant null, so the right is always taken. Code fix folds it. -dotnet_diagnostic.SST2495.severity = error # A `[Flags]` combination includes an operand whose bits another already covers. Code fix removes it. -dotnet_diagnostic.SST2496.severity = error # An explicit `Dispose`/`Close` on a resource an enclosing `using` already disposes. Code fix removes it. Info. +dotnet_diagnostic.SST2493.severity = error # == null or != null on an unconstrained generic T +dotnet_diagnostic.SST2494.severity = error # A ?? whose left operand is a constant null +dotnet_diagnostic.SST2495.severity = error # A [Flags] combination includes bits another operand already covers +dotnet_diagnostic.SST2496.severity = error # An explicit Dispose/Close an enclosing using already performs +dotnet_diagnostic.SST2497.severity = error # A member forwards to itself, so calling it recurses until the stack is gone +dotnet_diagnostic.SST2498.severity = error # nameof on a type parameter is the constant "T" # Testing dotnet_diagnostic.SST2500.severity = error # A test method contains no assertion and no expected-exception check dotnet_diagnostic.SST2501.severity = error # An equality or identity assertion compares an expression with itself -dotnet_diagnostic.SST2502.severity = error # An equality assertion passes the constant as actual and the computed value as expected +dotnet_diagnostic.SST2502.severity = error # An equality assertion has expected and actual transposed dotnet_diagnostic.SST2503.severity = error # An equality assertion compares a value against a boolean literal dotnet_diagnostic.SST2504.severity = error # A test fixture declares and inherits no test method dotnet_diagnostic.SST2505.severity = error # A test method declares parameters but no data source @@ -1760,24 +1771,24 @@ dotnet_diagnostic.SST2508.severity = error # A fluent assertion is started but n dotnet_diagnostic.SST2509.severity = error # A test method has a shape the runner cannot execute # Logging -dotnet_diagnostic.SST2600.severity = error # Application output is written through legacy Trace instead of a structured logger +dotnet_diagnostic.SST2600.severity = error # Output written through legacy Trace instead of a structured logger dotnet_diagnostic.SST2601.severity = error # A logger field or property does not follow the logger naming convention # Frameworks -dotnet_diagnostic.SST2700.severity = error # An MVC route template contains a backslash; route segments are separated by `/`, so the route is unreachable. Code fix replaces `\` with `/`. -dotnet_diagnostic.SST2701.severity = error # A `[JSInvokable]` method is not public, so JavaScript interop cannot call it. Code fix makes it public. -dotnet_diagnostic.SST2702.severity = error # A `[SupplyParameterFromQuery]` property has a type the framework cannot bind from the query string, which throws at runtime. -dotnet_diagnostic.SST2703.severity = error # A routable component's route constraint (`{id:int}`) disagrees with the matching `[Parameter]` CLR type, so the route silently fails to match. -dotnet_diagnostic.SST2704.severity = error # A public action on an `[ApiController]` declares no HTTP-verb attribute, so it answers every verb and can make routing ambiguous. -dotnet_diagnostic.SST2705.severity = none # A bound model member is a non-nullable value type with no required marker, so a request that omits it binds the default with no error. Opt-in. -dotnet_diagnostic.SST2706.severity = error # A Windows Forms entry point carries neither `[STAThread]` nor `[MTAThread]`; without STA, clipboard, drag-and-drop, and common dialogs misbehave. Code fix adds `[STAThread]`. -dotnet_diagnostic.SST2707.severity = none # A fire-and-forget `Task.Run` in a controller captures the request's `HttpContext`, which is disposed when the request ends, so the background work throws `ObjectDisposedException`. Opt-in. -dotnet_diagnostic.SST2708.severity = error # A component subscribes to an event in a lifecycle method but never unsubscribes, so the event source keeps the component alive — a per-session leak on a Server circuit. -dotnet_diagnostic.SST2709.severity = error # `StateHasChanged` is called while the component is being disposed, which the renderer no longer supports and throws. -dotnet_diagnostic.SST2710.severity = error # `StateHasChanged` is called directly from a timer callback, off the renderer's dispatcher; marshal it with `InvokeAsync(StateHasChanged)`. -dotnet_diagnostic.SST2711.severity = error # A synchronous component lifecycle method is overridden as `async void`, which the framework never awaits; override the `…Async` twin returning `Task`. Code fix rewrites the signature. -dotnet_diagnostic.SST2712.severity = error # An `[Inject]`/`[CascadingParameter]` property has no setter, so the framework's reflection-based binding leaves it null. Code fix adds a setter. -dotnet_diagnostic.SST2713.severity = error # A `DotNetObjectReference.Create(this)` is passed inline and never stored, so nothing can dispose it and it leaks on the JavaScript side. +dotnet_diagnostic.SST2700.severity = error # An MVC route template contains a backslash, so the route is unreachable +dotnet_diagnostic.SST2701.severity = error # A [JSInvokable] method is not public, so interop cannot call it +dotnet_diagnostic.SST2702.severity = error # A [SupplyParameterFromQuery] property cannot bind from the query string +dotnet_diagnostic.SST2703.severity = error # A route constraint disagrees with the matching [Parameter] CLR type +dotnet_diagnostic.SST2704.severity = error # An [ApiController] action declares no HTTP-verb attribute +dotnet_diagnostic.SST2705.severity = error # A bound model member is a non-nullable value type with no required marker +dotnet_diagnostic.SST2706.severity = error # A Windows Forms entry point carries neither [STAThread] nor [MTAThread] +dotnet_diagnostic.SST2707.severity = error # A fire-and-forget Task.Run in a controller captures the request HttpContext +dotnet_diagnostic.SST2708.severity = error # A component subscribes to an event and never unsubscribes +dotnet_diagnostic.SST2709.severity = error # StateHasChanged is called while the component is being disposed +dotnet_diagnostic.SST2710.severity = error # StateHasChanged is called from a timer callback, off the dispatcher +dotnet_diagnostic.SST2711.severity = error # A component lifecycle method is overridden as async void +dotnet_diagnostic.SST2712.severity = error # An [Inject] or [CascadingParameter] property has no setter +dotnet_diagnostic.SST2713.severity = error # A DotNetObjectReference.Create(this) is passed inline and never stored ################### # PerformanceSharp Analyzers (PSH) @@ -1787,13 +1798,13 @@ performancesharp.avoid_linq_on_hot_path = true # performancesharp.excluded_properties = Items, Keys # PSH1017 (comma-separated; properties allowed to copy on read) # performancesharp.include_public = false # PSH1411 (set true in an app to seal public types too; a break in a library) dotnet_diagnostic.PSH1000.severity = error # Anonymous functions without captures should be static -dotnet_diagnostic.PSH1001.severity = error # Avoid allocating zero-length arrays (fix prefers [] on C# 12+, else Array.Empty()) +dotnet_diagnostic.PSH1001.severity = error # Avoid allocating zero-length arrays dotnet_diagnostic.PSH1002.severity = error # Empty finalizers should be removed dotnet_diagnostic.PSH1003.severity = error # 'in' parameters should use readonly structs dotnet_diagnostic.PSH1004.severity = error # Constant arrays passed as arguments should be hoisted dotnet_diagnostic.PSH1005.severity = error # Structs should define equality members to avoid boxing comparisons dotnet_diagnostic.PSH1006.severity = error # ConcurrentDictionary factories should use the lambda argument -dotnet_diagnostic.PSH1007.severity = error # Pass large readonly structs by 'in' reference (size threshold + exclusions configurable) +dotnet_diagnostic.PSH1007.severity = error # Pass large readonly structs by 'in' reference dotnet_diagnostic.PSH1008.severity = error # GC.SuppressFinalize does nothing for sealed finalizer-free types dotnet_diagnostic.PSH1009.severity = error # Bound variable-length stackalloc with a constant guard dotnet_diagnostic.PSH1010.severity = error # Clear reference-typed arrays when returning them to the pool @@ -1803,15 +1814,16 @@ dotnet_diagnostic.PSH1013.severity = error # Expose constant UTF-8 data as a Rea dotnet_diagnostic.PSH1014.severity = error # Declare immutable structs as readonly dotnet_diagnostic.PSH1015.severity = error # Avoid casting value types through object dotnet_diagnostic.PSH1016.severity = error # Test enum flags with bitwise operators instead of Enum.HasFlag -dotnet_diagnostic.PSH1017.severity = error # A property allocates a copy of a collection on every read (excludable via performancesharp.PSH1017.excluded_properties) +dotnet_diagnostic.PSH1017.severity = error # A property allocates a copy of a collection on every read dotnet_diagnostic.PSH1018.severity = error # A hand-written array is passed to a params parameter dotnet_diagnostic.PSH1019.severity = error # The range indexer on an array allocates a copy; slice with AsSpan/AsMemory dotnet_diagnostic.PSH1020.severity = error # Prefer a jagged array over a multidimensional one -dotnet_diagnostic.PSH1021.severity = error # An explicit GC.Collect or GC.WaitForPendingFinalizers forces collection the runtime tunes itself -dotnet_diagnostic.PSH1022.severity = error # A parameterless `new EventArgs()` allocates where the shared `EventArgs.Empty` singleton would serve. Code fix uses the singleton. +dotnet_diagnostic.PSH1021.severity = error # An explicit GC.Collect forces collection the runtime tunes itself +dotnet_diagnostic.PSH1022.severity = error # A parameterless new EventArgs() where EventArgs.Empty would serve +dotnet_diagnostic.PSH1023.severity = error # A local anonymous type allocates where a tuple would not dotnet_diagnostic.PSH1100.severity = error # Hot-path code should avoid System.Linq.Enumerable calls -dotnet_diagnostic.PSH1101.severity = none # LINQ terminal predicate simplification is reserved for test code; production code should avoid LINQ on hot paths -dotnet_diagnostic.PSH1102.severity = none # LINQ type-filter simplification is reserved for test code; production code should avoid LINQ on hot paths +dotnet_diagnostic.PSH1101.severity = none # LINQ predicate simplification — production code avoids LINQ on hot paths +dotnet_diagnostic.PSH1102.severity = none # LINQ type-filter simplification — production code avoids LINQ on hot paths dotnet_diagnostic.PSH1103.severity = error # Prefer the collection's own count over enumerating dotnet_diagnostic.PSH1104.severity = error # Use TryGetValue instead of ContainsKey followed by an indexer read dotnet_diagnostic.PSH1105.severity = error # Avoid double lookups on dictionaries and sets @@ -1821,9 +1833,9 @@ dotnet_diagnostic.PSH1108.severity = error # Chain secondary sorts with ThenBy dotnet_diagnostic.PSH1109.severity = error # Merge consecutive Where calls dotnet_diagnostic.PSH1110.severity = error # Use the collection's own predicate methods over LINQ dotnet_diagnostic.PSH1111.severity = error # Use Contains for membership tests -dotnet_diagnostic.PSH1112.severity = error # Seed the collection through its constructor (fix honors performancesharp.prefer_collection_expressions) +dotnet_diagnostic.PSH1112.severity = error # Seed the collection through its constructor dotnet_diagnostic.PSH1113.severity = error # Sort naturally instead of ordering by the element itself -dotnet_diagnostic.PSH1114.severity = none # Freeze static lookup collections that are never mutated. Opt-in. +dotnet_diagnostic.PSH1114.severity = error # Freeze static lookup collections that are never mutated dotnet_diagnostic.PSH1115.severity = error # Insert-if-absent should probe the dictionary once dotnet_diagnostic.PSH1116.severity = error # Probe string-keyed collections with a span through GetAlternateLookup dotnet_diagnostic.PSH1117.severity = error # Ask the collection whether it is empty @@ -1861,18 +1873,18 @@ dotnet_diagnostic.PSH1222.severity = error # Concatenate slices without material dotnet_diagnostic.PSH1223.severity = error # A reused composite format string is re-parsed on every call dotnet_diagnostic.PSH1224.severity = error # Convert bytes to hex in one call, not by building the string twice dotnet_diagnostic.PSH1225.severity = error # Decode bytes to a string in one call, without a throwaway char[] -dotnet_diagnostic.PSH1226.severity = error # A string's `ToCharArray()` result is only iterated, allocating a throwaway `char[]`; iterate the string directly. Code fix drops the copy. -dotnet_diagnostic.PSH1227.severity = error # A cheaper equivalent exists — `string.CompareOrdinal` over `Compare(…, Ordinal)`, `Debug.Fail` over `Debug.Assert(false, …)`. Info. Code fix rewrites the call. +dotnet_diagnostic.PSH1226.severity = error # A string's ToCharArray() result is only iterated +dotnet_diagnostic.PSH1227.severity = error # A cheaper equivalent exists, such as string.CompareOrdinal or Debug.Fail dotnet_diagnostic.PSH1300.severity = error # Use System.Threading.Lock for a dedicated lock object dotnet_diagnostic.PSH1301.severity = error # Do not wrap a single task in WhenAll or WaitAll dotnet_diagnostic.PSH1302.severity = error # TaskCompletionSource should run continuations asynchronously dotnet_diagnostic.PSH1303.severity = error # Do not block an async method with Thread.Sleep dotnet_diagnostic.PSH1304.severity = error # Use PeriodicTimer instead of pacing a loop with Task.Delay dotnet_diagnostic.PSH1305.severity = error # Enumerate a ConcurrentDictionary directly, not its Keys/Values snapshots -dotnet_diagnostic.PSH1306.severity = none # Guard one-time execution with an interlocked latch. Opt-in. +dotnet_diagnostic.PSH1306.severity = error # Guard one-time execution with an interlocked latch dotnet_diagnostic.PSH1307.severity = error # Access interlocked fields with Volatile dotnet_diagnostic.PSH1308.severity = error # Return the completed task instead of Task.FromResult -dotnet_diagnostic.PSH1309.severity = none # Register cancellation callbacks without flowing the execution context. Opt-in. +dotnet_diagnostic.PSH1309.severity = error # Register cancellation callbacks without flowing the execution context dotnet_diagnostic.PSH1310.severity = error # Dispose IAsyncDisposable resources with await using in async code dotnet_diagnostic.PSH1311.severity = error # Remove a pass-through async state machine and return the task directly dotnet_diagnostic.PSH1312.severity = error # Return a completed task instead of null @@ -1890,7 +1902,7 @@ dotnet_diagnostic.PSH1406.severity = error # Ask Regex for the answer directly dotnet_diagnostic.PSH1407.severity = error # Query the dictionary, not its Keys view dotnet_diagnostic.PSH1408.severity = error # Measure elapsed time with Stopwatch timestamps dotnet_diagnostic.PSH1409.severity = error # Use the built-in throw helpers for argument guards -dotnet_diagnostic.PSH1410.severity = none # Mark trivial forwarders for aggressive inlining. Opt-in. +dotnet_diagnostic.PSH1410.severity = error # Mark trivial forwarders for aggressive inlining dotnet_diagnostic.PSH1411.severity = error # Seal non-public types nothing derives from so the JIT can devirtualize dotnet_diagnostic.PSH1412.severity = error # Use Random.Shared instead of allocating a Random dotnet_diagnostic.PSH1413.severity = error # Read the Unix epoch from the framework, not a hand-built DateTime @@ -1899,29 +1911,28 @@ dotnet_diagnostic.PSH1415.severity = error # Hold the concrete type when the con dotnet_diagnostic.PSH1416.severity = error # Cache the serializer options instead of building them per call dotnet_diagnostic.PSH1417.severity = error # Do not compute an expensive argument for an assertion dotnet_diagnostic.PSH1418.severity = error # An HttpClient is constructed on every call -dotnet_diagnostic.PSH1419.severity = error # A time-zone is resolved with a platform-specific id instead of the cross-platform API -dotnet_diagnostic.PSH1420.severity = error # A shareable client held in an instance field of an Azure Functions worker class is rebuilt on every invocation, leaking sockets and connections; share a static/singleton client or inject `IHttpClientFactory`. +dotnet_diagnostic.PSH1419.severity = error # A time zone is resolved with a platform-specific id +dotnet_diagnostic.PSH1420.severity = error # A shareable client is rebuilt on every Azure Functions invocation +dotnet_diagnostic.PSH1421.severity = error # A static Regex method is called from inside a loop body -# ASP.NET Core - inert in this repo (no route handlers or middleware), enabled so the set stays complete +# ASP.NET Core — inert here, enabled so the set stays complete dotnet_diagnostic.PSH1500.severity = error # A minimal API handler returns Results instead of TypedResults, boxing the result -dotnet_diagnostic.PSH1501.severity = error # Middleware uses the legacy nested-delegate Use overload, allocating a per-request closure -dotnet_diagnostic.PSH1502.severity = error # A route handler returns a deferred sequence the serializer enumerates on the request thread +dotnet_diagnostic.PSH1501.severity = error # Middleware uses the legacy nested-delegate Use overload +dotnet_diagnostic.PSH1502.severity = error # A route handler returns a sequence serialized on the request thread dotnet_diagnostic.PSH1503.severity = error # Response caching is used where server-side output caching applies -dotnet_diagnostic.PSH1505.severity = error # Exceptions are handled in an MVC exception filter instead of an IExceptionHandler -dotnet_diagnostic.PSH1506.severity = error # The HTTP request or response body is read or written synchronously (`ReadToEnd`, `Body.Read`, `Body.Write`), which blocks a thread on Kestrel and buffers the whole payload; use the async overload. Code fix awaits it when the method is already async. +dotnet_diagnostic.PSH1505.severity = error # Exceptions handled in an MVC filter instead of an IExceptionHandler +dotnet_diagnostic.PSH1506.severity = error # The HTTP request or response body is read or written synchronously # Blazor -dotnet_diagnostic.PSH1600.severity = error # A delegate captured per iteration inside a component render loop reallocates on every render (measured ~128 B per row per render) and churns the diff; hoist it to a cached delegate or a precomputed per-item model. -dotnet_diagnostic.PSH1601.severity = error # A JavaScript-interop call is issued once per loop iteration; on Interactive Server each is a separate SignalR round-trip. Batch into a single call over the collection. -dotnet_diagnostic.PSH1602.severity = error # `StateHasChanged` is called unconditionally in `OnAfterRender`/`OnAfterRenderAsync`, scheduling another render every time — a runaway loop. Guard it with `firstRender` or a state flag. -dotnet_diagnostic.PSH1603.severity = error # A non-delegate allocation is used as a component-parameter value inside a render loop, allocating per item and forcing the child to re-render each pass. Sibling of PSH1600. +dotnet_diagnostic.PSH1600.severity = error # A delegate captured per iteration in a render loop reallocates every render +dotnet_diagnostic.PSH1601.severity = error # A JavaScript-interop call is issued once per loop iteration +dotnet_diagnostic.PSH1602.severity = error # StateHasChanged is called unconditionally in OnAfterRender +dotnet_diagnostic.PSH1603.severity = error # A non-delegate allocation is a component parameter in a render loop ################### # SecuritySharp Analyzers (SES) ################### -# Every rule is raised to error, including the three that ship at suggestion (SES1403, SES1506, -# SES1605). Security rules only ever suggest an API they can resolve in the compilation and report -# local shapes only - there is no interprocedural taint tracking, so the taint-flow CA rules stay on. +# Every rule is error; these report local shapes only, so the taint-flow CA rules stay on. # securitysharp.SES1003.iterations = 100000 # minimum accepted PBKDF2 iteration count # securitysharp.SES1403.maxdepth = 64 # highest accepted System.Text.Json MaxDepth @@ -1931,18 +1942,18 @@ dotnet_diagnostic.SES1002.severity = error # Password-based key derivation must dotnet_diagnostic.SES1003.severity = error # Password-based key derivation must use a sufficient iteration count dotnet_diagnostic.SES1004.severity = error # A secret must not be produced from Guid.NewGuid() dotnet_diagnostic.SES1005.severity = error # Compare secret values in constant time -dotnet_diagnostic.SES1006.severity = error # A Data Protection key ring is persisted without a ProtectKeysWith call, so keys sit unencrypted at rest -dotnet_diagnostic.SES1007.severity = error # A cryptographic primitive is implemented by hand instead of using a vetted platform algorithm -dotnet_diagnostic.SES1008.severity = error # An XML signature is verified with the no-key CheckSignature overload, trusting the document's own KeyInfo +dotnet_diagnostic.SES1006.severity = error # A Data Protection key ring is persisted without ProtectKeysWith +dotnet_diagnostic.SES1007.severity = error # A cryptographic primitive is implemented by hand +dotnet_diagnostic.SES1008.severity = error # An XML signature is verified with the no-key CheckSignature overload dotnet_diagnostic.SES1009.severity = error # A password is stored without a slow, salted key-derivation function # Transport dotnet_diagnostic.SES1102.severity = error # Do not accept any server certificate dotnet_diagnostic.SES1104.severity = error # Certificate-chain validation must not be deliberately weakened -dotnet_diagnostic.SES1105.severity = error # Bearer and OpenID Connect metadata must not be retrieved over plain HTTP outside development +dotnet_diagnostic.SES1105.severity = error # Bearer or OpenID Connect metadata is retrieved over plain HTTP dotnet_diagnostic.SES1106.severity = error # Do not send HttpClient requests to a cleartext http URL -dotnet_diagnostic.SES1107.severity = error # A SQL connection string weakens transport security via TrustServerCertificate or a disabled Encrypt -dotnet_diagnostic.SES1108.severity = error # A custom server-certificate validation callback unconditionally returns true, so any certificate is trusted +dotnet_diagnostic.SES1107.severity = error # A SQL connection string weakens transport security +dotnet_diagnostic.SES1108.severity = error # A certificate validation callback unconditionally returns true # Secrets dotnet_diagnostic.SES1201.severity = error # Do not hard-code secrets in source @@ -1966,8 +1977,8 @@ dotnet_diagnostic.SES1401.severity = error # A type resolved from non-constant d dotnet_diagnostic.SES1402.severity = error # Do not load an assembly from raw bytes or a non-constant location dotnet_diagnostic.SES1403.severity = error # JSON deserialization depth limit must stay within a safe ceiling dotnet_diagnostic.SES1404.severity = error # A type is instantiated by name from a non-constant Activator typeName -dotnet_diagnostic.SES1405.severity = error # MessagePack typeless deserialization reconstructs whatever type the payload names -dotnet_diagnostic.SES1406.severity = warning # Reflection must not reach non-public members via BindingFlags.NonPublic (opt-in; replaces S3011) +dotnet_diagnostic.SES1405.severity = error # MessagePack typeless deserialization reconstructs the named type +dotnet_diagnostic.SES1406.severity = error # Reflection must not reach non-public members via BindingFlags.NonPublic # Web hardening dotnet_diagnostic.SES1501.severity = error # A CORS policy must not allow credentials together with any origin @@ -1978,10 +1989,10 @@ dotnet_diagnostic.SES1505.severity = error # The request body size limit must no dotnet_diagnostic.SES1506.severity = error # The developer exception page must be guarded by a development-environment check dotnet_diagnostic.SES1507.severity = error # AllowAnonymous and Authorize on the same declaration conflict dotnet_diagnostic.SES1508.severity = error # A validation method must not fail open by returning success from a catch -dotnet_diagnostic.SES1509.severity = error # A backtracking-prone constant regex runs without a match timeout or NonBacktracking +dotnet_diagnostic.SES1509.severity = error # A backtracking-prone regex runs without a match timeout dotnet_diagnostic.SES1510.severity = error # A controller redirects to a non-constant URL, allowing an open redirect -dotnet_diagnostic.SES1511.severity = error # The forwarded-headers trust boundary is cleared, letting proxies spoof the client IP -dotnet_diagnostic.SES1512.severity = error # Sensitive framework diagnostics are enabled without a development-environment guard +dotnet_diagnostic.SES1511.severity = error # The forwarded-headers trust boundary is cleared +dotnet_diagnostic.SES1512.severity = error # Sensitive diagnostics are enabled without an environment guard dotnet_diagnostic.SES1513.severity = error # An AuthorizeAsync result is discarded, so the guarded operation runs regardless dotnet_diagnostic.SES1514.severity = error # OpenID Connect protections (PKCE, state, nonce) are disabled dotnet_diagnostic.SES1515.severity = error # A Content-Security-Policy value disables its own protection @@ -1989,37 +2000,39 @@ dotnet_diagnostic.SES1515.severity = error # A Content-Security-Policy value dis # AI trust boundaries dotnet_diagnostic.SES1601.severity = error # An LLM system prompt must be a constant, trusted template dotnet_diagnostic.SES1602.severity = error # Do not route AI model output into a process, file, or raw SQL sink -dotnet_diagnostic.SES1603.severity = error # An AI tool declared read-only or non-destructive must not call a state-changing API +dotnet_diagnostic.SES1603.severity = error # A read-only AI tool calls a state-changing API dotnet_diagnostic.SES1604.severity = error # Prompt-template input encoding must not be disabled dotnet_diagnostic.SES1605.severity = error # AI instrumentation must not enable sensitive-data capture dotnet_diagnostic.SES1606.severity = error # Do not fetch model weights over cleartext HTTP # Web UI trust boundaries -dotnet_diagnostic.SES1701.severity = error # Raw HTML is rendered from a non-constant value (`MarkupString`/`AddMarkupContent`), bypassing automatic encoding — an XSS risk. Sanitizer allow-list via `securitysharp.SES1701.sanitizers`. -dotnet_diagnostic.SES1702.severity = error # A JavaScript-interop call targets a script-evaluation primitive (`eval`, `Function`, `document.write`), turning interop into a script-injection channel. -dotnet_diagnostic.SES1703.severity = error # `[Authorize]` on a non-routable component enforces nothing — authorization runs as a routing concern. Exempt types via `securitysharp.SES1703.exempt_types`. -dotnet_diagnostic.SES1704.severity = error # `IHttpContextAccessor` or a cascading `HttpContext` is used in an interactively-rendered component, where it is null or frozen at circuit start. -dotnet_diagnostic.SES1705.severity = error # `NavigationManager.NavigateTo` is called with a target that is not a verified relative URL — an open-redirect risk. Validator allow-list via `securitysharp.SES1705.validators`. -dotnet_diagnostic.SES1706.severity = error # An uploaded file is read with an unbounded or client-chosen size limit, letting an attacker fill server memory. Threshold via `securitysharp.SES1706.max_bytes`. -dotnet_diagnostic.SES1707.severity = error # A secret-shaped literal appears in code reachable as WebAssembly, which downloads to the browser in full — guaranteed disclosure. -dotnet_diagnostic.SES1708.severity = error # `CircuitOptions.DetailedErrors` is enabled, shipping server exception detail to every connected client. -dotnet_diagnostic.SES1709.severity = error # `SerializeAllClaims` serializes every claim into client-readable WebAssembly authentication state, exposing internal ids, tokens, and PII. -dotnet_diagnostic.SES1710.severity = error # Antiforgery validation is disabled on a form (`[RequireAntiforgeryToken(required: false)]`), removing CSRF protection. +dotnet_diagnostic.SES1701.severity = error # Raw HTML is rendered from a non-constant value — an XSS risk +dotnet_diagnostic.SES1702.severity = error # A JavaScript-interop call targets a script-evaluation primitive +dotnet_diagnostic.SES1703.severity = error # [Authorize] on a non-routable component enforces nothing +dotnet_diagnostic.SES1704.severity = error # HttpContext is used in an interactively-rendered component +dotnet_diagnostic.SES1705.severity = error # NavigateTo is called with an unverified target — open-redirect risk +dotnet_diagnostic.SES1706.severity = error # An uploaded file is read with an unbounded or client-chosen size limit +dotnet_diagnostic.SES1707.severity = error # A secret-shaped literal sits in code that downloads to the browser +dotnet_diagnostic.SES1708.severity = error # CircuitOptions.DetailedErrors ships exception detail to clients +dotnet_diagnostic.SES1709.severity = error # SerializeAllClaims exposes every claim to the client +dotnet_diagnostic.SES1710.severity = error # Antiforgery validation is disabled on a form ################### -# Microsoft.CodeAnalysis.PublicApiAnalyzers (RS) +# Public API surface tracking (PAS) ################### -# Public API surface tracking -dotnet_diagnostic.RS0016.severity = error # public symbol missing from the PublicAPI baseline -dotnet_diagnostic.RS0017.severity = error # PublicAPI baseline entry no longer in source +dotnet_diagnostic.PAS0001.severity = error # A public symbol is missing from the baseline for this target framework +dotnet_diagnostic.PAS0002.severity = error # A baseline entry no longer exists in the public API +dotnet_diagnostic.PAS0003.severity = error # A public symbol differs from its baseline entry +dotnet_diagnostic.PAS0004.severity = error # No public API baseline for this target framework +dotnet_diagnostic.PAS0005.severity = error # The public API baseline could not be read ################### # Microsoft.NET.ILLink.Analyzers (IL) ################### # Trimming # See: https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trim-warnings/ -dotnet_diagnostic.IL2001.severity = error # Type in UnreferencedCode attribute doesn't have matching RequiresUnreferencedCode +dotnet_diagnostic.IL2001.severity = error # Type in UnreferencedCode attribute lacks RequiresUnreferencedCode dotnet_diagnostic.IL2002.severity = error # Method with RequiresUnreferencedCode called from code without that attribute dotnet_diagnostic.IL2003.severity = error # RequiresUnreferencedCode attribute is only supported on methods dotnet_diagnostic.IL2004.severity = error # Incorrect RequiresUnreferencedCode signature @@ -2037,8 +2050,8 @@ dotnet_diagnostic.IL2016.severity = error # Could not find type from substitutio dotnet_diagnostic.IL2017.severity = error # Could not find method in type specified in substitution XML dotnet_diagnostic.IL2018.severity = error # Could not find field in type specified in substitution XML dotnet_diagnostic.IL2019.severity = error # Could not find interface implementation in type -dotnet_diagnostic.IL2022.severity = error # Type in DynamicallyAccessedMembers attribute doesn't have matching DynamicallyAccessedMembers annotation -dotnet_diagnostic.IL2023.severity = error # Method returning DynamicallyAccessedMembers annotated type requires the same annotation +dotnet_diagnostic.IL2022.severity = error # Type in DynamicallyAccessedMembers attribute lacks a matching annotation +dotnet_diagnostic.IL2023.severity = error # Method returning an annotated type requires the same annotation dotnet_diagnostic.IL2024.severity = error # Multiple DynamicallyAccessedMembers annotations on a member are not supported dotnet_diagnostic.IL2025.severity = error # Duplicate preserve attribute dotnet_diagnostic.IL2026.severity = error # Using member annotated with RequiresUnreferencedCode @@ -2049,15 +2062,15 @@ dotnet_diagnostic.IL2030.severity = error # Dynamic invocation of method requiri dotnet_diagnostic.IL2031.severity = error # Could not resolve dependency assembly from embedded resource dotnet_diagnostic.IL2032.severity = error # Error reading debug symbols dotnet_diagnostic.IL2033.severity = error # Trying to modify a sealed type -dotnet_diagnostic.IL2034.severity = error # Value passed to the implicit 'this' parameter does not satisfy 'DynamicallyAccessedMembersAttribute' requirements -dotnet_diagnostic.IL2035.severity = error # Unrecognized value passed to the parameter of method with 'DynamicallyAccessedMembersAttribute' requirements -dotnet_diagnostic.IL2036.severity = error # Interface implementation has different DynamicallyAccessedMembers annotations than interface +dotnet_diagnostic.IL2034.severity = error # Value passed to implicit 'this' fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2035.severity = error # Unrecognized value passed to an annotated parameter +dotnet_diagnostic.IL2036.severity = error # Interface implementation annotations differ from the interface dotnet_diagnostic.IL2037.severity = error # BaseType annotation doesn't match dotnet_diagnostic.IL2038.severity = error # Derived type doesn't have matching DynamicallyAccessedMembers annotation -dotnet_diagnostic.IL2039.severity = error # Implementation method doesn't have matching DynamicallyAccessedMembers annotation +dotnet_diagnostic.IL2039.severity = error # Implementation method lacks a matching DynamicallyAccessedMembers annotation dotnet_diagnostic.IL2040.severity = error # Interface member doesn't have matching DynamicallyAccessedMembers annotation dotnet_diagnostic.IL2041.severity = error # GetType call on DynamicallyAccessedMembers annotated generic parameter -dotnet_diagnostic.IL2042.severity = error # The DynamicallyAccessedMembersAttribute value used in a custom attribute is not compatible +dotnet_diagnostic.IL2042.severity = error # DynamicallyAccessedMembers value in a custom attribute is incompatible dotnet_diagnostic.IL2043.severity = error # DynamicallyAccessedMembersAttribute on property conflicts with base property dotnet_diagnostic.IL2044.severity = error # DynamicallyAccessedMembersAttribute on event conflicts with base event dotnet_diagnostic.IL2045.severity = error # Field type doesn't satisfy 'DynamicallyAccessedMembersAttribute' requirements @@ -2068,71 +2081,71 @@ dotnet_diagnostic.IL2050.severity = error # Correctness of COM interop cannot be dotnet_diagnostic.IL2051.severity = error # COM related type is trimmed dotnet_diagnostic.IL2052.severity = error # Resolving member reference for P/Invoke into type that is trimmed dotnet_diagnostic.IL2053.severity = error # Target method is trimmed -dotnet_diagnostic.IL2054.severity = error # Generic constraint type is annotated with DynamicallyAccessedMembersAttribute which requires unreferenced code +dotnet_diagnostic.IL2054.severity = error # Generic constraint type annotation requires unreferenced code dotnet_diagnostic.IL2055.severity = error # Type implements COM visible type but has no GUID -dotnet_diagnostic.IL2056.severity = error # Generic parameter with DynamicallyAccessedMembers annotation is not publicly visible -dotnet_diagnostic.IL2057.severity = error # Unrecognized value passed to the parameter of method with DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2058.severity = error # Parameter types of method doesn't have matching DynamicallyAccessedMembers annotation +dotnet_diagnostic.IL2056.severity = error # Annotated generic parameter is not publicly visible +dotnet_diagnostic.IL2057.severity = error # Unrecognized value passed to an annotated parameter +dotnet_diagnostic.IL2058.severity = error # Parameter types lack a matching DynamicallyAccessedMembers annotation dotnet_diagnostic.IL2059.severity = error # Unrecognized reflection pattern dotnet_diagnostic.IL2060.severity = error # Unrecognized value passed to parameter with DynamicallyAccessedMembersAttribute -dotnet_diagnostic.IL2061.severity = error # Value passed to implicit this parameter doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2062.severity = error # Value passed to parameter doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2063.severity = error # Value returned from method doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2064.severity = error # Value assigned to field doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2065.severity = error # Value passed to implicit this parameter doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2066.severity = error # Value stored in field doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2067.severity = error # Value passed to implicit this parameter doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2068.severity = error # Value passed to parameter doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2069.severity = error # Value returned from method doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2070.severity = error # Value stored in field doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2071.severity = error # Value returned from method doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2072.severity = error # Value passed to parameter doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2073.severity = error # Value returned from method doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2074.severity = error # Value stored in field doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2075.severity = error # Value passed to implicit this parameter doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2076.severity = error # Value returned from method doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2077.severity = error # Value passed to parameter doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2078.severity = error # Value returned from method doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2079.severity = error # Value stored in field doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2080.severity = error # Value passed to implicit this parameter doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2081.severity = error # Value returned from method doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2082.severity = error # Value passed to parameter doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2083.severity = error # Value stored in field doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2084.severity = error # Value returned from method doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2085.severity = error # Value passed to implicit this parameter doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2087.severity = error # Value passed to parameter doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2088.severity = error # Value returned from method doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2089.severity = error # Value stored in field doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2090.severity = error # Value passed to implicit this parameter doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2091.severity = error # Target generic argument doesn't satisfy 'DynamicallyAccessedMembersAttribute' requirements -dotnet_diagnostic.IL2092.severity = error # Value passed to generic parameter doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2093.severity = error # Value stored in field doesn't satisfy DynamicallyAccessedMembersAttribute requirements +dotnet_diagnostic.IL2061.severity = error # Value passed to implicit this fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2062.severity = error # Value passed to parameter fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2063.severity = error # Value returned from method fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2064.severity = error # Value assigned to field fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2065.severity = error # Value passed to implicit this fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2066.severity = error # Value stored in field fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2067.severity = error # Value passed to implicit this fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2068.severity = error # Value passed to parameter fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2069.severity = error # Value returned from method fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2070.severity = error # Value stored in field fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2071.severity = error # Value returned from method fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2072.severity = error # Value passed to parameter fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2073.severity = error # Value returned from method fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2074.severity = error # Value stored in field fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2075.severity = error # Value passed to implicit this fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2076.severity = error # Value returned from method fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2077.severity = error # Value passed to parameter fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2078.severity = error # Value returned from method fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2079.severity = error # Value stored in field fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2080.severity = error # Value passed to implicit this fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2081.severity = error # Value returned from method fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2082.severity = error # Value passed to parameter fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2083.severity = error # Value stored in field fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2084.severity = error # Value returned from method fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2085.severity = error # Value passed to implicit this fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2087.severity = error # Value passed to parameter fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2088.severity = error # Value returned from method fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2089.severity = error # Value stored in field fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2090.severity = error # Value passed to implicit this fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2091.severity = error # Target generic argument fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2092.severity = error # Value passed to generic parameter fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2093.severity = error # Value stored in field fails DynamicallyAccessedMembers dotnet_diagnostic.IL2094.severity = error # DynamicallyAccessedMembers on 'this' parameter doesn't match overridden member -dotnet_diagnostic.IL2095.severity = error # Value returned from method doesn't satisfy DynamicallyAccessedMembersAttribute requirements +dotnet_diagnostic.IL2095.severity = error # Value returned from method fails DynamicallyAccessedMembers dotnet_diagnostic.IL2096.severity = error # Calling method on statically typed generic instance requires unreferenced code -dotnet_diagnostic.IL2097.severity = error # Value passed to parameter doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2098.severity = error # Value stored in field doesn't satisfy DynamicallyAccessedMembersAttribute requirements -dotnet_diagnostic.IL2099.severity = error # Value returned from method doesn't satisfy DynamicallyAccessedMembersAttribute requirements +dotnet_diagnostic.IL2097.severity = error # Value passed to parameter fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2098.severity = error # Value stored in field fails DynamicallyAccessedMembers +dotnet_diagnostic.IL2099.severity = error # Value returned from method fails DynamicallyAccessedMembers dotnet_diagnostic.IL2100.severity = error # XML stream doesn't conform to the schema dotnet_diagnostic.IL2101.severity = error # Embedded XML in assembly couldn't be loaded dotnet_diagnostic.IL2102.severity = error # Invalid warning number passed to UnconditionalSuppressMessage -dotnet_diagnostic.IL2103.severity = error # Value passed to the 'propertyAccessExpression' parameter doesn't satisfy DynamicallyAccessedMembersAttribute requirements +dotnet_diagnostic.IL2103.severity = error # Value passed to 'propertyAccessExpression' fails DynamicallyAccessedMembers dotnet_diagnostic.IL2104.severity = error # Assembly that was specified through a custom step dotnet_diagnostic.IL2105.severity = error # Type from a custom step that couldn't be loaded dotnet_diagnostic.IL2106.severity = error # Method from a custom step that couldn't be loaded -dotnet_diagnostic.IL2107.severity = error # Methods in types that derive from RemotingClientProxy cannot be statically determined +dotnet_diagnostic.IL2107.severity = error # Methods on RemotingClientProxy-derived types cannot be determined dotnet_diagnostic.IL2108.severity = error # Invalid scope for UnconditionalSuppressMessage dotnet_diagnostic.IL2109.severity = error # Method doesn't have matching DynamicallyAccessedMembers annotation dotnet_diagnostic.IL2110.severity = error # Invalid member name in UnconditionalSuppressMessage -dotnet_diagnostic.IL2111.severity = error # Method with parameters or return value with DynamicallyAccessedMembersAttribute is not supported -dotnet_diagnostic.IL2112.severity = error # Reflection call to method with DynamicallyAccessedMembersAttribute requirements cannot be statically analyzed -dotnet_diagnostic.IL2113.severity = error # DynamicallyAccessedMembers on type references Type.MakeGenericType with different requirements +dotnet_diagnostic.IL2111.severity = error # Annotated parameters or return value are unsupported here +dotnet_diagnostic.IL2112.severity = error # Reflection call to an annotated method cannot be analyzed +dotnet_diagnostic.IL2113.severity = error # Annotation references MakeGenericType with different requirements dotnet_diagnostic.IL2114.severity = error # DynamicallyAccessedMembers mismatch on signature types -dotnet_diagnostic.IL2115.severity = error # DynamicallyAccessedMembers on type or base types references member which requires unreferenced code +dotnet_diagnostic.IL2115.severity = error # Annotated type or base references a member requiring unreferenced code dotnet_diagnostic.IL2116.severity = error # DynamicallyAccessedMembers on parameter types doesn't match overridden parameter dotnet_diagnostic.IL2117.severity = error # Methods with DynamicallyAccessedMembersAttribute annotations cannot be replaced -dotnet_diagnostic.IL2122.severity = error # Reflection call to method with UnreferencedCode attribute cannot be statically analyzed -dotnet_diagnostic.IL2123.severity = error # DynamicallyAccessedMembers on method or parameter doesn't match overridden member +dotnet_diagnostic.IL2122.severity = error # Reflection call to an UnreferencedCode method cannot be analyzed +dotnet_diagnostic.IL2123.severity = error # DynamicallyAccessedMembers does not match the overridden member # Native AOT # See: https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/warnings/ @@ -2153,26 +2166,27 @@ dotnet_diagnostic.S1075.severity = none # Hardcoded URI — canonical SourceLink dotnet_diagnostic.S2436.severity = none # Too many generic parameters — needed for the projector overload dotnet_diagnostic.S4036.severity = none # PATH-relative process spawn — benchmark only, trusted env dotnet_diagnostic.S8969.severity = none # Nullability inference is inconsistent across the repository's target frameworks +dotnet_diagnostic.S8970.severity = none # Redundant null-forgiving operator — covered by SST2209 # Blocker bugs dotnet_diagnostic.S1048.severity = none # Finalizers should not throw exceptions — covered by SST1485 dotnet_diagnostic.S2190.severity = none # Loops and recursions should not be infinite -dotnet_diagnostic.S2275.severity = none # Composite format strings should not lead to unexpected behavior at runtime - DUPLICATE CA2241 +dotnet_diagnostic.S2275.severity = none # Composite format strings — covered by CA2241 dotnet_diagnostic.S2857.severity = none # SQL keywords should be delimited by whitespace — covered by SST2470 dotnet_diagnostic.S2930.severity = none # "IDisposables" should be disposed — covered by SST2410 -dotnet_diagnostic.S2931.severity = none # Classes with "IDisposable" members should implement "IDisposable" — covered by SST2315 +dotnet_diagnostic.S2931.severity = none # Types with IDisposable members should implement IDisposable — SST2315 dotnet_diagnostic.S3464.severity = none # Type inheritance should not be recursive — covered by SST2437 dotnet_diagnostic.S3869.severity = none # "SafeHandle.DangerousGetHandle" should not be called -> replaced by SST2484 -dotnet_diagnostic.S3889.severity = none # "Thread.Resume" and "Thread.Suspend" should not be used -> replaced by obsolete or compiler +dotnet_diagnostic.S3889.severity = none # Thread.Resume and Thread.Suspend — replaced by obsolete markers dotnet_diagnostic.S4159.severity = none # Classes should implement their "ExportAttribute" interfaces — covered by SST2472 # Critical bugs dotnet_diagnostic.S2551.severity = none # Shared resources should not be used for locking — covered by SST1902 -dotnet_diagnostic.S2952.severity = none # Classes should "Dispose" of members from the classes' own "Dispose" methods -> replaced by SST2315 +dotnet_diagnostic.S2952.severity = none # Dispose members from the type's own Dispose — covered by SST2315 dotnet_diagnostic.S3449.severity = none # Right operands of shift operators should be integers -> replaced by SST1478 dotnet_diagnostic.S4275.severity = none # Getters and setters should access the expected fields — covered by SST2422 dotnet_diagnostic.S4277.severity = none # "Shared" parts should not be created with "new" — covered by SST2473 -dotnet_diagnostic.S4583.severity = none # Calls to delegate's method "BeginInvoke" should be paired with calls to "EndInvoke" -> replaced by obsolete (APM BeginInvoke/EndInvoke) +dotnet_diagnostic.S4583.severity = none # BeginInvoke should be paired with EndInvoke — replaced by obsolete dotnet_diagnostic.S4586.severity = none # Non-async "Task/Task" methods should not return null — covered by PSH1312 dotnet_diagnostic.S5856.severity = none # Regular expressions should be syntactically valid — covered by SST2444 dotnet_diagnostic.S6674.severity = none # Log message template should be syntactically correct — covered by SST2441 @@ -2181,89 +2195,90 @@ dotnet_diagnostic.S6674.severity = none # Log message template should be syntact dotnet_diagnostic.S1244.severity = none # Floating point numbers should not be tested for equality — covered by SST1473 dotnet_diagnostic.S1656.severity = none # Variables should not be self-assigned — covered by SST1189 dotnet_diagnostic.S1751.severity = none # Loops with at most one iteration should be refactored - covered by SST1444 -dotnet_diagnostic.S1764.severity = none # Identical expressions should not be used on both sides of operators — covered by SST1474 -dotnet_diagnostic.S1848.severity = none # Objects should not be created to be dropped immediately without being used -> replaced by SST1480 -dotnet_diagnostic.S1862.severity = none # Related "if/else if" statements should not have the same condition — covered by SST1475 -dotnet_diagnostic.S2114.severity = none # Collections should not be passed as arguments to their own methods — covered by SST2419 +dotnet_diagnostic.S1764.severity = none # Identical expressions on both sides of an operator — covered by SST1474 +dotnet_diagnostic.S1848.severity = none # Objects created and dropped immediately — covered by SST1480 +dotnet_diagnostic.S1862.severity = none # if/else if statements with the same condition — covered by SST1475 +dotnet_diagnostic.S2114.severity = none # Collections passed to their own methods — covered by SST2419 dotnet_diagnostic.S2123.severity = none # Values should not be uselessly incremented -> replaced by SST2222 -dotnet_diagnostic.S2201.severity = none # Methods without side effects should not have their return values ignored — covered by SST2418 +dotnet_diagnostic.S2201.severity = none # Side-effect-free return values ignored — covered by SST2418 dotnet_diagnostic.S2225.severity = none # "ToString()" method should not return null — covered by SST2431 -dotnet_diagnostic.S2251.severity = none # A "for" loop update clause should move the counter in the right direction — covered by SST2412 +dotnet_diagnostic.S2251.severity = none # A for loop counter moving the wrong way — covered by SST2412 dotnet_diagnostic.S2252.severity = none # For-loop conditions should be true at least once — covered by SST2413 dotnet_diagnostic.S2445.severity = none # Blocks should be synchronized on read-only fields — covered by SST1904 dotnet_diagnostic.S2688.severity = none # "NaN" should not be used in comparisons — covered by SST1473 dotnet_diagnostic.S2757.severity = none # Non-existent operators like "=+" should not be used — covered by SST2417 dotnet_diagnostic.S2761.severity = none # Doubled prefix operators "!!" and "~~" should not be used — covered by SST1190 -dotnet_diagnostic.S2995.severity = none # "Object.ReferenceEquals" should not be used for value types -> replaced by CA2013 +dotnet_diagnostic.S2995.severity = none # ReferenceEquals on value types — covered by CA2013 dotnet_diagnostic.S2996.severity = none # "ThreadStatic" fields should not be initialized -> replaced by CA2019 -dotnet_diagnostic.S2997.severity = none # "IDisposables" created in a "using" statement should not be returned — covered by SST2423 +dotnet_diagnostic.S2997.severity = none # IDisposables created in a using should not be returned — SST2423 dotnet_diagnostic.S3005.severity = none # "ThreadStatic" should not be used on non-static fields -> replaced by CA2259 dotnet_diagnostic.S3168.severity = none # "async" methods should not return "void" — covered by SST1905 dotnet_diagnostic.S3172.severity = none # Delegates should not be subtracted — covered by SST2448 -dotnet_diagnostic.S3244.severity = none # Anonymous delegates should not be used to unsubscribe from Events — covered by SST2449 +dotnet_diagnostic.S3244.severity = none # Anonymous delegates used to unsubscribe from events — SST2449 dotnet_diagnostic.S3249.severity = none # Covered by SST1447 (canonical) -dotnet_diagnostic.S3263.severity = none # Static fields should appear in the order they must be initialized — covered by SST2428 -dotnet_diagnostic.S3343.severity = none # Caller information parameters should come at the end of the parameter list — covered by SST2433 -dotnet_diagnostic.S3346.severity = none # Expressions used in "Debug.Assert" should not produce side effects — covered by SST2450 +dotnet_diagnostic.S3263.severity = none # Static fields ordered by initialization need — covered by SST2428 +dotnet_diagnostic.S3343.severity = none # Caller-info parameters should come last — covered by SST2433 +dotnet_diagnostic.S3346.severity = none # Debug.Assert expressions with side effects — covered by SST2450 dotnet_diagnostic.S3453.severity = none # Classes should not have only "private" constructors — covered by SST2451 dotnet_diagnostic.S3466.severity = none # Optional parameters should be passed to "base" calls — covered by SST2425 -dotnet_diagnostic.S3598.severity = none # One-way "OperationContract" methods should have "void" return type -> replaced by obsolete (WCF) +dotnet_diagnostic.S3598.severity = none # One-way OperationContract should return void — replaced by obsolete dotnet_diagnostic.S3603.severity = none # Methods with "Pure" attribute should return a value — covered by SST2452 dotnet_diagnostic.S3610.severity = none # Nullable type comparison should not be redundant -> replaced by compiler CS0472 dotnet_diagnostic.S3903.severity = none # Types should be defined in named namespaces — covered by SST2312 -dotnet_diagnostic.S3923.severity = none # All branches in a conditional structure should not have exactly the same implementation — covered by SST1476 -dotnet_diagnostic.S3926.severity = none # Deserialization methods should be provided for "OptionalField" members -> replaced by obsolete (legacy binary serialization) -dotnet_diagnostic.S3927.severity = none # Serialization event handlers should be implemented correctly — covered by SST2430 -dotnet_diagnostic.S3981.severity = none # Collection sizes and array length comparisons should make sense — covered by SST1479 +dotnet_diagnostic.S3923.severity = none # All branches with the same implementation — covered by SST1476 +dotnet_diagnostic.S3926.severity = none # Deserialization methods for OptionalField — replaced by obsolete +dotnet_diagnostic.S3927.severity = none # Serialization event handlers — covered by SST2430 +dotnet_diagnostic.S3981.severity = none # Collection size and array length comparisons — covered by SST1479 dotnet_diagnostic.S3984.severity = none # Exceptions should not be created without being thrown — covered by SST1480 dotnet_diagnostic.S4143.severity = none # Collection elements should not be replaced unconditionally — covered by SST1487 -dotnet_diagnostic.S4210.severity = none # Windows Forms entry points should be marked with STAThread -> replaced by SST2706 -dotnet_diagnostic.S4260.severity = none # "ConstructorArgument" parameters should exist in constructors -> replaced by SST2487 -dotnet_diagnostic.S4428.severity = none # "PartCreationPolicyAttribute" should be used with "ExportAttribute" — covered by SST2474 +dotnet_diagnostic.S4210.severity = none # Windows Forms entry points need STAThread — replaced by SST2706 +dotnet_diagnostic.S4260.severity = none # ConstructorArgument parameters must exist — replaced by SST2487 +dotnet_diagnostic.S4428.severity = none # PartCreationPolicy needs Export — covered by SST2474 dotnet_diagnostic.S6507.severity = none # Blocks should not be synchronized on local variables — covered by SST1903 dotnet_diagnostic.S6677.severity = none # Message template placeholders should be unique — covered by SST2442 dotnet_diagnostic.S6797.severity = none # Blazor query parameter type should be supported -> replaced by SST2702 -dotnet_diagnostic.S6798.severity = none # [JSInvokable] attribute should only be used on public methods -> replaced by SST2701 -dotnet_diagnostic.S6800.severity = none # Component parameter type should match the route parameter type constraint -> replaced by SST2703 +dotnet_diagnostic.S6798.severity = none # [JSInvokable] only on public methods — replaced by SST2701 +dotnet_diagnostic.S6800.severity = none # Component parameter must match the route constraint — SST2703 dotnet_diagnostic.S6930.severity = none # Backslash should be avoided in route templates -> replaced by SST2700 +dotnet_diagnostic.S8949.severity = none # A CancellationToken should be forwarded to the overload that takes one — covered by CA2016 # Minor bugs -dotnet_diagnostic.S1206.severity = none # "Equals(Object)" and "GetHashCode()" should be overridden in pairs - DUPLICATE CA2218 -dotnet_diagnostic.S1226.severity = none # Method parameters, caught exceptions and foreach variables' initial values should not be ignored -dotnet_diagnostic.S2183.severity = none # Integral numbers should not be shifted by zero or more than their number of bits-1 — covered by SST1478 -dotnet_diagnostic.S2184.severity = none # Results of integer division should not be assigned to floating point variables — covered by SST1477 +dotnet_diagnostic.S1206.severity = none # Equals and GetHashCode overridden in pairs — covered by CA2218 +dotnet_diagnostic.S1226.severity = none # Parameter and foreach initial values should not be ignored +dotnet_diagnostic.S2183.severity = none # Shift counts beyond the operand width — covered by SST1478 +dotnet_diagnostic.S2184.severity = none # Integer division assigned to a floating point value — SST1477 dotnet_diagnostic.S2328.severity = none # "GetHashCode" should not reference mutable fields — covered by SST1482 -dotnet_diagnostic.S2345.severity = none # Flags enumerations should explicitly initialize all their members — covered by SST2303 +dotnet_diagnostic.S2345.severity = none # Flags enums should initialize all members — covered by SST2303 dotnet_diagnostic.S2674.severity = none # The length returned from a stream read should be checked — covered by SST2446 -dotnet_diagnostic.S2934.severity = none # Property assignments should not be made for "readonly" fields not constrained to reference types — covered by SST2421 -dotnet_diagnostic.S2955.severity = none # Generic parameters not constrained to reference types should not be compared to "null" -> replaced by compiler CS0019/CS0037 +dotnet_diagnostic.S2934.severity = none # Assignment to a readonly field of a type parameter — SST2421 +dotnet_diagnostic.S2955.severity = none # Unconstrained generic compared to null — replaced by the compiler dotnet_diagnostic.S3363.severity = none # Date and time should not be used as a type for primary keys — covered by SST2475 -dotnet_diagnostic.S3397.severity = none # "base.Equals" should not be used to check for reference equality in "Equals" if "base" is not "object" — covered by SST2435 -dotnet_diagnostic.S3456.severity = none # "string.ToCharArray()" and "ReadOnlySpan.ToArray()" should not be called redundantly — covered by PSH1217 +dotnet_diagnostic.S3397.severity = none # base.Equals used for reference equality — covered by SST2435 +dotnet_diagnostic.S3456.severity = none # Redundant ToCharArray and ToArray calls — covered by PSH1217 dotnet_diagnostic.S3887.severity = none # Mutable, non-private fields should not be "readonly" — covered by SST2322 # Blocker vulnerabilities -dotnet_diagnostic.S2115.severity = none # A secure password should be used when connecting to a database -> replaced by SES1203 +dotnet_diagnostic.S2115.severity = none # A secure database password should be used — replaced by SES1203 dotnet_diagnostic.S2755.severity = none # XML parsers should not be vulnerable to XXE attacks -> replaced by CA3075 -dotnet_diagnostic.S3884.severity = none # "CoSetProxyBlanket" and "CoInitializeSecurity" should not be used -> replaced by obsolete (COM interop security) +dotnet_diagnostic.S3884.severity = none # CoSetProxyBlanket and CoInitializeSecurity — replaced by obsolete dotnet_diagnostic.S6418.severity = none # Secrets should not be hard-coded — covered by SES1201 # Critical vulnerabilities dotnet_diagnostic.S4423.severity = none # Weak SSL/TLS protocols should not be used -> replaced by CA5397/CA5398 dotnet_diagnostic.S4426.severity = none # Cryptographic keys should be robust -> replaced by CA5385 (RSA) / CA5384 (DSA) dotnet_diagnostic.S4433.severity = none # LDAP connections should be authenticated -> replaced by SES1310 -dotnet_diagnostic.S4830.severity = none # Server certificates should be verified during SSL/TLS connections -> replaced by SES1102 or SES1108 -dotnet_diagnostic.S5344.severity = none # Passwords should not be stored in plaintext or with a fast hashing algorithm -> replaced by SES1009 -dotnet_diagnostic.S5445.severity = none # Insecure temporary file creation methods should not be used -> replaced by SES1307 -dotnet_diagnostic.S5542.severity = none # Encryption algorithms should be used with secure mode and padding scheme -> replaced by CA5358 +dotnet_diagnostic.S4830.severity = none # Server certificates should be verified — replaced by SES1102/SES1108 +dotnet_diagnostic.S5344.severity = none # Passwords stored with a fast hash — replaced by SES1009 +dotnet_diagnostic.S5445.severity = none # Insecure temporary file creation — replaced by SES1307 +dotnet_diagnostic.S5542.severity = none # Encryption mode and padding scheme — replaced by CA5358 dotnet_diagnostic.S5547.severity = none # Cipher algorithms should be robust -> replaced by CA5351 -dotnet_diagnostic.S5659.severity = none # JWT should be signed and verified with strong cipher algorithms -> replaced by SES1503 +dotnet_diagnostic.S5659.severity = none # JWT signed with strong cipher algorithms — replaced by SES1503 # Major vulnerabilities dotnet_diagnostic.S2068.severity = none # Credentials should not be hard-coded -> replaced by SES1201 -dotnet_diagnostic.S2612.severity = none # File permissions should not be set to world-accessible values -> replaced by SES1308 -dotnet_diagnostic.S4211.severity = none # Members should not have conflicting transparency annotations -> replaced by obsolete (Code Access Security) -dotnet_diagnostic.S4212.severity = none # Serialization constructors should be secured -> replaced by obsolete (Code Access Security) +dotnet_diagnostic.S2612.severity = none # World-accessible file permissions — replaced by SES1308 +dotnet_diagnostic.S4211.severity = none # Conflicting transparency annotations — replaced by obsolete +dotnet_diagnostic.S4212.severity = none # Serialization constructors should be secured — replaced by obsolete dotnet_diagnostic.S6377.severity = none # XML signatures should be validated securely -> replaced by SES1008 dotnet_diagnostic.S7039.severity = none # Content Security Policies should be restrictive -> replaced by SES1515 @@ -2272,86 +2287,86 @@ dotnet_diagnostic.S1147.severity = none # Exit methods should not be called — dotnet_diagnostic.S1451.severity = none # Track lack of copyright and license headers dotnet_diagnostic.S2178.severity = none # Short-circuit logic should be used in boolean contexts — covered by SST2415 dotnet_diagnostic.S2187.severity = none # Test classes should contain at least one test case — covered by SST2504 -dotnet_diagnostic.S2306.severity = none # "async" and "await" should not be used as identifiers -> replaced by compiler (contextual keyword) -dotnet_diagnostic.S2368.severity = none # Public methods should not have multidimensional array parameters — jagged arrays are the chosen layout for hot-path lookup tables +dotnet_diagnostic.S2306.severity = none # async and await as identifiers — replaced by the compiler +dotnet_diagnostic.S2368.severity = none # Public multidimensional array parameters — jagged is our layout dotnet_diagnostic.S2387.severity = none # Child class fields should not shadow parent class fields — covered by SST1484 dotnet_diagnostic.S2437.severity = none # Unnecessary bit operations should not be performed — covered by SST1481 dotnet_diagnostic.S2699.severity = none # Tests should include assertions -> replaced by SST2500 -dotnet_diagnostic.S2953.severity = none # Methods named "Dispose" should implement "IDisposable.Dispose" — covered by SST2316 +dotnet_diagnostic.S2953.severity = none # Methods named Dispose should implement IDisposable — SST2316 dotnet_diagnostic.S2970.severity = none # Assertions should be complete -> replaced by SST2508 dotnet_diagnostic.S3060.severity = none # "is" should not be used with "this" -> replaced by SST2327 dotnet_diagnostic.S3237.severity = none # "value" contextual keyword should be used — covered by SST2429 -dotnet_diagnostic.S3427.severity = none # Method overloads with default parameter values should not overlap — covered by SST2319 +dotnet_diagnostic.S3427.severity = none # Overlapping default parameter overloads — covered by SST2319 dotnet_diagnostic.S3433.severity = none # Test method signatures should be correct -> replaced by SST2509 dotnet_diagnostic.S3443.severity = none # Type should not be examined on "System.Type" instances — covered by SST2432 dotnet_diagnostic.S3875.severity = none # "operator==" should not be overloaded on reference types -> replaced by SST2464 dotnet_diagnostic.S3877.severity = none # Exceptions should not be thrown from unexpected methods — covered by SST1485 dotnet_diagnostic.S4462.severity = none # Calls to "async" methods should not be blocking - covered by PSH1315 -dotnet_diagnostic.S6422.severity = none # Calls to "async" methods should not be blocking in Azure Functions — covered by PSH1315 -dotnet_diagnostic.S6424.severity = none # Interfaces for durable entities should satisfy the restrictions -> off: Durable Entity-specific; not used in this library +dotnet_diagnostic.S6422.severity = none # Blocking async calls in Azure Functions — covered by PSH1315 +dotnet_diagnostic.S6424.severity = none # Durable entity interface restrictions — not used in this library # Critical code smells dotnet_diagnostic.S1006.severity = none # Method overrides should not change parameter defaults — covered by SST2424 dotnet_diagnostic.S1067.severity = none # Expressions should not be too complex dotnet_diagnostic.S1163.severity = none # Exceptions should not be thrown in finally blocks -> replaced by CA2219 dotnet_diagnostic.S1186.severity = none # Methods should not be empty — covered by SST1438 -dotnet_diagnostic.S121.severity = none # Control structures should use curly braces (kept over SA1503 — Sonar 20ms vs SA1503 50ms) -> replaced by SST1503 +dotnet_diagnostic.S121.severity = none # Control structures should use braces — replaced by SST1503 dotnet_diagnostic.S1215.severity = none # "GC.Collect" should not be called — covered by PSH1021 dotnet_diagnostic.S126.severity = none # "if ... else if" constructs should end with "else" clauses dotnet_diagnostic.S131.severity = none # "switch/Select" statements should contain a "default/Case Else" clauses -dotnet_diagnostic.S134.severity = none # Control flow statements "if", "switch", "for", "foreach", "while", "do" and "try" should not be nested too deeply +dotnet_diagnostic.S134.severity = none # Control flow statements should not be nested too deeply dotnet_diagnostic.S1541.severity = none # Methods and properties should not be too complex - covered by SST1442 dotnet_diagnostic.S1699.severity = none # Constructors should only call non-overridable methods — covered by SST1483 dotnet_diagnostic.S1821.severity = none # "switch" statements should not be nested -> replaced by SST2252 dotnet_diagnostic.S1944.severity = none # Invalid casts should be avoided -> replaced by compiler CS0030 -dotnet_diagnostic.S1994.severity = none # "for" loop increment clauses should modify the loops' counters — covered by SST2411 +dotnet_diagnostic.S1994.severity = none # A for loop increment should modify the counter — covered by SST2411 dotnet_diagnostic.S2197.severity = none # Modulus results should not be checked for direct equality — covered by SST2416 dotnet_diagnostic.S2198.severity = none # Unnecessary mathematical comparisons should not be made -> replaced by SST2489 dotnet_diagnostic.S2223.severity = none # Non-constant static fields should not be visible - DUPLICATE CA2211 dotnet_diagnostic.S2290.severity = none # Field-like events should not be virtual -> replaced by SST2456 -dotnet_diagnostic.S2291.severity = none # Overflow checking should not be disabled for "Enumerable.Sum" — covered by SST2457 +dotnet_diagnostic.S2291.severity = none # Overflow checking disabled for Enumerable.Sum — covered by SST2457 dotnet_diagnostic.S2302.severity = none # "nameof" should be used — covered by SST1415 dotnet_diagnostic.S2330.severity = none # Array covariance should not be used — covered by SST2434 dotnet_diagnostic.S2339.severity = none # Public constant members should not be used — covered by SST2311 dotnet_diagnostic.S2346.severity = none # Flags enumerations zero-value members should be named "None" - DUPLICATE CA1008 -dotnet_diagnostic.S2360.severity = none # Optional parameters should not be used — conflicts with SST2433, which owns caller-info parameters requiring a default +dotnet_diagnostic.S2360.severity = none # Optional parameters should not be used — conflicts with SST2433 dotnet_diagnostic.S2365.severity = none # Properties should not make collection or array copies — covered by PSH1017 -dotnet_diagnostic.S2479.severity = none # Whitespace and control characters in string literals should be explicit — covered by SST1192 +dotnet_diagnostic.S2479.severity = none # Control characters in string literals — covered by SST1192 dotnet_diagnostic.S2692.severity = none # "IndexOf" checks should not be for positive numbers — covered by SST2420 dotnet_diagnostic.S2696.severity = none # Instance members should not write to "static" fields -> replaced by SST2402 dotnet_diagnostic.S2701.severity = none # Literal boolean values should not be used in assertions — covered by SST2503 -dotnet_diagnostic.S3215.severity = none # "interface" instances should not be cast to concrete types -> deliberately unenforced, same reason as SST2326 +dotnet_diagnostic.S3215.severity = none # Interfaces cast to concrete types — unenforced, as with SST2326 dotnet_diagnostic.S3216.severity = none # "ConfigureAwait(false)" should be used -> replaced by CA2007 -dotnet_diagnostic.S3217.severity = none # "Explicit" conversions of "foreach" loops should not be used — covered by SST2225 -dotnet_diagnostic.S3218.severity = none # Inner class members should not shadow outer class "static" or type members — covered by SST1484 +dotnet_diagnostic.S3217.severity = none # Explicit conversions in foreach loops — covered by SST2225 +dotnet_diagnostic.S3218.severity = none # Inner members shadowing outer members — covered by SST1484 dotnet_diagnostic.S3265.severity = none # Non-flags enums should not be used in bitwise operations — covered by SST2458 dotnet_diagnostic.S3353.severity = none # Unchanged variables should be marked as "const" — covered by PSH1402 -dotnet_diagnostic.S3447.severity = none # "[Optional]" should not be used on "ref" or "out" parameters — covered by SST2459 -dotnet_diagnostic.S3451.severity = none # "[DefaultValue]" should not be used when "[DefaultParameterValue]" is meant — covered by SST2460 +dotnet_diagnostic.S3447.severity = none # [Optional] on ref or out parameters — covered by SST2459 +dotnet_diagnostic.S3451.severity = none # [DefaultValue] where [DefaultParameterValue] is meant — SST2460 dotnet_diagnostic.S3600.severity = none # "params" should not be introduced on overrides — covered by SST2426 dotnet_diagnostic.S3776.severity = none # Cognitive Complexity of methods should not be too high - covered by SST1443 dotnet_diagnostic.S3871.severity = none # Exception types should be "public" -> replaced by CA1064 dotnet_diagnostic.S3874.severity = none # "out" and "ref" parameters — repo idiom is TryX(..., out T value) -dotnet_diagnostic.S3904.severity = none # Assemblies should have version information -> replaced by obsolete (SDK supplies assembly version) +dotnet_diagnostic.S3904.severity = none # Assemblies should have version information — the SDK supplies it dotnet_diagnostic.S3937.severity = none # Number patterns should be regular — covered by SST1119 dotnet_diagnostic.S3972.severity = none # Conditionals should start on new lines — covered by SST1146 -dotnet_diagnostic.S3973.severity = none # A conditionally executed single line should be denoted by indentation -> replaced by SST1503 +dotnet_diagnostic.S3973.severity = none # A conditional single line should be indented — replaced by SST1503 dotnet_diagnostic.S3998.severity = none # Threads should not lock on objects with weak identity -> replaced by SST1902 dotnet_diagnostic.S4000.severity = none # Pointers to unmanaged memory should not be visible -> replaced by SST2328 dotnet_diagnostic.S4015.severity = none # Inherited member visibility should not be decreased — covered by SST2462 dotnet_diagnostic.S4019.severity = none # Base class methods should not be hidden — covered by SST2427 -dotnet_diagnostic.S4025.severity = none # Child class fields should not differ from parent class fields only by capitalization — covered by SST2463 +dotnet_diagnostic.S4025.severity = none # Child fields differing from parent only by case — covered by SST2463 dotnet_diagnostic.S4039.severity = none # Interface methods should be callable by derived types - DUPLICATE CA1033 dotnet_diagnostic.S4487.severity = none # Unread "private" fields should be removed dotnet_diagnostic.S4524.severity = none # "default" clauses should be first or last — covered by SST1219 dotnet_diagnostic.S4635.severity = none # Start index should be used instead of calling Substring — covered by PSH1218 dotnet_diagnostic.S5034.severity = none # "ValueTask" should be consumed correctly — covered by PSH1316 -dotnet_diagnostic.S6967.severity = none # ModelState.IsValid should be called in controller actions -> off: ASP.NET MVC-specific; no controllers in this library -dotnet_diagnostic.S8367.severity = none # Identifiers should not conflict with the C# 14 "field" contextual keyword - the C# 14 compiler reports this: CS9273 (error) for a local named field in an accessor, CS9258 (warning) for a rebinding read -dotnet_diagnostic.S8368.severity = none # Identifiers should not conflict with the C# 14 "extension" contextual keyword - the C# 14 compiler reports this as CS9306, and SST1300 already flags the lowercase type name -dotnet_diagnostic.S8380.severity = none # Return types named "partial" should be escaped with "@" - the compiler reports this as CS8981, and SST1300 already flags the lowercase type name -dotnet_diagnostic.S8381.severity = none # "scoped" should be escaped when used as an identifier or type name in parenthesized lambda parameter lists -> replaced by compiler -dotnet_diagnostic.S927.severity = none # Parameter names should match base declaration and other partial definitions - DUPLICATE CA1725 +dotnet_diagnostic.S6967.severity = none # ModelState.IsValid in controller actions — no controllers here +dotnet_diagnostic.S8367.severity = none # Identifiers conflicting with the field keyword — the compiler reports it +dotnet_diagnostic.S8368.severity = none # Identifiers conflicting with the extension keyword — the compiler reports it +dotnet_diagnostic.S8380.severity = none # Return types named partial need @ — the compiler reports it +dotnet_diagnostic.S8381.severity = none # scoped should be escaped as an identifier — replaced by the compiler +dotnet_diagnostic.S927.severity = none # Parameter names should match the base declaration — covered by CA1725 # Major code smells dotnet_diagnostic.S103.severity = none # Lines should not be too long — covered by SST1521 @@ -2363,15 +2378,15 @@ dotnet_diagnostic.S108.severity = none # Nested blocks of code should not be lef dotnet_diagnostic.S109.severity = none # Magic numbers should not be used — covered by SST1471 dotnet_diagnostic.S110.severity = none # Inheritance tree of classes should not be too deep — covered by SST1446 dotnet_diagnostic.S1110.severity = none # Redundant pairs of parentheses should be removed — covered by SST1459 -dotnet_diagnostic.S1117.severity = none # Local variables should not shadow class fields or properties — covered by SST1484 +dotnet_diagnostic.S1117.severity = none # Locals shadowing fields or properties — covered by SST1484 dotnet_diagnostic.S1118.severity = none # Utility classes should not have public constructors - DUPLICATE CA1052 dotnet_diagnostic.S112.severity = none # General or reserved exceptions should never be thrown — covered by SST2409 dotnet_diagnostic.S1121.severity = none # Assignments should not be made from within sub-expressions — covered by SST1187 dotnet_diagnostic.S1123.severity = none # "Obsolete" attributes should include explanations — covered by SST2308 dotnet_diagnostic.S1134.severity = none # Track uses of "FIXME" tags -> off: TODO comment tracker; not enforced here dotnet_diagnostic.S1144.severity = none # Covered by SST1440 (canonical) -dotnet_diagnostic.S1151.severity = none # "switch case" clauses should not have too many lines of code — covered by SST1524 -dotnet_diagnostic.S1168.severity = none # Empty arrays and collections should be returned instead of null — covered by SST2306 +dotnet_diagnostic.S1151.severity = none # switch case clauses with too many lines — covered by SST1524 +dotnet_diagnostic.S1168.severity = none # Empty collections should be returned over null — covered by SST2306 dotnet_diagnostic.S1172.severity = none # Unused method parameters should be removed — covered by SST1461 dotnet_diagnostic.S1200.severity = none # Classes should not be coupled to too many other classes dotnet_diagnostic.S122.severity = none # Statements should be on separate lines — covered by SST1107 @@ -2382,27 +2397,27 @@ dotnet_diagnostic.S1479.severity = none # "switch" statements with many "case" c dotnet_diagnostic.S1607.severity = none # Tests should not be ignored -> off: ignored-test tracker; not enforced here dotnet_diagnostic.S1696.severity = none # NullReferenceException should not be caught — covered by SST2401 dotnet_diagnostic.S1854.severity = none # Unused assignments should be removed - DUPLICATE IDE0059 -dotnet_diagnostic.S1871.severity = none # Two branches in a conditional structure should not have exactly the same implementation — covered by SST2414 -dotnet_diagnostic.S2139.severity = none # Exceptions should be either logged or rethrown but not both -> replaced by SST2488 -dotnet_diagnostic.S2166.severity = none # Classes named like "Exception" should extend "Exception" or a subclass - DUPLICATE CA1710 -dotnet_diagnostic.S2234.severity = none # Arguments should be passed in the same order as the method parameters -> replaced by SST2400 +dotnet_diagnostic.S1871.severity = none # Two branches with the same implementation — covered by SST2414 +dotnet_diagnostic.S2139.severity = none # Exceptions logged and rethrown — replaced by SST2488 +dotnet_diagnostic.S2166.severity = none # Exception-named classes should extend Exception — covered by CA1710 +dotnet_diagnostic.S2234.severity = none # Arguments passed in parameter order — replaced by SST2400 dotnet_diagnostic.S2326.severity = none # Covered by SST1452 (canonical) -dotnet_diagnostic.S2327.severity = none # "try" statements with identical "catch" and/or "finally" blocks should be merged -> replaced by SST2490 -dotnet_diagnostic.S2357.severity = none # Fields should be private — duplicate of SST1401 (canonical); fields intentionally exposed (e.g. public test fields for reflection) already carry per-site SST1401 suppressions +dotnet_diagnostic.S2327.severity = none # try statements with identical catch or finally — replaced by SST2490 +dotnet_diagnostic.S2357.severity = none # Fields should be private — covered by SST1401; exposed fields are suppressed dotnet_diagnostic.S2372.severity = none # Exceptions should not be thrown from property getters — covered by SST1485 dotnet_diagnostic.S2376.severity = none # Write-only properties should not be used — covered by SST1421 dotnet_diagnostic.S2629.severity = none # Logging templates should be constant -> replaced by CA2254 dotnet_diagnostic.S2681.severity = none # Multiline blocks should be enclosed in curly braces — covered by SST1503 -dotnet_diagnostic.S2743.severity = none # Static fields should not be used in generic types - DUPLICATE CA1000 — covered by SST1431 +dotnet_diagnostic.S2743.severity = none # Static fields in generic types — covered by SST1431 dotnet_diagnostic.S2925.severity = none # "Thread.Sleep" should not be used in tests — covered by SST2506 -dotnet_diagnostic.S2933.severity = none # Fields that are only assigned in the constructor should be "readonly" - DUPLICATE IDE0044 +dotnet_diagnostic.S2933.severity = none # Constructor-only assigned fields should be readonly — IDE0044 dotnet_diagnostic.S2971.severity = none # LINQ expressions should be simplified — covered by PSH1101/PSH1102 dotnet_diagnostic.S3010.severity = none # Static fields should not be updated in constructors — covered by SST2402 -dotnet_diagnostic.S3011.severity = none # Reflection should not be used to increase accessibility of classes, methods, or fields -> replaced by SES1406 -dotnet_diagnostic.S3059.severity = none # Types should not have members with visibility set higher than the type's visibility +dotnet_diagnostic.S3011.severity = none # Reflection used to increase accessibility — replaced by SES1406 +dotnet_diagnostic.S3059.severity = none # Members more visible than their containing type dotnet_diagnostic.S3063.severity = none # "StringBuilder" data should be used — covered by SST2408 dotnet_diagnostic.S3169.severity = none # Multiple "OrderBy" calls should not be used — covered by PSH1108 -dotnet_diagnostic.S3246.severity = none # Generic type parameters should be co/contravariant when possible -> off: low-precision variance suggestion; not enforced +dotnet_diagnostic.S3246.severity = none # Generic parameters should be co/contravariant — low precision dotnet_diagnostic.S3262.severity = none # "params" should be used on overrides — covered by SST2426 dotnet_diagnostic.S3264.severity = none # Events should be invoked — covered by SST2407 dotnet_diagnostic.S3358.severity = none # Ternary operators should not be nested — covered by SST1147 @@ -2412,7 +2427,7 @@ dotnet_diagnostic.S3431.severity = none # "[ExpectedException]" should not be us dotnet_diagnostic.S3442.severity = none # "abstract" classes should not have "public" constructors — covered by SST1428 dotnet_diagnostic.S3445.severity = none # Exceptions should not be explicitly rethrown — covered by SST1430 dotnet_diagnostic.S3457.severity = none # Composite format strings should be used correctly — covered by SST1454 -dotnet_diagnostic.S3597.severity = none # "ServiceContract" and "OperationContract" attributes should be used together -> replaced by obsolete (WCF) +dotnet_diagnostic.S3597.severity = none # ServiceContract and OperationContract together — replaced by obsolete dotnet_diagnostic.S3880.severity = none # Finalizers should not be empty — covered by PSH1002 dotnet_diagnostic.S3881.severity = none # "IDisposable" should be implemented correctly — covered by SST2300 dotnet_diagnostic.S3885.severity = none # "Assembly.Load" should be used -> replaced by SST2486 @@ -2421,17 +2436,17 @@ dotnet_diagnostic.S3902.severity = none # Covered by PSH1404 (canonical) dotnet_diagnostic.S3906.severity = none # Event Handlers should have the correct signature — covered by SST2304 dotnet_diagnostic.S3908.severity = none # Generic event handlers should be used -> replaced by SST2304 dotnet_diagnostic.S3909.severity = none # Collections should implement the generic interface -> replaced by CA1010 -dotnet_diagnostic.S3925.severity = none # "ISerializable" should be implemented correctly - BinaryFormatter / ISerializable serialization is obsoleted (SYSLIB0050/0051) in modern .NET; we do not opt into legacy serialization for any exception type -dotnet_diagnostic.S3928.severity = none # Parameter names used into ArgumentException constructors should match an existing one - DUPLICATE CA2208 +dotnet_diagnostic.S3925.severity = none # ISerializable should be implemented correctly — legacy path is obsolete +dotnet_diagnostic.S3928.severity = none # ArgumentException parameter names should exist — covered by CA2208 dotnet_diagnostic.S3956.severity = none # "Generic.List" instances should not be part of public APIs -dotnet_diagnostic.S3971.severity = none # "GC.SuppressFinalize" should not be called — conflicts with PSH1008, which owns the pointless-SuppressFinalize direction and exempts unsealed types +dotnet_diagnostic.S3971.severity = none # GC.SuppressFinalize should not be called — conflicts with PSH1008 dotnet_diagnostic.S3990.severity = none # Assemblies should be marked as CLS compliant -> replaced by CA1014 dotnet_diagnostic.S3992.severity = none # Assemblies should explicitly specify COM visibility -> replaced by CA1017 -dotnet_diagnostic.S3993.severity = none # Custom attributes should be marked with "System.AttributeUsageAttribute" -> replaced by CA1018 +dotnet_diagnostic.S3993.severity = none # Custom attributes need AttributeUsage — replaced by CA1018 dotnet_diagnostic.S3994.severity = none # URI Parameters should not be strings dotnet_diagnostic.S3995.severity = none # URI return values should not be strings dotnet_diagnostic.S3996.severity = none # URI properties should not be strings -dotnet_diagnostic.S3997.severity = none # String URI overloads should call "System.Uri" overloads -> replaced by CA1054/CA1056/CA1057 +dotnet_diagnostic.S3997.severity = none # String URI overloads should call Uri overloads — replaced by CA1054 dotnet_diagnostic.S4002.severity = none # Disposable types should declare finalizers — covered by SST2317 dotnet_diagnostic.S4004.severity = none # Collection properties should be readonly — covered by SST2305 dotnet_diagnostic.S4005.severity = none # "System.Uri" arguments should be used instead of strings @@ -2448,34 +2463,34 @@ dotnet_diagnostic.S4200.severity = none # Native methods should be wrapped -> re dotnet_diagnostic.S4214.severity = none # "P/Invoke" methods should not be visible - DUPLICATE CA1401 dotnet_diagnostic.S4220.severity = none # Events should have proper arguments — covered by SST2436 dotnet_diagnostic.S4456.severity = none # Parameter validation in yielding methods should be wrapped — covered by SST2404 -dotnet_diagnostic.S4457.severity = none # Parameter validation in "async"/"await" methods should be wrapped — covered by SST2325 -dotnet_diagnostic.S4545.severity = none # "DebuggerDisplayAttribute" strings should reference existing members — covered by SST2405 +dotnet_diagnostic.S4457.severity = none # Parameter validation in async methods — covered by SST2325 +dotnet_diagnostic.S4545.severity = none # DebuggerDisplay should name real members — covered by SST2405 dotnet_diagnostic.S4581.severity = none # "new Guid()" should not be used — covered by SST2012 dotnet_diagnostic.S6354.severity = none # Use a testable date/time provider — covered by SST2010 -dotnet_diagnostic.S6419.severity = none # Azure Functions should be stateless -> off: Azure Functions-specific; not used in this library -dotnet_diagnostic.S6420.severity = none # Client instances should not be recreated on each Azure Function invocation — covered by PSH1418 -dotnet_diagnostic.S6421.severity = none # Azure Functions should use Structured Error Handling -> off: Azure Functions-specific; not used in this library -dotnet_diagnostic.S6423.severity = none # Azure Functions should log all failures -> off: Azure Functions-specific; not used in this library -dotnet_diagnostic.S6561.severity = none # Avoid using "DateTime.Now" for benchmarking or timing operations — covered by PSH1408 +dotnet_diagnostic.S6419.severity = none # Azure Functions should be stateless — not used in this library +dotnet_diagnostic.S6420.severity = none # Clients recreated per Azure Function call — covered by PSH1418 +dotnet_diagnostic.S6421.severity = none # Azure Functions structured error handling — not used in this library +dotnet_diagnostic.S6423.severity = none # Azure Functions should log all failures — not used in this library +dotnet_diagnostic.S6561.severity = none # DateTime.Now used for timing — covered by PSH1408 dotnet_diagnostic.S6562.severity = none # Covered by SST1451 (canonical) dotnet_diagnostic.S6563.severity = none # Use UTC when recording DateTime instants — covered by SST2011 dotnet_diagnostic.S6566.severity = none # Use "DateTimeOffset" instead of "DateTime" — covered by SST2016 -dotnet_diagnostic.S6575.severity = none # Use "TimeZoneInfo.FindSystemTimeZoneById" without converting the timezones with "TimezoneConverter" -> replaced by PSH1419 +dotnet_diagnostic.S6575.severity = none # FindSystemTimeZoneById conversions — replaced by PSH1419 dotnet_diagnostic.S6580.severity = none # Use a format provider when parsing date and time - DUPLICATE CA1305 -dotnet_diagnostic.S6673.severity = none # Log message template placeholders should be in the right order — covered by SST2440 -dotnet_diagnostic.S6802.severity = none # Using lambda expressions in loops should be avoided in Blazor markup section -> replaced by PSH1600 -dotnet_diagnostic.S6803.severity = none # Parameters with SupplyParameterFromQuery attribute should be used only in routable components -> off: Blazor-specific; no Blazor surface in this library -dotnet_diagnostic.S6931.severity = none # ASP.NET controller actions should not have a route template starting with "/" -> off: ASP.NET MVC-specific; no controllers in this library -dotnet_diagnostic.S6932.severity = none # Use model binding instead of reading raw request data -> off: ASP.NET MVC-specific; no controllers in this library -dotnet_diagnostic.S6934.severity = none # A Route attribute should be added to the controller when a route template is specified at the action level -> off: ASP.NET MVC-specific; no controllers in this library -dotnet_diagnostic.S6960.severity = none # Controllers should not have mixed responsibilities -> off: ASP.NET MVC-specific; no controllers in this library -dotnet_diagnostic.S6961.severity = none # API Controllers should derive from ControllerBase instead of Controller -> off: ASP.NET MVC-specific; no controllers in this library +dotnet_diagnostic.S6673.severity = none # Log template placeholders in the right order — covered by SST2440 +dotnet_diagnostic.S6802.severity = none # Lambdas in Blazor markup loops — replaced by PSH1600 +dotnet_diagnostic.S6803.severity = none # SupplyParameterFromQuery outside routable components — no Blazor here +dotnet_diagnostic.S6931.severity = none # Controller routes starting with / — no controllers in this library +dotnet_diagnostic.S6932.severity = none # Model binding over raw request data — no controllers in this library +dotnet_diagnostic.S6934.severity = none # Route attribute on the controller — no controllers in this library +dotnet_diagnostic.S6960.severity = none # Controllers with mixed responsibilities — no controllers here +dotnet_diagnostic.S6961.severity = none # API controllers should derive from ControllerBase — none here dotnet_diagnostic.S6962.severity = none # You should pool HTTP connections with HttpClientFactory — covered by PSH1418 -dotnet_diagnostic.S6964.severity = none # Value type property used as input in a controller action should be nullable, required or annotated with the JsonRequiredAttribute to avoid under-posting. -> replaced by SST2705 (opt-in) -dotnet_diagnostic.S6965.severity = none # REST API actions should be annotated with an HTTP verb attribute -> replaced by SST2704 +dotnet_diagnostic.S6964.severity = none # Value-type inputs should be nullable or required — replaced by SST2705 +dotnet_diagnostic.S6965.severity = none # REST actions need an HTTP verb attribute — replaced by SST2704 dotnet_diagnostic.S6966.severity = none # Awaitable method should be used — covered by PSH1313 -dotnet_diagnostic.S6968.severity = none # Actions that return a value should be annotated with ProducesResponseTypeAttribute containing the return type -> off: ASP.NET MVC-specific; no controllers in this library -dotnet_diagnostic.S881.severity = none # Increment (++) and decrement (--) operators should not be used in a method call or mixed with other operators in an expression — covered by SST2015 +dotnet_diagnostic.S6968.severity = none # Actions should declare ProducesResponseType — no controllers here +dotnet_diagnostic.S881.severity = none # ++ or -- mixed into a larger expression — covered by SST2015 dotnet_diagnostic.S907.severity = none # "goto" statement should not be used — covered by SST2014 # Minor code smells @@ -2483,26 +2498,26 @@ dotnet_diagnostic.S100.severity = none # Methods and properties should be named dotnet_diagnostic.S101.severity = none # Types should be named in PascalCase — covered by SST1300 dotnet_diagnostic.S105.severity = none # Tabulation characters should not be used — covered by SST1027 dotnet_diagnostic.S1104.severity = none # Fields should not have public accessibility - DUPLICATE CA1051 -dotnet_diagnostic.S1109.severity = none # A close curly brace should be located at the beginning of a line — covered by SST1500 +dotnet_diagnostic.S1109.severity = none # A close brace should start its line — covered by SST1500 dotnet_diagnostic.S1116.severity = none # Empty statements should be removed - DUPLICATE SA1106 dotnet_diagnostic.S1125.severity = none # Boolean literals should not be redundant — covered by SST1182 dotnet_diagnostic.S1128.severity = none # Covered by SST1445 (canonical) dotnet_diagnostic.S113.severity = none # Files should end with a newline dotnet_diagnostic.S1155.severity = none # "Any()" should be used to test for emptiness — covered by PSH1119 -dotnet_diagnostic.S1185.severity = none # Overriding members should do more than simply call the same member in the base class - DUPLICATE RCS1132 +dotnet_diagnostic.S1185.severity = none # Overrides that only call the base — covered by RCS1132 dotnet_diagnostic.S1192.severity = none # String literals should not be duplicated — covered by SST1486 dotnet_diagnostic.S1199.severity = none # Nested code blocks should not be used — covered by SST1138 -dotnet_diagnostic.S1210.severity = none # "Equals" and the comparison operators should be overridden when implementing "IComparable" - DUPLICATE CA1036 +dotnet_diagnostic.S1210.severity = none # IComparable types should override Equals and operators — CA1036 dotnet_diagnostic.S1227.severity = none # break statements should not be used except for switch cases dotnet_diagnostic.S1264.severity = none # A "while" loop should be used instead of a "for" loop — covered by SST2245 dotnet_diagnostic.S1301.severity = none # "switch" statements should have at least 3 "case" clauses dotnet_diagnostic.S1312.severity = none # Logger fields should be "private static readonly" dotnet_diagnostic.S1449.severity = none # Culture should be specified for "string" operations — covered by PSH1207 -dotnet_diagnostic.S1450.severity = none # Private fields only used as local variables in methods should become local variables — covered by SST1422 +dotnet_diagnostic.S1450.severity = none # Private fields used only as locals — covered by SST1422 dotnet_diagnostic.S1481.severity = none # Unused local variables should be removed — covered by SST1497 dotnet_diagnostic.S1643.severity = none # Covered by PSH1206 (canonical) dotnet_diagnostic.S1659.severity = none # Multiple variables should not be declared on the same line — covered by SST1132 -dotnet_diagnostic.S1694.severity = none # An abstract class should have both abstract and concrete methods — covered by SST2323 +dotnet_diagnostic.S1694.severity = none # Abstract classes need abstract and concrete methods — SST2323 dotnet_diagnostic.S1698.severity = none # "==" should not be used when "Equals" is overridden — covered by SST1495 dotnet_diagnostic.S1858.severity = none # "ToString()" calls should not be redundant — covered by PSH1211 dotnet_diagnostic.S1905.severity = none # Redundant casts should not be used - DUPLICATE IDE0004 — covered by SST1175 @@ -2514,95 +2529,95 @@ dotnet_diagnostic.S2156.severity = none # "sealed" classes should not have "prot dotnet_diagnostic.S2219.severity = none # Runtime type checking should be simplified — covered by SST2007 dotnet_diagnostic.S2221.severity = none # "Exception" should not be caught dotnet_diagnostic.S2292.severity = none # Trivial properties should be auto-implemented — covered by SST1420 -dotnet_diagnostic.S2325.severity = none # Methods and properties that don't access instance data should be static - DUPLICATE CA1822 +dotnet_diagnostic.S2325.severity = none # Members not touching instance data should be static — CA1822 dotnet_diagnostic.S2333.severity = none # Redundant modifiers should not be used — covered by SST1419/SST1491 dotnet_diagnostic.S2342.severity = none # Enumeration types should comply with a naming convention — covered by SST1319 -dotnet_diagnostic.S2344.severity = none # Enumeration type names should not have "Flags" or "Enum" suffixes - DUPLICATE CA1711 +dotnet_diagnostic.S2344.severity = none # Enum names should not end in Flags or Enum — covered by CA1711 dotnet_diagnostic.S2386.severity = none # Mutable fields should not be "public static" — covered by SST1499 dotnet_diagnostic.S2486.severity = none # Generic exceptions should not be ignored — covered by SST1429 dotnet_diagnostic.S2737.severity = none # "catch" clauses should do more than rethrow — covered by SST1470 dotnet_diagnostic.S2760.severity = none # Sequential tests should not check the same condition — covered by SST1475 dotnet_diagnostic.S3052.severity = none # Covered by PSH1403 (canonical) -dotnet_diagnostic.S3220.severity = none # Method calls should not resolve ambiguously to overloads with "params" — covered by SST2467 +dotnet_diagnostic.S3220.severity = none # Ambiguous resolution to params overloads — covered by SST2467 dotnet_diagnostic.S3234.severity = none # Covered by PSH1008 (canonical) dotnet_diagnostic.S3235.severity = none # Redundant parentheses should not be used — covered by SST1459 dotnet_diagnostic.S3236.severity = none # Covered by SST1448 (canonical) dotnet_diagnostic.S3240.severity = none # The simplest possible condition syntax should be used - duplicate of SST1198 -dotnet_diagnostic.S3241.severity = none # Methods should not return values that are never used -> off: needs whole-program analysis; not enforced here +dotnet_diagnostic.S3241.severity = none # Return values never used — needs whole-program analysis dotnet_diagnostic.S3242.severity = none # Method parameters should be declared with base types dotnet_diagnostic.S3247.severity = none # Duplicate casts should not be made — covered by SST1175 dotnet_diagnostic.S3251.severity = none # Implementations should be provided for "partial" methods — covered by SST2468 -dotnet_diagnostic.S3253.severity = none # Constructor and destructor declarations should not be redundant — covered by SST1433 +dotnet_diagnostic.S3253.severity = none # Redundant constructor and destructor declarations — SST1433 dotnet_diagnostic.S3254.severity = none # Default parameter values should not be passed as arguments — covered by SST1494 dotnet_diagnostic.S3256.severity = none # "string.IsNullOrEmpty" should be used — covered by PSH1204 (style configurable) -dotnet_diagnostic.S3257.severity = none # Declarations and initializations should be as concise as possible -> replaced by SST2202 -dotnet_diagnostic.S3260.severity = none # Non-derived "private" classes and records should be "sealed" — covered by PSH1411 +dotnet_diagnostic.S3257.severity = none # Declarations should be as concise as possible — replaced by SST2202 +dotnet_diagnostic.S3260.severity = none # Non-derived private classes should be sealed — covered by PSH1411 dotnet_diagnostic.S3261.severity = none # Namespaces should not be empty — covered by SST1435 dotnet_diagnostic.S3267.severity = none # Loops should be simplified with "LINQ" expressions -dotnet_diagnostic.S3376.severity = none # Attribute, EventArgs, and Exception type names should end with the type being extended - DUPLICATE CA1710 -dotnet_diagnostic.S3398.severity = none # "private" methods called only by inner classes should be moved to those classes — covered by SST1498 +dotnet_diagnostic.S3376.severity = none # Attribute and Exception type name suffixes — covered by CA1710 +dotnet_diagnostic.S3398.severity = none # Private methods used only by inner classes — covered by SST1498 dotnet_diagnostic.S3400.severity = none # Methods should not return constants — covered by SST1493 dotnet_diagnostic.S3416.severity = none # Loggers should be named for their enclosing types — covered by SST2443 -dotnet_diagnostic.S3440.severity = none # Variables should not be checked against the values they're about to be assigned — covered by SST1492 -dotnet_diagnostic.S3441.severity = none # Redundant property names should be omitted in anonymous classes — covered by SST1173 -dotnet_diagnostic.S3444.severity = none # Interfaces should not simply inherit from base interfaces with colliding members — covered by SST2320 -dotnet_diagnostic.S3450.severity = none # Parameters with "[DefaultParameterValue]" attributes should also be marked "[Optional]" -> replaced by obsolete (legacy DefaultParameterValue) -dotnet_diagnostic.S3458.severity = none # Empty "case" clauses that fall through to the "default" should be omitted — covered by SST1466 -dotnet_diagnostic.S3459.severity = none # Unassigned members should be removed - the compiler reports this as CS0649; the rule only ever fires on private never-assigned fields +dotnet_diagnostic.S3440.severity = none # Variables checked against the value being assigned — SST1492 +dotnet_diagnostic.S3441.severity = none # Redundant property names in anonymous types — covered by SST1173 +dotnet_diagnostic.S3444.severity = none # Interfaces inheriting colliding members — covered by SST2320 +dotnet_diagnostic.S3450.severity = none # [DefaultParameterValue] needs [Optional] — replaced by obsolete +dotnet_diagnostic.S3458.severity = none # Empty case clauses falling through to default — covered by SST1466 +dotnet_diagnostic.S3459.severity = none # Unassigned members should be removed — the compiler reports CS0649 dotnet_diagnostic.S3532.severity = none # Empty "default" clauses should be removed — covered by SST1179 dotnet_diagnostic.S3604.severity = none # Member initializer values should not be redundant — covered by PSH1403 dotnet_diagnostic.S3626.severity = none # Jump statements should not be redundant — covered by SST1174 dotnet_diagnostic.S3717.severity = none # Track use of "NotImplementedException" -> replaced by SST2485 -dotnet_diagnostic.S3872.severity = none # Parameter names should not duplicate the names of their methods -> replaced by SST1320 +dotnet_diagnostic.S3872.severity = none # Parameter names duplicating the method name — replaced by SST1320 dotnet_diagnostic.S3876.severity = none # Strings or integral types should be used for indexers -> replaced by CA1043 dotnet_diagnostic.S3878.severity = none # Arrays should not be created for params parameters — covered by PSH1018 -dotnet_diagnostic.S3897.severity = none # Classes that provide "Equals()" should implement "IEquatable" -> replaced by CA1067 +dotnet_diagnostic.S3897.severity = none # Types with Equals(T) should implement IEquatable — CA1067 dotnet_diagnostic.S3962.severity = none # Covered by PSH1402 (canonical) dotnet_diagnostic.S3963.severity = none # "static" fields should be initialized inline - DUPLICATE CA1810 dotnet_diagnostic.S3967.severity = none # Multidimensional arrays should not be used - DUPLICATE CA1814 -dotnet_diagnostic.S4018.severity = none # All type parameters should be used in the parameter list to enable type inference — covered by SST2307 +dotnet_diagnostic.S4018.severity = none # All type parameters should appear in the parameter list — SST2307 dotnet_diagnostic.S4022.severity = none # Enumerations should have "Int32" storage — covered by SST2313 dotnet_diagnostic.S4023.severity = none # Interfaces should not be empty — covered by SST1437 -dotnet_diagnostic.S4026.severity = none # Assemblies should be marked with "NeutralResourcesLanguageAttribute" -> replaced by CA1824 +dotnet_diagnostic.S4026.severity = none # Assemblies need NeutralResourcesLanguage — replaced by CA1824 dotnet_diagnostic.S4027.severity = none # Exceptions should provide standard constructors — covered by SST1488 dotnet_diagnostic.S4040.severity = none # Strings should be normalized to uppercase - DUPLICATE CA1308 dotnet_diagnostic.S4041.severity = none # Type names should not match namespaces - DUPLICATE CA1724 -dotnet_diagnostic.S4047.severity = none # Generics should be used when appropriate -> off: fuzzy prefer-generics suggestion; not enforced +dotnet_diagnostic.S4047.severity = none # Generics should be used when appropriate — fuzzy, not enforced dotnet_diagnostic.S4049.severity = none # Properties should be preferred - DUPLICATE CA1024 dotnet_diagnostic.S4052.severity = none # Types should not extend outdated base types -> replaced by obsolete -dotnet_diagnostic.S4056.severity = none # Overloads with a "CultureInfo" or an "IFormatProvider" parameter should be used - DUPLICATE CA1305 +dotnet_diagnostic.S4056.severity = none # CultureInfo or IFormatProvider overloads — covered by CA1305 dotnet_diagnostic.S4058.severity = none # Covered by PSH1207 (canonical) dotnet_diagnostic.S4060.severity = none # Non-abstract attributes should be sealed - DUPLICATE CA1813 -dotnet_diagnostic.S4061.severity = none # "params" should be used instead of "varargs" -> replaced by obsolete (__arglist varargs) +dotnet_diagnostic.S4061.severity = none # params should be used instead of varargs — replaced by obsolete dotnet_diagnostic.S4069.severity = none # Operator overloads should have named alternatives - DUPLICATE CA2225 dotnet_diagnostic.S4136.severity = none # Method overloads should be grouped together — covered by SST1218 -dotnet_diagnostic.S4201.severity = none # Null checks should not be combined with "is" operator checks — covered by SST2018 +dotnet_diagnostic.S4201.severity = none # Null checks combined with is checks — covered by SST2018 dotnet_diagnostic.S4225.severity = none # Extension methods should not extend "object" — covered by SST1706 dotnet_diagnostic.S4226.severity = none # Extensions should be in separate namespaces -dotnet_diagnostic.S4261.severity = none # Methods should be named according to their synchronicities - Async suffix not used +dotnet_diagnostic.S4261.severity = none # Methods named for their synchronicity — no Async suffix here dotnet_diagnostic.S4663.severity = none # Covered by SST1120 (canonical) -dotnet_diagnostic.S6513.severity = none # "ExcludeFromCodeCoverage" attributes should include a justification - not available on net462 and older TFMs -dotnet_diagnostic.S6585.severity = none # Don't hardcode the format when turning dates and times to strings — covered by SST2445 -dotnet_diagnostic.S6588.severity = none # Use the "UnixEpoch" field instead of creating "DateTime" instances that point to the beginning of the Unix epoch — covered by PSH1413 +dotnet_diagnostic.S6513.severity = none # ExcludeFromCodeCoverage justification — not available on net462 +dotnet_diagnostic.S6585.severity = none # Hardcoded date and time formats — covered by SST2445 +dotnet_diagnostic.S6588.severity = none # DateTime.UnixEpoch should be used — covered by PSH1413 dotnet_diagnostic.S6594.severity = none # Covered by PSH1406 (canonical) dotnet_diagnostic.S6602.severity = none # Covered by PSH1110 (canonical) dotnet_diagnostic.S6603.severity = none # Covered by PSH1110 (canonical) dotnet_diagnostic.S6605.severity = none # Covered by PSH1110 (canonical) dotnet_diagnostic.S6607.severity = none # The collection should be filtered before sorting — covered by PSH1107 dotnet_diagnostic.S6608.severity = none # Covered by PSH1106 (canonical) -dotnet_diagnostic.S6609.severity = none # "Min/Max" properties of "Set" types should be used instead of the "Enumerable" extension methods — covered by PSH1122 +dotnet_diagnostic.S6609.severity = none # Set Min/Max properties over the extensions — covered by PSH1122 dotnet_diagnostic.S6610.severity = none # Covered by PSH1201 (canonical) -dotnet_diagnostic.S6612.severity = none # The lambda parameter should be used instead of capturing arguments in "ConcurrentDictionary" methods — covered by PSH1006 -dotnet_diagnostic.S6613.severity = none # "First" and "Last" properties of "LinkedList" should be used instead of the "First()" and "Last()" extension methods — covered by PSH1124 +dotnet_diagnostic.S6612.severity = none # ConcurrentDictionary lambda parameter over captures — PSH1006 +dotnet_diagnostic.S6613.severity = none # LinkedList First/Last properties over the extensions — PSH1124 dotnet_diagnostic.S6617.severity = none # Covered by PSH1111 (canonical) -dotnet_diagnostic.S6618.severity = none # "string.Create" should be used instead of "FormattableString" — covered by PSH1209 -dotnet_diagnostic.S6664.severity = none # The code block contains too many logging calls -> off: fuzzy too-many-logging-calls metric; not enforced -dotnet_diagnostic.S6667.severity = none # Logging in a catch clause should pass the caught exception as a parameter. — covered by SST2438 +dotnet_diagnostic.S6618.severity = none # string.Create over FormattableString — covered by PSH1209 +dotnet_diagnostic.S6664.severity = none # Too many logging calls in a block — fuzzy metric, not enforced +dotnet_diagnostic.S6667.severity = none # Catch-clause logging should pass the exception — covered by SST2438 dotnet_diagnostic.S6668.severity = none # Logging arguments should be passed to the correct parameter — covered by SST2439 -dotnet_diagnostic.S6669.severity = none # Logger field or property name should comply with a naming convention -> replaced by SST2601 +dotnet_diagnostic.S6669.severity = none # Logger field naming convention — replaced by SST2601 dotnet_diagnostic.S6670.severity = none # "Trace.Write" and "Trace.WriteLine" should not be used — covered by SST2600 dotnet_diagnostic.S6672.severity = none # Generic logger injection should match enclosing type — covered by SST2443 -dotnet_diagnostic.S6675.severity = none # "Trace.WriteLineIf" should not be used with "TraceSwitch" levels -> off: niche TraceSwitch misuse; not enforced here +dotnet_diagnostic.S6675.severity = none # Trace.WriteLineIf with TraceSwitch levels — niche, not enforced dotnet_diagnostic.S6678.severity = none # Use PascalCase for named placeholders -> replaced by CA1727 dotnet_diagnostic.S818.severity = none # Literal suffixes should be upper case — covered by SST2244 @@ -2623,38 +2638,34 @@ dotnet_diagnostic.S9999-token-type.severity = error # Token type calculator dotnet_diagnostic.S9999-warning.severity = error # Analysis Warning generator # Critical security hotspots -dotnet_diagnostic.S2245.severity = none # Using pseudorandom number generators (PRNGs) is security-sensitive - DUPLICATE CA5394 -dotnet_diagnostic.S2257.severity = none # Using non-standard cryptographic algorithms is security-sensitive -> replaced by SES1007 -dotnet_diagnostic.S4502.severity = none # Disabling CSRF protections is security-sensitive -> replaced by in-box ASP.NET antiforgery analyzer +dotnet_diagnostic.S2245.severity = none # Pseudorandom number generators are sensitive — covered by CA5394 +dotnet_diagnostic.S2257.severity = none # Non-standard cryptographic algorithms — replaced by SES1007 +dotnet_diagnostic.S4502.severity = none # Disabling CSRF protections — replaced by the in-box antiforgery analyzer dotnet_diagnostic.S4790.severity = none # Using weak hashing algorithms is security-sensitive -> replaced by CA5350/CA5351 -dotnet_diagnostic.S4792.severity = none # Configuring loggers is security-sensitive -> off: logging-configuration audit hotspot; not enforced here -dotnet_diagnostic.S5042.severity = none # Expanding archive files without controlling resource consumption is security-sensitive -> off: unbounded decompression; needs taint analysis, out of scope +dotnet_diagnostic.S4792.severity = none # Configuring loggers is security-sensitive — not enforced here +dotnet_diagnostic.S5042.severity = none # Unbounded archive expansion — needs taint analysis, out of scope dotnet_diagnostic.S5332.severity = none # Using clear-text protocols is security-sensitive -> replaced by SES1106 dotnet_diagnostic.S5443.severity = none # Using publicly writable directories is security-sensitive -> replaced by SES1308 # Major security hotspots -dotnet_diagnostic.S1313.severity = none # Using hardcoded IP addresses is security-sensitive -> off: hardcoded-IP heuristic; too noisy to enforce +dotnet_diagnostic.S1313.severity = none # Hardcoded IP addresses — too noisy to enforce dotnet_diagnostic.S2077.severity = none # Formatting SQL queries is security-sensitive -> replaced by CA2100 -dotnet_diagnostic.S5693.severity = none # Allowing requests with excessive content length is security-sensitive -> replaced by SES1505 -dotnet_diagnostic.S5753.severity = none # Disabling ASP.NET "Request Validation" feature is security-sensitive -> replaced by obsolete (legacy ASP.NET request validation) -dotnet_diagnostic.S5766.severity = none # Creating Serializable objects without data validation checks is security-sensitive -> off: legacy BinaryFormatter deserialization; obsolete path, not used here -dotnet_diagnostic.S6444.severity = none # Not specifying a timeout for regular expressions is security-sensitive -> replaced by SES1509 -dotnet_diagnostic.S6640.severity = none # Using unsafe code blocks is security-sensitive -> off: unsafe-code audit; not enforced here +dotnet_diagnostic.S5693.severity = none # Excessive request content length — replaced by SES1505 +dotnet_diagnostic.S5753.severity = none # Disabling ASP.NET request validation — replaced by obsolete +dotnet_diagnostic.S5766.severity = none # Serializable objects without validation — obsolete path, unused +dotnet_diagnostic.S6444.severity = none # Regular expressions without a timeout — replaced by SES1509 +dotnet_diagnostic.S6640.severity = none # Unsafe code blocks — not enforced here # Minor security hotspots -dotnet_diagnostic.S2092.severity = none # Creating cookies without the "secure" flag is security-sensitive -> replaced by CA5382 -dotnet_diagnostic.S3330.severity = none # Creating cookies without the "HttpOnly" flag is security-sensitive -> replaced by CA5383 -dotnet_diagnostic.S4507.severity = none # Delivering code in production with debug features activated is security-sensitive -> off: debug features in production; partly covered by SES1506, rest not enforced -dotnet_diagnostic.S5122.severity = none # Having a permissive Cross-Origin Resource Sharing policy is security-sensitive -> replaced by SES1501 +dotnet_diagnostic.S2092.severity = none # Cookies without the secure flag — replaced by CA5382 +dotnet_diagnostic.S3330.severity = none # Cookies without the HttpOnly flag — replaced by CA5383 +dotnet_diagnostic.S4507.severity = none # Debug features in production — partly covered by SES1506 +dotnet_diagnostic.S5122.severity = none # Permissive CORS policy — replaced by SES1501 ############################################# # JetBrains ReSharper / Rider Inspections ############################################# -# Mirrors the CA / SA / RCS choices above for Rider and ReSharper users. Only -# inspections with a clear mapping to our Roslyn analyzer rules are listed; -# every other ReSharper inspection keeps its default severity. The goal is to -# avoid Rider double-reporting things the Roslyn analyzers already catch and -# to keep IDE severities in sync with CI-enforced severities. +# Mirrors the choices above so the IDE does not double-report; unlisted keep their defaults. ################### # ReSharper - Layout / Formatting (covered by StyleCop SA) @@ -2713,7 +2724,7 @@ resharper_redundant_to_string_call_highlighting = none # handled by RCS1097 ################### # ReSharper - Naming (matches SA/CA naming rules) ################### -resharper_inconsistent_naming_highlighting = none # too many false positives on test/fixture naming; SA1300 family covers the real cases +resharper_inconsistent_naming_highlighting = none # too many false positives; the naming rules above cover the real cases ################### # ReSharper - Unused code (matches CA1801 / CA1823 / IDE0051-0052) @@ -2829,10 +2840,3 @@ end_of_line = lf [*.{cmd, bat}] end_of_line = lf - -############################################# -# Test projects (TUnit) -############################################# -# TUnit instantiates test classes per test, so they must remain instance classes and -# cannot be marked static — even when a partial declaration happens to hold only static -# members (the instance [Test] methods live in sibling partial files). diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 321613c2..6e76fa0a 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -7,13 +7,13 @@ 10.0.90 - 11.0.0-preview.6.26360.8 + 11.0.0-preview.7.26406.9 - 3.39.2 + 3.45.0 @@ -55,7 +55,8 @@ - + + diff --git a/src/ReactiveUI.Binding.Analyzer/Analyzers/AnalyzerHelpers.cs b/src/ReactiveUI.Binding.Analyzer/Analyzers/AnalyzerHelpers.cs index 8a8b22c1..13f0d23c 100644 --- a/src/ReactiveUI.Binding.Analyzer/Analyzers/AnalyzerHelpers.cs +++ b/src/ReactiveUI.Binding.Analyzer/Analyzers/AnalyzerHelpers.cs @@ -15,18 +15,9 @@ internal static class AnalyzerHelpers /// The method symbol to check. /// true if the method is from our generated extension class. [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static bool IsBindingExtensionMethod(IMethodSymbol methodSymbol) - { - var containingType = methodSymbol.ContainingType; - if (containingType is null) - { - return false; - } - - var name = containingType.Name; - return name is SourceGenerators.Constants.GeneratedExtensionClassName + internal static bool IsBindingExtensionMethod(IMethodSymbol methodSymbol) => + methodSymbol.ContainingType?.Name is SourceGenerators.Constants.GeneratedExtensionClassName or SourceGenerators.Constants.StubExtensionClassName; - } /// Checks if an expression is an inline lambda (not a variable reference or method call). /// The expression to check. @@ -125,7 +116,7 @@ internal static bool LacksObservableMechanism( out INamedTypeSymbol? sourceType) { sourceType = ExtractFirstTypeArgument(methodSymbol); - return sourceType is null ? false : !TypeAnalyzer.HasObservableMechanism(sourceType, compilation); + return sourceType is not null && !TypeAnalyzer.HasObservableMechanism(sourceType, compilation); } /// @@ -145,7 +136,7 @@ internal static bool LacksBeforeChangeSupport( { mechanism = string.Empty; receiverType = ExtractFirstTypeArgument(methodSymbol); - return receiverType is null ? false : !HasBeforeChangeSupport(receiverType, compilation, out mechanism); + return receiverType is not null && !HasBeforeChangeSupport(receiverType, compilation, out mechanism); } /// @@ -171,7 +162,7 @@ internal static bool ImplementsDataErrorInfo( var dataErrorInfo = compilation.GetTypeByMetadataName(SourceGenerators.Constants.INotifyDataErrorInfoMetadataName); - return dataErrorInfo is null ? false : ImplementsInterface(sourceType, dataErrorInfo); + return dataErrorInfo is not null && ImplementsInterface(sourceType, dataErrorInfo); } /// Determines whether a type implements a specific interface. diff --git a/src/ReactiveUI.Binding.Analyzer/Analyzers/BindingInvocationAnalyzer.cs b/src/ReactiveUI.Binding.Analyzer/Analyzers/BindingInvocationAnalyzer.cs index 271d0fa3..0f9c10d2 100644 --- a/src/ReactiveUI.Binding.Analyzer/Analyzers/BindingInvocationAnalyzer.cs +++ b/src/ReactiveUI.Binding.Analyzer/Analyzers/BindingInvocationAnalyzer.cs @@ -57,7 +57,7 @@ internal static void AnalyzeInvocation(in OperationAnalysisContext context) var arguments = invocationOp.Arguments; // Check RXUIBIND001: Non-inline lambda - CheckNonInlineLambda(context, arguments, methodName); + CheckNonInlineLambda(context, arguments); // Check RXUIBIND003: Private/protected member access CheckPrivateMember(context, arguments); @@ -95,11 +95,9 @@ internal static void AnalyzeInvocation(in OperationAnalysisContext context) /// Checks for RXUIBIND001: Expression arguments that are not inline lambdas. /// The operation analysis context. /// The invocation arguments to inspect. - /// The name of the method being invoked. internal static void CheckNonInlineLambda( in OperationAnalysisContext context, - ImmutableArray arguments, - string methodName) + ImmutableArray arguments) { // Find the Expression> arguments for (var i = 0; i < arguments.Length; i++) @@ -458,22 +456,13 @@ internal static void WalkForUnsupportedSegments( } /// Extracts the body expression from a lambda expression syntax node. - /// Only and exist in Roslyn's C# syntax model. /// The lambda expression syntax node to extract the body from. /// /// The body as an , or null if the lambda body is a block statement. /// [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] - internal static ExpressionSyntax? GetLambdaBody(LambdaExpressionSyntax lambda) - { - if (lambda is SimpleLambdaExpressionSyntax simple) - { - return simple.Body as ExpressionSyntax; - } - - var parenthesized = (ParenthesizedLambdaExpressionSyntax)lambda; - return parenthesized.Body as ExpressionSyntax; - } + internal static ExpressionSyntax? GetLambdaBody(LambdaExpressionSyntax lambda) => + lambda.Body as ExpressionSyntax; /// Determines whether a non-empty constant toEvent argument was explicitly supplied. /// The invocation arguments to inspect. diff --git a/src/ReactiveUI.Binding.Maui.Reactive/ReactiveUI.Binding.Maui.Reactive.csproj b/src/ReactiveUI.Binding.Maui.Reactive/ReactiveUI.Binding.Maui.Reactive.csproj index d87c7de4..ef844bd1 100644 --- a/src/ReactiveUI.Binding.Maui.Reactive/ReactiveUI.Binding.Maui.Reactive.csproj +++ b/src/ReactiveUI.Binding.Maui.Reactive/ReactiveUI.Binding.Maui.Reactive.csproj @@ -38,6 +38,7 @@ + diff --git a/src/ReactiveUI.Binding.Maui.Shared/BooleanToVisibilityHints.cs b/src/ReactiveUI.Binding.Maui.Shared/BooleanToVisibilityHints.cs index 935b39dd..3aacd2df 100644 --- a/src/ReactiveUI.Binding.Maui.Shared/BooleanToVisibilityHints.cs +++ b/src/ReactiveUI.Binding.Maui.Shared/BooleanToVisibilityHints.cs @@ -19,5 +19,5 @@ public enum BooleanToVisibilityHints Inverse = 1 << 1, /// Use the Hidden value rather than Collapsed (MAUI only; ignored on WinUI where Hidden is not available). - UseHidden = 1 << 2 + UseHidden = 1 << 2, } diff --git a/src/ReactiveUI.Binding.Maui.Shared/Builder/MauiBindingBuilderExtensions.cs b/src/ReactiveUI.Binding.Maui.Shared/Builder/MauiBindingBuilderExtensions.cs index e81f1e12..8a254a63 100644 --- a/src/ReactiveUI.Binding.Maui.Shared/Builder/MauiBindingBuilderExtensions.cs +++ b/src/ReactiveUI.Binding.Maui.Shared/Builder/MauiBindingBuilderExtensions.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using Splat.Builder; #if REACTIVE_SHIM @@ -22,6 +23,7 @@ public static class MauiBindingBuilderExtensions /// observation (on Windows) and Visibility converters. /// /// The builder instance for chaining. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public IReactiveUIBindingBuilder WithMaui() => ((IReactiveUIBindingBuilder)builder).WithMaui(); } diff --git a/src/ReactiveUI.Binding.Maui.Shared/DependencyObjectObservableForProperty.cs b/src/ReactiveUI.Binding.Maui.Shared/DependencyObjectObservableForProperty.cs index f46b38f0..9561add6 100644 --- a/src/ReactiveUI.Binding.Maui.Shared/DependencyObjectObservableForProperty.cs +++ b/src/ReactiveUI.Binding.Maui.Shared/DependencyObjectObservableForProperty.cs @@ -92,9 +92,9 @@ public int GetAffinityForObject(Type type, string propertyName, bool beforeChang var dependencyProperty = dependencyPropertyFetcher(); var token = depSender.RegisterPropertyChangedCallback(dependencyProperty, handler); - return new ActionDisposable<(DependencyObject sender, DependencyProperty property, long token)>( + return Scope.Create<(DependencyObject Sender, DependencyProperty Property, long Token)>( (depSender, dependencyProperty, token), - static state => state.sender.UnregisterPropertyChangedCallback(state.property, state.token)); + static state => state.Sender.UnregisterPropertyChangedCallback(state.Property, state.Token)); }); } diff --git a/src/ReactiveUI.Binding.Maui/ReactiveUI.Binding.Maui.csproj b/src/ReactiveUI.Binding.Maui/ReactiveUI.Binding.Maui.csproj index de604fad..2f3cb2e3 100644 --- a/src/ReactiveUI.Binding.Maui/ReactiveUI.Binding.Maui.csproj +++ b/src/ReactiveUI.Binding.Maui/ReactiveUI.Binding.Maui.csproj @@ -36,6 +36,7 @@ + diff --git a/src/ReactiveUI.Binding.Platform.Shared/ActionDisposable{TState}.cs b/src/ReactiveUI.Binding.Platform.Shared/ActionDisposable{TState}.cs deleted file mode 100644 index c80e3c19..00000000 --- a/src/ReactiveUI.Binding.Platform.Shared/ActionDisposable{TState}.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved. -// ReactiveUI Association Incorporated licenses this file to you under the MIT license. -// See the LICENSE file in the project root for full license information. - -#if REACTIVE_SHIM -namespace ReactiveUI.Binding.Reactive.Observables; -#else -namespace ReactiveUI.Binding.Observables; -#endif - -/// -/// Runs a teardown action against a state value exactly once. Carrying the state lets the platform -/// observers unhook with a non-capturing lambda, so no closure is allocated per subscription. -/// -/// Each platform assembly compiles its own internal copy; nothing here touches the seam. -/// The type of the state handed to the teardown action. -internal sealed class ActionDisposable : IDisposable -{ - /// The state handed to on disposal. - private readonly TState _state; - - /// The teardown action. - private readonly Action _action; - - /// Guard flag to ensure disposal occurs exactly once (0 = not disposed, 1 = disposed). - private int _disposed; - - /// Initializes a new instance of the class. - /// The state to hand to on disposal. - /// The teardown action. - public ActionDisposable(TState state, Action action) - { - ArgumentExceptionHelper.ThrowIfNull(action); - _state = state; - _action = action; - } - - /// - public void Dispose() - { - if (Interlocked.Exchange(ref _disposed, 1) != 0) - { - return; - } - - _action(_state); - } -} diff --git a/src/ReactiveUI.Binding.Platform.Shared/AnonymousObservable.cs b/src/ReactiveUI.Binding.Platform.Shared/AnonymousObservable.cs index 50a11db4..eb0c0ed0 100644 --- a/src/ReactiveUI.Binding.Platform.Shared/AnonymousObservable.cs +++ b/src/ReactiveUI.Binding.Platform.Shared/AnonymousObservable.cs @@ -12,11 +12,11 @@ namespace ReactiveUI.Binding.Observables; /// An observable whose subscription logic is supplied as a delegate, for the platform observers that /// hook an event on subscribe and hand back the unhook as the subscription. /// +/// The type of the elements in the sequence. /// /// Each platform assembly compiles its own internal copy, so this stays off the public surface of every /// package and out of the seam: it names no scheduler and no notification type. /// -/// The type of the elements in the sequence. internal sealed class AnonymousObservable : IObservable { /// Produces the subscription for an observer, returning the resource that tears it down. diff --git a/src/ReactiveUI.Binding.Reactive/ReactiveUI.Binding.Reactive.csproj b/src/ReactiveUI.Binding.Reactive/ReactiveUI.Binding.Reactive.csproj index b226cb55..33b13273 100644 --- a/src/ReactiveUI.Binding.Reactive/ReactiveUI.Binding.Reactive.csproj +++ b/src/ReactiveUI.Binding.Reactive/ReactiveUI.Binding.Reactive.csproj @@ -24,6 +24,10 @@ + + + + @@ -34,7 +38,7 @@ - + + + + + diff --git a/src/benchmarks/.editorconfig b/src/benchmarks/.editorconfig new file mode 100644 index 00000000..037829b5 --- /dev/null +++ b/src/benchmarks/.editorconfig @@ -0,0 +1,10 @@ +[*.cs] + +################### +# Benchmark harness relaxations +# +# A benchmark class is a harness the runner instantiates and drives; nobody stops on one in a +# debugger to read a summary of it. The models these benchmarks observe still carry a display +# attribute where it earns its place. +################### +dotnet_diagnostic.SST2334.severity = none # Harness types are driven by the runner, not inspected diff --git a/src/benchmarks/ReactiveUI.Binding.Benchmarks.ReactiveUI/ModuleInitializer.cs b/src/benchmarks/ReactiveUI.Binding.Benchmarks.ReactiveUI/ModuleInitializer.cs index 94ca1052..005344a6 100644 --- a/src/benchmarks/ReactiveUI.Binding.Benchmarks.ReactiveUI/ModuleInitializer.cs +++ b/src/benchmarks/ReactiveUI.Binding.Benchmarks.ReactiveUI/ModuleInitializer.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using ReactiveUI.Builder; using Splat; @@ -34,6 +35,7 @@ internal static void EnsureInitialized() private sealed class BenchmarkModeDetector : IModeDetector { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool? InUnitTestRunner() => true; } } diff --git a/src/benchmarks/ReactiveUI.Binding.Benchmarks.ReactiveUI/ReactiveUIBindingBenchmark.cs b/src/benchmarks/ReactiveUI.Binding.Benchmarks.ReactiveUI/ReactiveUIBindingBenchmark.cs index 1ba2d470..1759c214 100644 --- a/src/benchmarks/ReactiveUI.Binding.Benchmarks.ReactiveUI/ReactiveUIBindingBenchmark.cs +++ b/src/benchmarks/ReactiveUI.Binding.Benchmarks.ReactiveUI/ReactiveUIBindingBenchmark.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Diagnostics; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Jobs; @@ -12,6 +13,7 @@ namespace ReactiveUI.Binding.Benchmarks; [SimpleJob(RuntimeMoniker.Net10_0)] [MemoryDiagnoser] [MarkdownExporterAttribute.GitHub] +[DebuggerDisplay("Expression-tree binding over {PropertyChangeCount} changes")] public class ReactiveUIBindingBenchmark { /// The number of property changes to fire during each benchmark iteration. diff --git a/src/benchmarks/ReactiveUI.Binding.Benchmarks.ReactiveUI/ReactiveUIObservationBenchmark.cs b/src/benchmarks/ReactiveUI.Binding.Benchmarks.ReactiveUI/ReactiveUIObservationBenchmark.cs index f799352f..b4e42cf0 100644 --- a/src/benchmarks/ReactiveUI.Binding.Benchmarks.ReactiveUI/ReactiveUIObservationBenchmark.cs +++ b/src/benchmarks/ReactiveUI.Binding.Benchmarks.ReactiveUI/ReactiveUIObservationBenchmark.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Diagnostics; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Jobs; @@ -12,6 +13,7 @@ namespace ReactiveUI.Binding.Benchmarks; [SimpleJob(RuntimeMoniker.Net10_0)] [MemoryDiagnoser] [MarkdownExporterAttribute.GitHub] +[DebuggerDisplay("Expression-tree observation over {PropertyChangeCount} changes")] public class ReactiveUIObservationBenchmark { /// The number of property changes to fire during each benchmark iteration. @@ -60,7 +62,7 @@ public void DeepChain() [Benchmark(Description = "Two Properties")] public void TwoProperties() { - (string name, int age) last = default; + (string Name, int Age) last = default; using var sub = _vm.WhenAnyValue(x => x.Name, x => x.Age, static (name, age) => (name, age)) .Subscribe(v => last = v); diff --git a/src/benchmarks/ReactiveUI.Binding.Benchmarks/BenchmarkChildViewModel.cs b/src/benchmarks/ReactiveUI.Binding.Benchmarks/BenchmarkChildViewModel.cs index e471e42f..09e53360 100644 --- a/src/benchmarks/ReactiveUI.Binding.Benchmarks/BenchmarkChildViewModel.cs +++ b/src/benchmarks/ReactiveUI.Binding.Benchmarks/BenchmarkChildViewModel.cs @@ -3,10 +3,12 @@ // See the LICENSE file in the project root for full license information. using System.ComponentModel; +using System.Diagnostics; namespace ReactiveUI.Binding.Benchmarks; /// A child view model for deep chain benchmarks. +[DebuggerDisplay("Value = {Value}")] public class BenchmarkChildViewModel : INotifyPropertyChanged { /// diff --git a/src/benchmarks/ReactiveUI.Binding.Benchmarks/BenchmarkView.cs b/src/benchmarks/ReactiveUI.Binding.Benchmarks/BenchmarkView.cs index 95641276..b3fe470b 100644 --- a/src/benchmarks/ReactiveUI.Binding.Benchmarks/BenchmarkView.cs +++ b/src/benchmarks/ReactiveUI.Binding.Benchmarks/BenchmarkView.cs @@ -3,10 +3,12 @@ // See the LICENSE file in the project root for full license information. using System.ComponentModel; +using System.Diagnostics; namespace ReactiveUI.Binding.Benchmarks; /// A view used for binding benchmarks. Implements to support ReactiveUI's expression-tree-based binding APIs. +[DebuggerDisplay("DisplayName = {DisplayName}, DisplayAge = {DisplayAge}")] public class BenchmarkView : IViewFor, INotifyPropertyChanged { /// diff --git a/src/benchmarks/ReactiveUI.Binding.Benchmarks/BenchmarkViewModel.cs b/src/benchmarks/ReactiveUI.Binding.Benchmarks/BenchmarkViewModel.cs index cc500d92..6ed5a11c 100644 --- a/src/benchmarks/ReactiveUI.Binding.Benchmarks/BenchmarkViewModel.cs +++ b/src/benchmarks/ReactiveUI.Binding.Benchmarks/BenchmarkViewModel.cs @@ -3,10 +3,12 @@ // See the LICENSE file in the project root for full license information. using System.ComponentModel; +using System.Diagnostics; namespace ReactiveUI.Binding.Benchmarks; /// A view model used for benchmarking source-generated property observation and binding. +[DebuggerDisplay("Name = {Name}, Age = {Age}")] public class BenchmarkViewModel : INotifyPropertyChanged, INotifyPropertyChanging { /// diff --git a/src/benchmarks/ReactiveUI.Binding.Benchmarks/BindTwoWayBenchmark.cs b/src/benchmarks/ReactiveUI.Binding.Benchmarks/BindTwoWayBenchmark.cs index db6c737a..7f0855fe 100644 --- a/src/benchmarks/ReactiveUI.Binding.Benchmarks/BindTwoWayBenchmark.cs +++ b/src/benchmarks/ReactiveUI.Binding.Benchmarks/BindTwoWayBenchmark.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Jobs; using ReactiveUI.Primitives.Concurrency; @@ -86,6 +87,7 @@ public void Bidirectional() /// /// The instance of whose property changes are observed. /// An observable sequence of values that represent the changes to the property. + [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static IObservable TriggerViewGeneration(BenchmarkView view) => view.WhenChanged(x => x.DisplayName); } diff --git a/src/benchmarks/ReactiveUI.Binding.Benchmarks/WhenChangedBenchmark.cs b/src/benchmarks/ReactiveUI.Binding.Benchmarks/WhenChangedBenchmark.cs index 6a3f6f0f..0e7deac1 100644 --- a/src/benchmarks/ReactiveUI.Binding.Benchmarks/WhenChangedBenchmark.cs +++ b/src/benchmarks/ReactiveUI.Binding.Benchmarks/WhenChangedBenchmark.cs @@ -58,7 +58,7 @@ public void DeepChain() [Benchmark(Description = "Two Properties")] public void TwoProperties() { - (string name, int age) last = default; + (string Name, int Age) last = default; using var sub = _vm.WhenChanged(x => x.Name, x => x.Age) .Subscribe(v => last = v); diff --git a/src/benchmarks/ReactiveUI.Binding.Generator.Benchmarks/GenerationBenchmarks.cs b/src/benchmarks/ReactiveUI.Binding.Generator.Benchmarks/GenerationBenchmarks.cs index 98e24219..a1df7b93 100644 --- a/src/benchmarks/ReactiveUI.Binding.Generator.Benchmarks/GenerationBenchmarks.cs +++ b/src/benchmarks/ReactiveUI.Binding.Generator.Benchmarks/GenerationBenchmarks.cs @@ -33,6 +33,7 @@ public class GenerationBenchmarks /// Runs a whole cold generation: syntax scan, extraction, and emission. /// The number of generated characters, returned so the work cannot be optimized away. + /// The corpus generated nothing, so there is no result to report. [Benchmark] public int Generate() { diff --git a/src/benchmarks/ReactiveUI.Binding.Generator.Benchmarks/GeneratorCorpus.cs b/src/benchmarks/ReactiveUI.Binding.Generator.Benchmarks/GeneratorCorpus.cs index 45df9754..f9f05f0b 100644 --- a/src/benchmarks/ReactiveUI.Binding.Generator.Benchmarks/GeneratorCorpus.cs +++ b/src/benchmarks/ReactiveUI.Binding.Generator.Benchmarks/GeneratorCorpus.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using System.Text; namespace ReactiveUI.Binding.Generator.Benchmarks; @@ -54,6 +55,7 @@ private static void AppendPair(StringBuilder sb, int index) /// Appends the view model, child, button, and view for one pair. /// The builder to append to. /// The index that makes the emitted names unique. + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void AppendTypes(StringBuilder sb, int index) => sb.Append($$""" public class Child{{index}} : INotifyPropertyChanged @@ -103,6 +105,7 @@ public class MyView{{index}} : IViewFor /// Appends the call sites for one pair, spread across the observation and binding APIs. /// The builder to append to. /// The index that makes the emitted names unique. + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void AppendUsage(StringBuilder sb, int index) => sb.Append($$""" public static class Usage{{index}} diff --git a/src/benchmarks/ReactiveUI.Binding.Generator.Benchmarks/GeneratorHarness.cs b/src/benchmarks/ReactiveUI.Binding.Generator.Benchmarks/GeneratorHarness.cs index 61195796..4ae514bf 100644 --- a/src/benchmarks/ReactiveUI.Binding.Generator.Benchmarks/GeneratorHarness.cs +++ b/src/benchmarks/ReactiveUI.Binding.Generator.Benchmarks/GeneratorHarness.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using ReactiveUI.Binding.SourceGenerators; @@ -26,7 +27,7 @@ internal static CSharpCompilation BuildCompilation(string sourceText) { MetadataReference.CreateFromFile(typeof(ReactiveUIBindingExtensions).Assembly.Location), MetadataReference.CreateFromFile(typeof(ReactiveUI.Primitives.Concurrency.ISequencer).Assembly.Location), - MetadataReference.CreateFromFile(typeof(Splat.IEnableLogger).Assembly.Location) + MetadataReference.CreateFromFile(typeof(Splat.IEnableLogger).Assembly.Location), }; return CSharpCompilation.Create( @@ -38,6 +39,7 @@ internal static CSharpCompilation BuildCompilation(string sourceText) /// Creates a cold generator driver, carrying no caches from a previous run. /// The generator driver. + [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static GeneratorDriver CreateDriver() => CSharpGeneratorDriver.Create( [new BindingGenerator().AsSourceGenerator()], diff --git a/src/tests/.editorconfig b/src/tests/.editorconfig index 25501dd8..007d550a 100644 --- a/src/tests/.editorconfig +++ b/src/tests/.editorconfig @@ -13,6 +13,7 @@ dotnet_diagnostic.CA2213.severity = none # Disposable fields should be disposed # PerformanceSharp / StyleSharp test relaxations imported from Primitives ################### dotnet_diagnostic.SST1432.severity = none # Test fixtures need not be static +dotnet_diagnostic.SST2334.severity = none # Fixtures and models are read through assertions, not a debugger summary dotnet_diagnostic.SST2410.severity = none # A test creates the disposable it is asserting about; the test process owns it and exits performancesharp.avoid_linq_on_hot_path = false dotnet_diagnostic.PSH1100.severity = none # Tests can use LINQ for clarity diff --git a/src/tests/ReactiveUI.Binding.Analyzer.Tests/Helpers/AnalyzerHelpersTests.cs b/src/tests/ReactiveUI.Binding.Analyzer.Tests/Helpers/AnalyzerHelpersTests.cs index fd1f0c64..783b19a1 100644 --- a/src/tests/ReactiveUI.Binding.Analyzer.Tests/Helpers/AnalyzerHelpersTests.cs +++ b/src/tests/ReactiveUI.Binding.Analyzer.Tests/Helpers/AnalyzerHelpersTests.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using NSubstitute; @@ -689,6 +690,7 @@ private static INamedTypeSymbol GetNamedTypeSymbol(CSharpCompilation compilation /// Creates a compilation from the specified source code. /// The source code. /// A CSharpCompilation. + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static CSharpCompilation CreateCompilation(string source) => AnalyzerTestHelper.CreateCompilation(source); diff --git a/src/tests/ReactiveUI.Binding.Analyzer.Tests/Helpers/AnalyzerTestHelper.cs b/src/tests/ReactiveUI.Binding.Analyzer.Tests/Helpers/AnalyzerTestHelper.cs index 05e2e604..39a5d3a5 100644 --- a/src/tests/ReactiveUI.Binding.Analyzer.Tests/Helpers/AnalyzerTestHelper.cs +++ b/src/tests/ReactiveUI.Binding.Analyzer.Tests/Helpers/AnalyzerTestHelper.cs @@ -6,6 +6,7 @@ using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using System.Reflection; +using System.Runtime.CompilerServices; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.Diagnostics; @@ -20,6 +21,7 @@ public static class AnalyzerTestHelper /// The source code to analyze. /// A task that represents the asynchronous operation. The task result contains the diagnostics. [SuppressMessage("Design", "SST2307:Type parameter is not inferable", Justification = "the analyzer under test is specified explicitly by the caller")] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Task> GetDiagnosticsAsync(string source) where TAnalyzer : DiagnosticAnalyzer, new() => GetDiagnosticsAsync(source, null, null); @@ -62,6 +64,7 @@ public static async Task> GetDiagnosticsAsyncCreates a CSharpCompilation from the specified source code with required assembly references. /// The source code to compile into a CSharpCompilation. /// A CSharpCompilation object representing the compiled source code. + [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static CSharpCompilation CreateCompilation(string source) => CreateCompilation(source, null); /// Creates a compilation from source at a given language version. @@ -101,7 +104,7 @@ void AddReference(Assembly assembly) // Add runtime assemblies by name for any that typeof didn't cover var assemblyNames = new[] { - "System.Runtime", "System.ComponentModel.Primitives", "System.ObjectModel", "System.Collections" + "System.Runtime", "System.ComponentModel.Primitives", "System.ObjectModel", "System.Collections", }; var loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies(); diff --git a/src/tests/ReactiveUI.Binding.AotValidation/Program.cs b/src/tests/ReactiveUI.Binding.AotValidation/Program.cs index 330c5627..37a9caf6 100644 --- a/src/tests/ReactiveUI.Binding.AotValidation/Program.cs +++ b/src/tests/ReactiveUI.Binding.AotValidation/Program.cs @@ -4,6 +4,7 @@ using System; using System.IO; +using System.Runtime.CompilerServices; namespace ReactiveUI.Binding.AotValidation; @@ -87,12 +88,12 @@ private static void ValidateWhenChangedDeepChain() private static void ValidateWhenChangedTwoProperties() { var vm = new AotViewModel { Name = Alice, Age = InitialAge }; - (string name, int age) last = default; + (string Name, int Age) last = default; using var sub = vm.WhenChanged(x => x.Name, x => x.Age).Subscribe(v => last = v); - AssertEqual("WhenChanged two-prop name", Alice, last.name); - AssertEqual("WhenChanged two-prop age", InitialAge, last.age); + AssertEqual("WhenChanged two-prop name", Alice, last.Name); + AssertEqual("WhenChanged two-prop age", InitialAge, last.Age); vm.Age = UpdatedAge; - AssertEqual("WhenChanged two-prop age update", UpdatedAge, last.age); + AssertEqual("WhenChanged two-prop age update", UpdatedAge, last.Age); } /// WhenChanged on the view type produces a dispatch entry required by BindTwoWay. @@ -163,5 +164,6 @@ private static void AssertEqual(string label, T expected, T? actual) /// Writes a single line of the validation report to the process output stream. /// The line to write. + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void Report(string message) => _output.WriteLine(message); } diff --git a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/BindCommandScenarios.cs b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/BindCommandScenarios.cs index acd93906..fe115349 100644 --- a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/BindCommandScenarios.cs +++ b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/BindCommandScenarios.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; namespace ReactiveUI.Binding.GeneratedCode.TestModels.Scenarios; @@ -16,6 +17,7 @@ public static class BindCommandScenarios /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable BasicNoParam( SharedScenarios.BindCommand.BasicNoParam.MyViewModel vm, SharedScenarios.BindCommand.BasicNoParam.MyView view) => @@ -25,6 +27,7 @@ public static IDisposable BasicNoParam( /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable ExpressionParam( SharedScenarios.BindCommand.ExpressionParam.MyViewModel vm, SharedScenarios.BindCommand.ExpressionParam.MyView view) => @@ -35,6 +38,7 @@ public static IDisposable ExpressionParam( /// The target view. /// An observable producing command parameters. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable ObservableParam( SharedScenarios.BindCommand.ObservableParam.MyViewModel vm, SharedScenarios.BindCommand.ObservableParam.MyView view, @@ -45,6 +49,7 @@ public static IDisposable ObservableParam( /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable CustomEvent( SharedScenarios.BindCommand.CustomEvent.MyViewModel vm, SharedScenarios.BindCommand.CustomEvent.MyView view) => @@ -54,6 +59,7 @@ public static IDisposable CustomEvent( /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable DeepCommandPath( SharedScenarios.BindCommand.DeepCommandPath.MyViewModel vm, SharedScenarios.BindCommand.DeepCommandPath.MyView view) => @@ -63,6 +69,7 @@ public static IDisposable DeepCommandPath( /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable EventEnabled( SharedScenarios.BindCommand.EventEnabled.MyViewModel vm, SharedScenarios.BindCommand.EventEnabled.MyView view) => @@ -75,6 +82,7 @@ public static IDisposable EventEnabled( /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable EventEnabledExprParam( SharedScenarios.BindCommand.EventEnabledExprParam.MyViewModel vm, SharedScenarios.BindCommand.EventEnabledExprParam.MyView view) => @@ -88,6 +96,7 @@ public static IDisposable EventEnabledExprParam( /// The target view. /// An observable producing command parameters. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable EventEnabledObsParam( SharedScenarios.BindCommand.EventEnabledObsParam.MyViewModel vm, SharedScenarios.BindCommand.EventEnabledObsParam.MyView view, @@ -98,6 +107,7 @@ public static IDisposable EventEnabledObsParam( /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable CommandProperty( SharedScenarios.BindCommand.CommandProperty.MyViewModel vm, SharedScenarios.BindCommand.CommandProperty.MyView view) => @@ -110,6 +120,7 @@ public static IDisposable CommandProperty( /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable CommandPropertyExprParam( SharedScenarios.BindCommand.CommandPropertyExprParam.MyViewModel vm, SharedScenarios.BindCommand.CommandPropertyExprParam.MyView view) => @@ -123,6 +134,7 @@ public static IDisposable CommandPropertyExprParam( /// The target view. /// An observable producing command parameters. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable CommandPropertyObsParam( SharedScenarios.BindCommand.CommandPropertyObsParam.MyViewModel vm, SharedScenarios.BindCommand.CommandPropertyObsParam.MyView view, @@ -133,6 +145,7 @@ public static IDisposable CommandPropertyObsParam( /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable NoEvent( SharedScenarios.BindCommand.NoEvent.MyViewModel vm, SharedScenarios.BindCommand.NoEvent.MyView view) => diff --git a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/BindCompatScenarios.cs b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/BindCompatScenarios.cs index 7ae7d9bc..0043aa7e 100644 --- a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/BindCompatScenarios.cs +++ b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/BindCompatScenarios.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using ReactiveUI.Binding.GeneratedCode.TestModels.TestModels; namespace ReactiveUI.Binding.GeneratedCode.TestModels.Scenarios; @@ -13,7 +14,8 @@ public static class BindCompatScenarios /// The target view. /// The source view model. /// A reactive binding representing the binding. - public static IReactiveBinding StringProperty( + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IReactiveBinding StringProperty( TestView view, TestViewModel vm) => view.Bind(vm, x => x.Name, x => x.DisplayName); diff --git a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/BindInteractionScenarios.cs b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/BindInteractionScenarios.cs index 1ced6120..21c61e82 100644 --- a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/BindInteractionScenarios.cs +++ b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/BindInteractionScenarios.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; namespace ReactiveUI.Binding.GeneratedCode.TestModels.Scenarios; @@ -16,6 +17,7 @@ public static class BindInteractionScenarios /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable TaskHandler( SharedScenarios.BindInteraction.TaskHandler.MyViewModel vm, SharedScenarios.BindInteraction.TaskHandler.MyView view) => @@ -25,6 +27,7 @@ public static IDisposable TaskHandler( /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable ObservableHandler( SharedScenarios.BindInteraction.ObservableHandler.MyViewModel vm, SharedScenarios.BindInteraction.ObservableHandler.MyView view) => @@ -34,6 +37,7 @@ public static IDisposable ObservableHandler( /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable DeepPropertyPath( SharedScenarios.BindInteraction.DeepPropertyPath.MyViewModel vm, SharedScenarios.BindInteraction.DeepPropertyPath.MyView view) => diff --git a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/BindOneWayScenarios.cs b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/BindOneWayScenarios.cs index cdfb1667..92cd2cc0 100644 --- a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/BindOneWayScenarios.cs +++ b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/BindOneWayScenarios.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.GeneratedCode.TestModels.TestModels; namespace ReactiveUI.Binding.GeneratedCode.TestModels.Scenarios; @@ -17,6 +18,7 @@ public static class BindOneWayScenarios /// The source view model. /// The target view. /// A disposable that, when disposed, disconnects the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable StringProperty(BigViewModel source, BigView target) => source.BindOneWay(target, x => x.Prop1, x => x.ViewProp1); @@ -24,6 +26,7 @@ public static IDisposable StringProperty(BigViewModel source, BigView target) => /// The source view model. /// The target view. /// A disposable that, when disposed, disconnects the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable IntProperty(BigViewModel source, BigView target) => source.BindOneWay(target, x => x.Prop2, x => x.ViewProp2); @@ -31,6 +34,7 @@ public static IDisposable IntProperty(BigViewModel source, BigView target) => /// The source view model. /// The target view. /// A disposable that, when disposed, disconnects the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable DoubleProperty(BigViewModel source, BigView target) => source.BindOneWay(target, x => x.Prop3, x => x.ViewProp3); @@ -38,6 +42,7 @@ public static IDisposable DoubleProperty(BigViewModel source, BigView target) => /// The source view model. /// The target view. /// A disposable that, when disposed, disconnects the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable BoolProperty(BigViewModel source, BigView target) => source.BindOneWay(target, x => x.Prop4, x => x.ViewProp4); @@ -45,6 +50,7 @@ public static IDisposable BoolProperty(BigViewModel source, BigView target) => /// The source view model. /// The target view. /// A disposable that, when disposed, disconnects the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable DeepChainProperty(BigViewModel source, BigView target) => source.BindOneWay(target, x => x.Address.City, x => x.ViewProp1); @@ -52,6 +58,7 @@ public static IDisposable DeepChainProperty(BigViewModel source, BigView target) /// The source view model. /// The target view. /// A disposable that, when disposed, disconnects the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable StringProperty5(BigViewModel source, BigView target) => source.BindOneWay(target, x => x.Prop5, x => x.ViewProp5); } diff --git a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/BindToScenarios.cs b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/BindToScenarios.cs index 7e3fd7ca..ee713009 100644 --- a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/BindToScenarios.cs +++ b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/BindToScenarios.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.GeneratedCode.TestModels.TestModels; namespace ReactiveUI.Binding.GeneratedCode.TestModels.Scenarios; @@ -14,6 +15,7 @@ public static class BindToScenarios /// The source observable stream. /// The target view. /// A disposable that, when disposed, disconnects the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable StringToString(IObservable source, BigView target) => source.BindTo(target, x => x.ViewProp1); } diff --git a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/BindTwoWayScenarios.cs b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/BindTwoWayScenarios.cs index 8b2aea0f..16c4651f 100644 --- a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/BindTwoWayScenarios.cs +++ b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/BindTwoWayScenarios.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.GeneratedCode.TestModels.TestModels; namespace ReactiveUI.Binding.GeneratedCode.TestModels.Scenarios; @@ -17,6 +18,7 @@ public static class BindTwoWayScenarios /// The source view model. /// The target view. /// A disposable that, when disposed, disconnects the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable StringProperty(BigViewModel source, BigView target) => source.BindTwoWay(target, x => x.Prop1, x => x.ViewProp1); @@ -24,6 +26,7 @@ public static IDisposable StringProperty(BigViewModel source, BigView target) => /// The source view model. /// The target view. /// A disposable that, when disposed, disconnects the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable IntProperty(BigViewModel source, BigView target) => source.BindTwoWay(target, x => x.Prop2, x => x.ViewProp2); @@ -31,6 +34,7 @@ public static IDisposable IntProperty(BigViewModel source, BigView target) => /// The source view model. /// The target view. /// A disposable that, when disposed, disconnects the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable DoubleProperty(BigViewModel source, BigView target) => source.BindTwoWay(target, x => x.Prop3, x => x.ViewProp3); @@ -38,6 +42,7 @@ public static IDisposable DoubleProperty(BigViewModel source, BigView target) => /// The source view model. /// The target view. /// A disposable that, when disposed, disconnects the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable BoolProperty(BigViewModel source, BigView target) => source.BindTwoWay(target, x => x.Prop4, x => x.ViewProp4); } diff --git a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/OneWayBindCompatScenarios.cs b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/OneWayBindCompatScenarios.cs index b116ac5f..0f9629e4 100644 --- a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/OneWayBindCompatScenarios.cs +++ b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/OneWayBindCompatScenarios.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using ReactiveUI.Binding.GeneratedCode.TestModels.TestModels; namespace ReactiveUI.Binding.GeneratedCode.TestModels.Scenarios; @@ -13,6 +14,7 @@ public static class OneWayBindCompatScenarios /// The target view. /// The source view model. /// A reactive binding representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IReactiveBinding StringProperty(TestView view, TestViewModel vm) => view.OneWayBind(vm, x => x.Name, x => x.DisplayName); } diff --git a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenAnyObservableScenarios.cs b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenAnyObservableScenarios.cs index 31235ef2..b3102dfa 100644 --- a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenAnyObservableScenarios.cs +++ b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenAnyObservableScenarios.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.GeneratedCode.TestModels.TestModels; namespace ReactiveUI.Binding.GeneratedCode.TestModels.Scenarios; @@ -16,12 +17,14 @@ public static class WhenAnyObservableScenarios /// Single observable property observation using Switch pattern. /// The view model to observe. /// An observable that switches to the latest MyCommand observable. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable SingleObservable_Switch(ObservablePropertyViewModel vm) => vm.WhenAnyObservable(x => x.MyCommand); /// Two observable properties of the same type using Merge pattern. /// The view model to observe. /// An observable that merges both command observables. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable TwoObservables_Merge(ObservablePropertyViewModel vm) => vm.WhenAnyObservable(x => x.MyCommand, x => x.OtherCommand); } diff --git a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenAnyScenarios.cs b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenAnyScenarios.cs index 46451813..f2161a8e 100644 --- a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenAnyScenarios.cs +++ b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenAnyScenarios.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.GeneratedCode.TestModels.TestModels; namespace ReactiveUI.Binding.GeneratedCode.TestModels.Scenarios; @@ -16,12 +17,14 @@ public static class WhenAnyScenarios /// Single property WhenAny observation with a selector extracting the value. /// The view model to observe. /// An observable of the Name property value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable SingleProperty_Name(TestViewModel vm) => vm.WhenAny(x => x.Name, static c => c.Value); /// Single property WhenAny observation returning the IObservedChange directly. /// The view model to observe. /// An observable of IObservedChange for the Name property. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable> SingleProperty_Name_ObservedChange( TestViewModel vm) => vm.WhenAny(x => x.Name, static c => c); @@ -29,6 +32,7 @@ public static IObservable> SingleProperty /// Two-property WhenAny observation with a selector combining values. /// The view model to observe. /// An observable of the combined name and age string. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable TwoProperties_NameAge(TestViewModel vm) => vm.WhenAny(x => x.Name, x => x.Age, static (name, age) => $"{name.Value}_{age.Value}"); } diff --git a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenAnyValueExtendedScenarios.cs b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenAnyValueExtendedScenarios.cs index a4295f4f..5dae539b 100644 --- a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenAnyValueExtendedScenarios.cs +++ b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenAnyValueExtendedScenarios.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.GeneratedCode.TestModels.TestModels; namespace ReactiveUI.Binding.GeneratedCode.TestModels.Scenarios; @@ -16,31 +17,35 @@ public static class WhenAnyValueExtendedScenarios /// Four-property observation using WhenAnyValue returning a tuple. /// The view model to observe. /// An observable of the property value tuple. - public static IObservable<(string property1, int property2, double property3, bool property4)> FourProperties( + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IObservable<(string Property1, int Property2, double Property3, bool Property4)> FourProperties( BigViewModel vm) => vm.WhenAnyValue(x => x.Prop1, x => x.Prop2, x => x.Prop3, x => x.Prop4); /// Five-property observation using WhenAnyValue returning a tuple. /// The view model to observe. /// An observable of the property value tuple. - public static IObservable<(string property1, int property2, double property3, bool property4, string property5)> + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5)> FiveProperties(BigViewModel vm) => vm.WhenAnyValue(x => x.Prop1, x => x.Prop2, x => x.Prop3, x => x.Prop4, x => x.Prop5); /// Six-property observation using WhenAnyValue returning a tuple. /// The view model to observe. /// An observable of the property value tuple. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static - IObservable<(string property1, int property2, double property3, bool property4, string property5, int property6)> + IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int Property6)> SixProperties(BigViewModel vm) => vm.WhenAnyValue(x => x.Prop1, x => x.Prop2, x => x.Prop3, x => x.Prop4, x => x.Prop5, x => x.Prop6); /// Seven-property observation using WhenAnyValue returning a tuple. /// The view model to observe. /// An observable of the property value tuple. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static - IObservable<(string property1, int property2, double property3, bool property4, string property5, int property6, - double property7)> SevenProperties(BigViewModel vm) => + IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int Property6, + double Property7)> SevenProperties(BigViewModel vm) => vm.WhenAnyValue( x => x.Prop1, x => x.Prop2, @@ -53,9 +58,10 @@ public static /// Eight-property observation using WhenAnyValue returning a tuple. /// The view model to observe. /// An observable of the property value tuple. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static - IObservable<(string property1, int property2, double property3, bool property4, string property5, int property6, - double property7, bool property8)> EightProperties(BigViewModel vm) => + IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int Property6, + double Property7, bool Property8)> EightProperties(BigViewModel vm) => vm.WhenAnyValue( x => x.Prop1, x => x.Prop2, @@ -69,9 +75,10 @@ public static /// Nine-property observation using WhenAnyValue returning a tuple. /// The view model to observe. /// An observable of the property value tuple. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static - IObservable<(string property1, int property2, double property3, bool property4, string property5, int property6, - double property7, bool property8, string property9)> NineProperties(BigViewModel vm) => + IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int Property6, + double Property7, bool Property8, string Property9)> NineProperties(BigViewModel vm) => vm.WhenAnyValue( x => x.Prop1, x => x.Prop2, @@ -86,9 +93,10 @@ public static /// Ten-property observation using WhenAnyValue returning a tuple. /// The view model to observe. /// An observable of the property value tuple. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static - IObservable<(string property1, int property2, double property3, bool property4, string property5, int property6, - double property7, bool property8, string property9, int property10)> TenProperties(BigViewModel vm) => + IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int Property6, + double Property7, bool Property8, string Property9, int Property10)> TenProperties(BigViewModel vm) => vm.WhenAnyValue( x => x.Prop1, x => x.Prop2, @@ -104,9 +112,10 @@ public static /// Eleven-property observation using WhenAnyValue returning a tuple. /// The view model to observe. /// An observable of the property value tuple. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static - IObservable<(string property1, int property2, double property3, bool property4, string property5, int property6, - double property7, bool property8, string property9, int property10, double property11)> ElevenProperties( + IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int Property6, + double Property7, bool Property8, string Property9, int Property10, double Property11)> ElevenProperties( BigViewModel vm) => vm.WhenAnyValue( x => x.Prop1, @@ -124,9 +133,10 @@ public static /// Twelve-property observation using WhenAnyValue returning a tuple. /// The view model to observe. /// An observable of the property value tuple. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static - IObservable<(string property1, int property2, double property3, bool property4, string property5, int property6, - double property7, bool property8, string property9, int property10, double property11, bool property12)> + IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int Property6, + double Property7, bool Property8, string Property9, int Property10, double Property11, bool Property12)> TwelveProperties(BigViewModel vm) => vm.WhenAnyValue( x => x.Prop1, @@ -145,9 +155,10 @@ public static /// Thirteen-property observation using WhenAnyValue returning a tuple. /// The view model to observe. /// An observable of the property value tuple. - public static IObservable<(string property1, int property2, double property3, bool property4, string property5, int - property6, double property7, bool property8, string property9, int property10, double property11, bool - property12, string property13)> ThirteenProperties(BigViewModel vm) => + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int + Property6, double Property7, bool Property8, string Property9, int Property10, double Property11, bool + Property12, string Property13)> ThirteenProperties(BigViewModel vm) => vm.WhenAnyValue( x => x.Prop1, x => x.Prop2, @@ -166,9 +177,10 @@ public static /// Fourteen-property observation using WhenAnyValue returning a tuple. /// The view model to observe. /// An observable of the property value tuple. - public static IObservable<(string property1, int property2, double property3, bool property4, string property5, int - property6, double property7, bool property8, string property9, int property10, double property11, bool - property12, string property13, int property14)> FourteenProperties(BigViewModel vm) => + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int + Property6, double Property7, bool Property8, string Property9, int Property10, double Property11, bool + Property12, string Property13, int Property14)> FourteenProperties(BigViewModel vm) => vm.WhenAnyValue( x => x.Prop1, x => x.Prop2, @@ -188,9 +200,10 @@ public static /// Fifteen-property observation using WhenAnyValue returning a tuple. /// The view model to observe. /// An observable of the property value tuple. - public static IObservable<(string property1, int property2, double property3, bool property4, string property5, int - property6, double property7, bool property8, string property9, int property10, double property11, bool - property12, string property13, int property14, double property15)> FifteenProperties(BigViewModel vm) => + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int + Property6, double Property7, bool Property8, string Property9, int Property10, double Property11, bool + Property12, string Property13, int Property14, double Property15)> FifteenProperties(BigViewModel vm) => vm.WhenAnyValue( x => x.Prop1, x => x.Prop2, @@ -211,9 +224,10 @@ public static /// Sixteen-property observation using WhenAnyValue returning a tuple. /// The view model to observe. /// An observable of the property value tuple. - public static IObservable<(string property1, int property2, double property3, bool property4, string property5, int - property6, double property7, bool property8, string property9, int property10, double property11, bool - property12, string property13, int property14, double property15, bool property16)> SixteenProperties( + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int + Property6, double Property7, bool Property8, string Property9, int Property10, double Property11, bool + Property12, string Property13, int Property14, double Property15, bool Property16)> SixteenProperties( BigViewModel vm) => vm.WhenAnyValue( x => x.Prop1, @@ -236,6 +250,7 @@ public static /// Four-property observation with a selector using WhenAnyValue. /// The view model to observe. /// An observable of the combined string value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_FourProperties(BigViewModel vm) => vm.WhenAnyValue( x => x.Prop1, @@ -247,6 +262,7 @@ public static IObservable WithSelector_FourProperties(BigViewModel vm) = /// Five-property observation with a selector using WhenAnyValue. /// The view model to observe. /// An observable of the combined string value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_FiveProperties(BigViewModel vm) => vm.WhenAnyValue( x => x.Prop1, @@ -259,6 +275,7 @@ public static IObservable WithSelector_FiveProperties(BigViewModel vm) = /// Six-property observation with a selector using WhenAnyValue. /// The view model to observe. /// An observable of the combined string value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_SixProperties(BigViewModel vm) => vm.WhenAnyValue( x => x.Prop1, @@ -272,6 +289,7 @@ public static IObservable WithSelector_SixProperties(BigViewModel vm) => /// Seven-property observation with a selector using WhenAnyValue. /// The view model to observe. /// An observable of the combined string value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_SevenProperties(BigViewModel vm) => vm.WhenAnyValue( x => x.Prop1, @@ -286,6 +304,7 @@ public static IObservable WithSelector_SevenProperties(BigViewModel vm) /// Eight-property observation with a selector using WhenAnyValue. /// The view model to observe. /// An observable of the combined string value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_EightProperties(BigViewModel vm) => vm.WhenAnyValue( x => x.Prop1, @@ -301,6 +320,7 @@ public static IObservable WithSelector_EightProperties(BigViewModel vm) /// Nine-property observation with a selector using WhenAnyValue. /// The view model to observe. /// An observable of the combined string value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_NineProperties(BigViewModel vm) => vm.WhenAnyValue( x => x.Prop1, @@ -317,6 +337,7 @@ public static IObservable WithSelector_NineProperties(BigViewModel vm) = /// Ten-property observation with a selector using WhenAnyValue. /// The view model to observe. /// An observable of the combined string value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_TenProperties(BigViewModel vm) => vm.WhenAnyValue( x => x.Prop1, @@ -334,6 +355,7 @@ public static IObservable WithSelector_TenProperties(BigViewModel vm) => /// Eleven-property observation with a selector using WhenAnyValue. /// The view model to observe. /// An observable of the combined string value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_ElevenProperties(BigViewModel vm) => vm.WhenAnyValue( x => x.Prop1, @@ -353,6 +375,7 @@ public static IObservable WithSelector_ElevenProperties(BigViewModel vm) /// Twelve-property observation with a selector using WhenAnyValue. /// The view model to observe. /// An observable of the combined string value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_TwelveProperties(BigViewModel vm) => vm.WhenAnyValue( x => x.Prop1, @@ -373,6 +396,7 @@ public static IObservable WithSelector_TwelveProperties(BigViewModel vm) /// Thirteen-property observation with a selector using WhenAnyValue. /// The view model to observe. /// An observable of the combined string value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_ThirteenProperties(BigViewModel vm) => vm.WhenAnyValue( x => x.Prop1, @@ -394,6 +418,7 @@ public static IObservable WithSelector_ThirteenProperties(BigViewModel v /// Fourteen-property observation with a selector using WhenAnyValue. /// The view model to observe. /// An observable of the combined string value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_FourteenProperties(BigViewModel vm) => vm.WhenAnyValue( x => x.Prop1, @@ -416,6 +441,7 @@ public static IObservable WithSelector_FourteenProperties(BigViewModel v /// Fifteen-property observation with a selector using WhenAnyValue. /// The view model to observe. /// An observable of the combined string value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_FifteenProperties(BigViewModel vm) => vm.WhenAnyValue( x => x.Prop1, @@ -439,6 +465,7 @@ public static IObservable WithSelector_FifteenProperties(BigViewModel vm /// Sixteen-property observation with a selector using WhenAnyValue. /// The view model to observe. /// An observable of the combined string value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_SixteenProperties(BigViewModel vm) => vm.WhenAnyValue( x => x.Prop1, @@ -463,6 +490,7 @@ public static IObservable WithSelector_SixteenProperties(BigViewModel vm /// Deep property chain observation on BigViewModel.Address.City using WhenAnyValue. /// The view model to observe. /// An observable of the nested City property value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable DeepChain_AddressCity(BigViewModel vm) => vm.WhenAnyValue(x => x.Address.City); @@ -472,9 +500,10 @@ public static IObservable DeepChain_AddressCity(BigViewModel vm) => /// /// The fixture to observe. /// An observable of a 12-string tuple. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static - IObservable<(string v1, string v2, string v3, string v4, string v5, string v6, string v7, string v8, string v9, - string v10, string v11, string v12)> TwelveProperties_AllStrings(WhenAnyTestFixture fixture) => + IObservable<(string V1, string V2, string V3, string V4, string V5, string V6, string V7, string V8, string V9, + string V10, string V11, string V12)> TwelveProperties_AllStrings(WhenAnyTestFixture fixture) => fixture.WhenAnyValue( x => x.Value1, x => x.Value2, diff --git a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenAnyValueScenarios.cs b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenAnyValueScenarios.cs index f2f66bce..b37a4e5e 100644 --- a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenAnyValueScenarios.cs +++ b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenAnyValueScenarios.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.GeneratedCode.TestModels.TestModels; namespace ReactiveUI.Binding.GeneratedCode.TestModels.Scenarios; @@ -16,31 +17,36 @@ public static class WhenAnyValueScenarios /// Single property observation using WhenAnyValue. /// The fixture to observe. /// An observable of the Value1 property value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable SingleProperty(WhenAnyTestFixture fixture) => fixture.WhenAnyValue(x => x.Value1); /// Two-property observation using WhenAnyValue returning a tuple. /// The fixture to observe. /// An observable of the property value tuple. - public static IObservable<(string property1, string property2)> TwoProperties(WhenAnyTestFixture fixture) => + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IObservable<(string Property1, string Property2)> TwoProperties(WhenAnyTestFixture fixture) => fixture.WhenAnyValue(x => x.Value1, x => x.Value2); /// Three-property observation using WhenAnyValue returning a tuple. /// The fixture to observe. /// An observable of the property value tuple. - public static IObservable<(string property1, string property2, string property3)> ThreeProperties( + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IObservable<(string Property1, string Property2, string Property3)> ThreeProperties( WhenAnyTestFixture fixture) => fixture.WhenAnyValue(x => x.Value1, x => x.Value2, x => x.Value3); /// Two-property observation with a selector using WhenAnyValue. /// The fixture to observe. /// An observable of the combined string value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_TwoProperties(WhenAnyTestFixture fixture) => fixture.WhenAnyValue(x => x.Value1, x => x.Value2, static (v1, v2) => $"{v1}_{v2}"); /// Deep property chain observation using WhenAnyValue on BigViewModel.Address.City. /// The view model to observe. /// An observable of the nested City property value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable DeepChain_AddressCity(BigViewModel vm) => vm.WhenAnyValue(x => x.Address.City); @@ -50,18 +56,21 @@ public static IObservable DeepChain_AddressCity(BigViewModel vm) => /// /// The host fixture to observe. /// An observable of the nested Name property value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable DeepChain_ChildName(HostTestFixture host) => host.WhenAnyValue(x => x.Child!.Name); /// Three-link property chain observation on HostTestFixture.Child!.Child!.Name. /// The host fixture to observe. /// An observable of the nested grandchild Name property value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable DeepChain_GrandchildName(HostTestFixture host) => host.WhenAnyValue(x => x.Child!.Child!.Name); /// Deep property chain observation on HostTestFixture.Child!.Age. /// The host fixture to observe. /// An observable of the nested Age property value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable DeepChain_ChildAge(HostTestFixture host) => host.WhenAnyValue(x => x.Child!.Age); } diff --git a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenChangedExtendedScenarios.cs b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenChangedExtendedScenarios.cs index 4e0f6d91..cef3ad47 100644 --- a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenChangedExtendedScenarios.cs +++ b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenChangedExtendedScenarios.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.GeneratedCode.TestModels.TestModels; namespace ReactiveUI.Binding.GeneratedCode.TestModels.Scenarios; @@ -16,24 +17,27 @@ public static class WhenChangedExtendedScenarios /// Five-property observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple. - public static IObservable<(string property1, int property2, double property3, bool property4, string property5)> + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5)> FiveProperties(BigViewModel vm) => vm.WhenChanged(x => x.Prop1, x => x.Prop2, x => x.Prop3, x => x.Prop4, x => x.Prop5); /// Six-property observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static - IObservable<(string property1, int property2, double property3, bool property4, string property5, int property6)> + IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int Property6)> SixProperties(BigViewModel vm) => vm.WhenChanged(x => x.Prop1, x => x.Prop2, x => x.Prop3, x => x.Prop4, x => x.Prop5, x => x.Prop6); /// Seven-property observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static - IObservable<(string property1, int property2, double property3, bool property4, string property5, int property6, - double property7)> SevenProperties(BigViewModel vm) => + IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int Property6, + double Property7)> SevenProperties(BigViewModel vm) => vm.WhenChanged( x => x.Prop1, x => x.Prop2, @@ -46,9 +50,10 @@ public static /// Eight-property observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static - IObservable<(string property1, int property2, double property3, bool property4, string property5, int property6, - double property7, bool property8)> EightProperties(BigViewModel vm) => + IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int Property6, + double Property7, bool Property8)> EightProperties(BigViewModel vm) => vm.WhenChanged( x => x.Prop1, x => x.Prop2, @@ -62,9 +67,10 @@ public static /// Nine-property observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static - IObservable<(string property1, int property2, double property3, bool property4, string property5, int property6, - double property7, bool property8, string property9)> NineProperties(BigViewModel vm) => + IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int Property6, + double Property7, bool Property8, string Property9)> NineProperties(BigViewModel vm) => vm.WhenChanged( x => x.Prop1, x => x.Prop2, @@ -79,9 +85,10 @@ public static /// Ten-property observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static - IObservable<(string property1, int property2, double property3, bool property4, string property5, int property6, - double property7, bool property8, string property9, int property10)> TenProperties(BigViewModel vm) => + IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int Property6, + double Property7, bool Property8, string Property9, int Property10)> TenProperties(BigViewModel vm) => vm.WhenChanged( x => x.Prop1, x => x.Prop2, @@ -97,9 +104,10 @@ public static /// Eleven-property observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static - IObservable<(string property1, int property2, double property3, bool property4, string property5, int property6, - double property7, bool property8, string property9, int property10, double property11)> ElevenProperties( + IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int Property6, + double Property7, bool Property8, string Property9, int Property10, double Property11)> ElevenProperties( BigViewModel vm) => vm.WhenChanged( x => x.Prop1, @@ -117,9 +125,10 @@ public static /// Twelve-property observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static - IObservable<(string property1, int property2, double property3, bool property4, string property5, int property6, - double property7, bool property8, string property9, int property10, double property11, bool property12)> + IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int Property6, + double Property7, bool Property8, string Property9, int Property10, double Property11, bool Property12)> TwelveProperties(BigViewModel vm) => vm.WhenChanged( x => x.Prop1, @@ -138,9 +147,10 @@ public static /// Thirteen-property observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple. - public static IObservable<(string property1, int property2, double property3, bool property4, string property5, int - property6, double property7, bool property8, string property9, int property10, double property11, bool - property12, string property13)> ThirteenProperties(BigViewModel vm) => + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int + Property6, double Property7, bool Property8, string Property9, int Property10, double Property11, bool + Property12, string Property13)> ThirteenProperties(BigViewModel vm) => vm.WhenChanged( x => x.Prop1, x => x.Prop2, @@ -159,9 +169,10 @@ public static /// Fourteen-property observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple. - public static IObservable<(string property1, int property2, double property3, bool property4, string property5, int - property6, double property7, bool property8, string property9, int property10, double property11, bool - property12, string property13, int property14)> FourteenProperties(BigViewModel vm) => + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int + Property6, double Property7, bool Property8, string Property9, int Property10, double Property11, bool + Property12, string Property13, int Property14)> FourteenProperties(BigViewModel vm) => vm.WhenChanged( x => x.Prop1, x => x.Prop2, @@ -181,9 +192,10 @@ public static /// Fifteen-property observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple. - public static IObservable<(string property1, int property2, double property3, bool property4, string property5, int - property6, double property7, bool property8, string property9, int property10, double property11, bool - property12, string property13, int property14, double property15)> FifteenProperties(BigViewModel vm) => + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int + Property6, double Property7, bool Property8, string Property9, int Property10, double Property11, bool + Property12, string Property13, int Property14, double Property15)> FifteenProperties(BigViewModel vm) => vm.WhenChanged( x => x.Prop1, x => x.Prop2, @@ -204,9 +216,10 @@ public static /// Sixteen-property observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple. - public static IObservable<(string property1, int property2, double property3, bool property4, string property5, int - property6, double property7, bool property8, string property9, int property10, double property11, bool - property12, string property13, int property14, double property15, bool property16)> SixteenProperties( + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int + Property6, double Property7, bool Property8, string Property9, int Property10, double Property11, bool + Property12, string Property13, int Property14, double Property15, bool Property16)> SixteenProperties( BigViewModel vm) => vm.WhenChanged( x => x.Prop1, @@ -229,6 +242,7 @@ public static /// Five-property observation with a selector function. /// The view model to observe. /// An observable of the combined string value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_FiveProperties(BigViewModel vm) => vm.WhenChanged( x => x.Prop1, @@ -241,6 +255,7 @@ public static IObservable WithSelector_FiveProperties(BigViewModel vm) = /// Six-property observation with a selector function. /// The view model to observe. /// An observable of the combined string value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_SixProperties(BigViewModel vm) => vm.WhenChanged( x => x.Prop1, @@ -254,6 +269,7 @@ public static IObservable WithSelector_SixProperties(BigViewModel vm) => /// Seven-property observation with a selector function. /// The view model to observe. /// An observable of the combined string value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_SevenProperties(BigViewModel vm) => vm.WhenChanged( x => x.Prop1, @@ -268,6 +284,7 @@ public static IObservable WithSelector_SevenProperties(BigViewModel vm) /// Eight-property observation with a selector function. /// The view model to observe. /// An observable of the combined string value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_EightProperties(BigViewModel vm) => vm.WhenChanged( x => x.Prop1, @@ -283,6 +300,7 @@ public static IObservable WithSelector_EightProperties(BigViewModel vm) /// Nine-property observation with a selector function. /// The view model to observe. /// An observable of the combined string value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_NineProperties(BigViewModel vm) => vm.WhenChanged( x => x.Prop1, @@ -299,6 +317,7 @@ public static IObservable WithSelector_NineProperties(BigViewModel vm) = /// Ten-property observation with a selector function. /// The view model to observe. /// An observable of the combined string value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_TenProperties(BigViewModel vm) => vm.WhenChanged( x => x.Prop1, @@ -316,6 +335,7 @@ public static IObservable WithSelector_TenProperties(BigViewModel vm) => /// Eleven-property observation with a selector function. /// The view model to observe. /// An observable of the combined string value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_ElevenProperties(BigViewModel vm) => vm.WhenChanged( x => x.Prop1, @@ -335,6 +355,7 @@ public static IObservable WithSelector_ElevenProperties(BigViewModel vm) /// Twelve-property observation with a selector function. /// The view model to observe. /// An observable of the combined string value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_TwelveProperties(BigViewModel vm) => vm.WhenChanged( x => x.Prop1, @@ -355,6 +376,7 @@ public static IObservable WithSelector_TwelveProperties(BigViewModel vm) /// Thirteen-property observation with a selector function. /// The view model to observe. /// An observable of the combined string value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_ThirteenProperties(BigViewModel vm) => vm.WhenChanged( x => x.Prop1, @@ -376,6 +398,7 @@ public static IObservable WithSelector_ThirteenProperties(BigViewModel v /// Fourteen-property observation with a selector function. /// The view model to observe. /// An observable of the combined string value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_FourteenProperties(BigViewModel vm) => vm.WhenChanged( x => x.Prop1, @@ -398,6 +421,7 @@ public static IObservable WithSelector_FourteenProperties(BigViewModel v /// Fifteen-property observation with a selector function. /// The view model to observe. /// An observable of the combined string value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_FifteenProperties(BigViewModel vm) => vm.WhenChanged( x => x.Prop1, @@ -421,6 +445,7 @@ public static IObservable WithSelector_FifteenProperties(BigViewModel vm /// Sixteen-property observation with a selector function. /// The view model to observe. /// An observable of the combined string value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_SixteenProperties(BigViewModel vm) => vm.WhenChanged( x => x.Prop1, diff --git a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenChangedScenarios.cs b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenChangedScenarios.cs index 4f8e65b5..68d26625 100644 --- a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenChangedScenarios.cs +++ b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenChangedScenarios.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.GeneratedCode.TestModels.TestModels; namespace ReactiveUI.Binding.GeneratedCode.TestModels.Scenarios; @@ -16,43 +17,50 @@ public static class WhenChangedScenarios /// Single property observation on TestViewModel.Name. /// The view model to observe. /// An observable of the Name property value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable SingleProperty_Name(TestViewModel vm) => vm.WhenChanged(x => x.Name); /// Single property observation on TestViewModel.Age. /// The view model to observe. /// An observable of the Age property value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable SingleProperty_Age(TestViewModel vm) => vm.WhenChanged(x => x.Age); /// Two-property observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple. - public static IObservable<(string property1, int property2)> TwoProperties(BigViewModel vm) => + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IObservable<(string Property1, int Property2)> TwoProperties(BigViewModel vm) => vm.WhenChanged(x => x.Prop1, x => x.Prop2); /// Three-property observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple. - public static IObservable<(string property1, int property2, double property3)> ThreeProperties(BigViewModel vm) => + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IObservable<(string Property1, int Property2, double Property3)> ThreeProperties(BigViewModel vm) => vm.WhenChanged(x => x.Prop1, x => x.Prop2, x => x.Prop3); /// Four-property observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple. - public static IObservable<(string property1, int property2, double property3, bool property4)> FourProperties( + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IObservable<(string Property1, int Property2, double Property3, bool Property4)> FourProperties( BigViewModel vm) => vm.WhenChanged(x => x.Prop1, x => x.Prop2, x => x.Prop3, x => x.Prop4); /// Two-property observation with a selector function. /// The view model to observe. /// An observable of the combined string value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_TwoProperties(BigViewModel vm) => vm.WhenChanged(x => x.Prop1, x => x.Prop2, static (p1, p2) => $"{p1}_{p2}"); /// Deep property chain observation on BigViewModel.Address.City. /// The view model to observe. /// An observable of the nested City property value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable DeepChain_AddressCity(BigViewModel vm) => vm.WhenChanged(x => x.Address.City); @@ -62,6 +70,7 @@ public static IObservable DeepChain_AddressCity(BigViewModel vm) => /// /// The view model to observe. /// An observable of the nested Street property value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable DeepChain_AddressStreet(BigViewModel vm) => vm.WhenChanged(x => x.Address.Street); @@ -71,12 +80,14 @@ public static IObservable DeepChain_AddressStreet(BigViewModel vm) => /// /// The host fixture to observe. /// An observable of the nested Name property value. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable DeepChain_ChildName(HostTestFixture host) => host.WhenChanged(x => x.Child!.Name); /// Multi-property observation combining a deep chain and a simple property. /// The view model to observe. /// An observable of the combined property values. - public static IObservable<(string city, string prop1)> MultiProperty_WithDeepChain(BigViewModel vm) => + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IObservable<(string City, string Prop1)> MultiProperty_WithDeepChain(BigViewModel vm) => vm.WhenChanged(x => x.Address.City, x => x.Prop1); } diff --git a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenChangingExtendedScenarios.cs b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenChangingExtendedScenarios.cs index b2056d18..33b119e5 100644 --- a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenChangingExtendedScenarios.cs +++ b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenChangingExtendedScenarios.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.GeneratedCode.TestModels.TestModels; namespace ReactiveUI.Binding.GeneratedCode.TestModels.Scenarios; @@ -16,24 +17,27 @@ public static class WhenChangingExtendedScenarios /// Five-property before-change observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple before changes. - public static IObservable<(string property1, int property2, double property3, bool property4, string property5)> + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5)> FiveProperties(BigViewModel vm) => vm.WhenChanging(x => x.Prop1, x => x.Prop2, x => x.Prop3, x => x.Prop4, x => x.Prop5); /// Six-property before-change observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple before changes. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static - IObservable<(string property1, int property2, double property3, bool property4, string property5, int property6)> + IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int Property6)> SixProperties(BigViewModel vm) => vm.WhenChanging(x => x.Prop1, x => x.Prop2, x => x.Prop3, x => x.Prop4, x => x.Prop5, x => x.Prop6); /// Seven-property before-change observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple before changes. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static - IObservable<(string property1, int property2, double property3, bool property4, string property5, int property6, - double property7)> SevenProperties(BigViewModel vm) => + IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int Property6, + double Property7)> SevenProperties(BigViewModel vm) => vm.WhenChanging( x => x.Prop1, x => x.Prop2, @@ -46,9 +50,10 @@ public static /// Eight-property before-change observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple before changes. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static - IObservable<(string property1, int property2, double property3, bool property4, string property5, int property6, - double property7, bool property8)> EightProperties(BigViewModel vm) => + IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int Property6, + double Property7, bool Property8)> EightProperties(BigViewModel vm) => vm.WhenChanging( x => x.Prop1, x => x.Prop2, @@ -62,9 +67,10 @@ public static /// Nine-property before-change observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple before changes. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static - IObservable<(string property1, int property2, double property3, bool property4, string property5, int property6, - double property7, bool property8, string property9)> NineProperties(BigViewModel vm) => + IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int Property6, + double Property7, bool Property8, string Property9)> NineProperties(BigViewModel vm) => vm.WhenChanging( x => x.Prop1, x => x.Prop2, @@ -79,9 +85,10 @@ public static /// Ten-property before-change observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple before changes. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static - IObservable<(string property1, int property2, double property3, bool property4, string property5, int property6, - double property7, bool property8, string property9, int property10)> TenProperties(BigViewModel vm) => + IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int Property6, + double Property7, bool Property8, string Property9, int Property10)> TenProperties(BigViewModel vm) => vm.WhenChanging( x => x.Prop1, x => x.Prop2, @@ -97,9 +104,10 @@ public static /// Eleven-property before-change observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple before changes. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static - IObservable<(string property1, int property2, double property3, bool property4, string property5, int property6, - double property7, bool property8, string property9, int property10, double property11)> ElevenProperties( + IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int Property6, + double Property7, bool Property8, string Property9, int Property10, double Property11)> ElevenProperties( BigViewModel vm) => vm.WhenChanging( x => x.Prop1, @@ -117,9 +125,10 @@ public static /// Twelve-property before-change observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple before changes. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static - IObservable<(string property1, int property2, double property3, bool property4, string property5, int property6, - double property7, bool property8, string property9, int property10, double property11, bool property12)> + IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int Property6, + double Property7, bool Property8, string Property9, int Property10, double Property11, bool Property12)> TwelveProperties(BigViewModel vm) => vm.WhenChanging( x => x.Prop1, @@ -138,9 +147,10 @@ public static /// Thirteen-property before-change observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple before changes. - public static IObservable<(string property1, int property2, double property3, bool property4, string property5, int - property6, double property7, bool property8, string property9, int property10, double property11, bool - property12, string property13)> ThirteenProperties(BigViewModel vm) => + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int + Property6, double Property7, bool Property8, string Property9, int Property10, double Property11, bool + Property12, string Property13)> ThirteenProperties(BigViewModel vm) => vm.WhenChanging( x => x.Prop1, x => x.Prop2, @@ -159,9 +169,10 @@ public static /// Fourteen-property before-change observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple before changes. - public static IObservable<(string property1, int property2, double property3, bool property4, string property5, int - property6, double property7, bool property8, string property9, int property10, double property11, bool - property12, string property13, int property14)> FourteenProperties(BigViewModel vm) => + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int + Property6, double Property7, bool Property8, string Property9, int Property10, double Property11, bool + Property12, string Property13, int Property14)> FourteenProperties(BigViewModel vm) => vm.WhenChanging( x => x.Prop1, x => x.Prop2, @@ -181,9 +192,10 @@ public static /// Fifteen-property before-change observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple before changes. - public static IObservable<(string property1, int property2, double property3, bool property4, string property5, int - property6, double property7, bool property8, string property9, int property10, double property11, bool - property12, string property13, int property14, double property15)> FifteenProperties(BigViewModel vm) => + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int + Property6, double Property7, bool Property8, string Property9, int Property10, double Property11, bool + Property12, string Property13, int Property14, double Property15)> FifteenProperties(BigViewModel vm) => vm.WhenChanging( x => x.Prop1, x => x.Prop2, @@ -204,9 +216,10 @@ public static /// Sixteen-property before-change observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple before changes. - public static IObservable<(string property1, int property2, double property3, bool property4, string property5, int - property6, double property7, bool property8, string property9, int property10, double property11, bool - property12, string property13, int property14, double property15, bool property16)> SixteenProperties( + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IObservable<(string Property1, int Property2, double Property3, bool Property4, string Property5, int + Property6, double Property7, bool Property8, string Property9, int Property10, double Property11, bool + Property12, string Property13, int Property14, double Property15, bool Property16)> SixteenProperties( BigViewModel vm) => vm.WhenChanging( x => x.Prop1, @@ -229,6 +242,7 @@ public static /// Five-property before-change observation with a selector function. /// The view model to observe. /// An observable of the combined string value before changes. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_FiveProperties(BigViewModel vm) => vm.WhenChanging( x => x.Prop1, @@ -241,6 +255,7 @@ public static IObservable WithSelector_FiveProperties(BigViewModel vm) = /// Six-property before-change observation with a selector function. /// The view model to observe. /// An observable of the combined string value before changes. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_SixProperties(BigViewModel vm) => vm.WhenChanging( x => x.Prop1, @@ -254,6 +269,7 @@ public static IObservable WithSelector_SixProperties(BigViewModel vm) => /// Seven-property before-change observation with a selector function. /// The view model to observe. /// An observable of the combined string value before changes. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_SevenProperties(BigViewModel vm) => vm.WhenChanging( x => x.Prop1, @@ -268,6 +284,7 @@ public static IObservable WithSelector_SevenProperties(BigViewModel vm) /// Eight-property before-change observation with a selector function. /// The view model to observe. /// An observable of the combined string value before changes. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_EightProperties(BigViewModel vm) => vm.WhenChanging( x => x.Prop1, @@ -283,6 +300,7 @@ public static IObservable WithSelector_EightProperties(BigViewModel vm) /// Nine-property before-change observation with a selector function. /// The view model to observe. /// An observable of the combined string value before changes. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_NineProperties(BigViewModel vm) => vm.WhenChanging( x => x.Prop1, @@ -299,6 +317,7 @@ public static IObservable WithSelector_NineProperties(BigViewModel vm) = /// Ten-property before-change observation with a selector function. /// The view model to observe. /// An observable of the combined string value before changes. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_TenProperties(BigViewModel vm) => vm.WhenChanging( x => x.Prop1, @@ -316,6 +335,7 @@ public static IObservable WithSelector_TenProperties(BigViewModel vm) => /// Eleven-property before-change observation with a selector function. /// The view model to observe. /// An observable of the combined string value before changes. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_ElevenProperties(BigViewModel vm) => vm.WhenChanging( x => x.Prop1, @@ -335,6 +355,7 @@ public static IObservable WithSelector_ElevenProperties(BigViewModel vm) /// Twelve-property before-change observation with a selector function. /// The view model to observe. /// An observable of the combined string value before changes. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_TwelveProperties(BigViewModel vm) => vm.WhenChanging( x => x.Prop1, @@ -355,6 +376,7 @@ public static IObservable WithSelector_TwelveProperties(BigViewModel vm) /// Thirteen-property before-change observation with a selector function. /// The view model to observe. /// An observable of the combined string value before changes. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_ThirteenProperties(BigViewModel vm) => vm.WhenChanging( x => x.Prop1, @@ -376,6 +398,7 @@ public static IObservable WithSelector_ThirteenProperties(BigViewModel v /// Fourteen-property before-change observation with a selector function. /// The view model to observe. /// An observable of the combined string value before changes. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_FourteenProperties(BigViewModel vm) => vm.WhenChanging( x => x.Prop1, @@ -398,6 +421,7 @@ public static IObservable WithSelector_FourteenProperties(BigViewModel v /// Fifteen-property before-change observation with a selector function. /// The view model to observe. /// An observable of the combined string value before changes. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_FifteenProperties(BigViewModel vm) => vm.WhenChanging( x => x.Prop1, @@ -421,6 +445,7 @@ public static IObservable WithSelector_FifteenProperties(BigViewModel vm /// Sixteen-property before-change observation with a selector function. /// The view model to observe. /// An observable of the combined string value before changes. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable WithSelector_SixteenProperties(BigViewModel vm) => vm.WhenChanging( x => x.Prop1, @@ -445,6 +470,7 @@ public static IObservable WithSelector_SixteenProperties(BigViewModel vm /// Deep property chain before-change observation on BigViewModel.Address.City. /// The view model to observe. /// An observable of the nested City property value before changes. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable DeepChain_AddressCity(BigViewModel vm) => vm.WhenChanging(x => x.Address.City); } diff --git a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenChangingScenarios.cs b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenChangingScenarios.cs index 89ae2316..b3d64216 100644 --- a/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenChangingScenarios.cs +++ b/src/tests/ReactiveUI.Binding.GeneratedCode.TestModels/Scenarios/WhenChangingScenarios.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.GeneratedCode.TestModels.TestModels; namespace ReactiveUI.Binding.GeneratedCode.TestModels.Scenarios; @@ -16,37 +17,43 @@ public static class WhenChangingScenarios /// Single property before-change observation on TestViewModel.Name. /// The view model to observe. /// An observable of the Name property value before changes. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable SingleProperty_Name(TestViewModel vm) => vm.WhenChanging(x => x.Name); /// Single property before-change observation on BigViewModel.Prop1. /// The view model to observe. /// An observable of the Prop1 property value before changes. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable SingleProperty_Prop1(BigViewModel vm) => vm.WhenChanging(x => x.Prop1); /// Two-property before-change observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple before changes. - public static IObservable<(string property1, int property2)> TwoProperties(BigViewModel vm) => + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IObservable<(string Property1, int Property2)> TwoProperties(BigViewModel vm) => vm.WhenChanging(x => x.Prop1, x => x.Prop2); /// Three-property before-change observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple before changes. - public static IObservable<(string property1, int property2, double property3)> ThreeProperties(BigViewModel vm) => + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IObservable<(string Property1, int Property2, double Property3)> ThreeProperties(BigViewModel vm) => vm.WhenChanging(x => x.Prop1, x => x.Prop2, x => x.Prop3); /// Four-property before-change observation returning a tuple. /// The view model to observe. /// An observable of the property value tuple before changes. - public static IObservable<(string property1, int property2, double property3, bool property4)> FourProperties( + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IObservable<(string Property1, int Property2, double Property3, bool Property4)> FourProperties( BigViewModel vm) => vm.WhenChanging(x => x.Prop1, x => x.Prop2, x => x.Prop3, x => x.Prop4); /// Deep property chain before-change observation on BigViewModel.Address.City. /// The view model to observe. /// An observable of the nested City property value before changes. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable DeepChain_AddressCity(BigViewModel vm) => vm.WhenChanging(x => x.Address.City); } diff --git a/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/Binding/BindCommandTests.cs b/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/Binding/BindCommandTests.cs index c88e9d4b..d23e1e5e 100644 --- a/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/Binding/BindCommandTests.cs +++ b/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/Binding/BindCommandTests.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using System.Windows.Input; using ReactiveUI.Binding.GeneratedCode.TestModels.Scenarios; @@ -66,8 +67,7 @@ public async Task BasicNoParam_NullCommand_ClickDoesNotThrow() using var binding = BindCommandScenarios.BasicNoParam(vm, view); - var action = view.SaveButton.PerformClick; - await Assert.That(action).ThrowsNothing(); + await Assert.That((Action)view.SaveButton.PerformClick).ThrowsNothing(); } /// Verifies that when the command changes, the new command is executed on click. @@ -220,8 +220,7 @@ public async Task BasicNoParam_CommandSetToNull_ClickDoesNotThrow() using var binding = BindCommandScenarios.BasicNoParam(vm, view); vm.Save = null; - var action = view.SaveButton.PerformClick; - await Assert.That(action).ThrowsNothing(); + await Assert.That((Action)view.SaveButton.PerformClick).ThrowsNothing(); await Assert.That(command.ExecuteCount).IsEqualTo(0); } @@ -315,8 +314,7 @@ public async Task BasicNoParam_DoubleDispose_DoesNotThrow() var binding = BindCommandScenarios.BasicNoParam(vm, view); binding.Dispose(); - var action = binding.Dispose; - await Assert.That(action).ThrowsNothing(); + await Assert.That((Action)binding.Dispose).ThrowsNothing(); } // ── EventEnabled (Click + Enabled, no Command property) ───────────── @@ -587,6 +585,7 @@ public event EventHandler? CanExecuteChanged public object? LastParameter { get; private set; } /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool CanExecute(object? parameter) => CanExecuteResult; /// diff --git a/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/Binding/BindInteractionTests.cs b/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/Binding/BindInteractionTests.cs index 36b9d503..69311adc 100644 --- a/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/Binding/BindInteractionTests.cs +++ b/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/Binding/BindInteractionTests.cs @@ -193,8 +193,7 @@ public async Task TaskHandler_DoubleDispose_DoesNotThrow() var binding = BindInteractionScenarios.TaskHandler(vm, view); binding.Dispose(); - var action = binding.Dispose; - await Assert.That(action).ThrowsNothing(); + await Assert.That((Action)binding.Dispose).ThrowsNothing(); } /// Verifies that the interaction binding handles multiple sequential Handle calls correctly. diff --git a/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/WhenAnyValue/WhenAnyValueEdgeCaseTests.cs b/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/WhenAnyValue/WhenAnyValueEdgeCaseTests.cs index 8b419874..3ce82974 100644 --- a/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/WhenAnyValue/WhenAnyValueEdgeCaseTests.cs +++ b/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/WhenAnyValue/WhenAnyValueEdgeCaseTests.cs @@ -66,7 +66,7 @@ public async Task Disposal_StopsListening() public async Task TwoProperties_EmitsOnEitherChange() { var fixture = new WhenAnyTestFixture { Value1 = "A", Value2 = "B" }; - var values = new List<(string property1, string property2)>(); + var values = new List<(string Property1, string Property2)>(); using var sub = WhenAnyValueScenarios.TwoProperties(fixture) .Subscribe(values.Add); @@ -75,13 +75,13 @@ public async Task TwoProperties_EmitsOnEitherChange() fixture.Value1 = "C"; - await Assert.That(values[^1].property1).IsEqualTo("C"); - await Assert.That(values[^1].property2).IsEqualTo("B"); + await Assert.That(values[^1].Property1).IsEqualTo("C"); + await Assert.That(values[^1].Property2).IsEqualTo("B"); fixture.Value2 = "D"; - await Assert.That(values[^1].property1).IsEqualTo("C"); - await Assert.That(values[^1].property2).IsEqualTo("D"); + await Assert.That(values[^1].Property1).IsEqualTo("C"); + await Assert.That(values[^1].Property2).IsEqualTo("D"); } /// Verifies that deep chain WhenAnyValue emits the nested property value. diff --git a/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/WhenAnyValue/WhenAnyValueTests.cs b/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/WhenAnyValue/WhenAnyValueTests.cs index 52c69375..73e60cef 100644 --- a/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/WhenAnyValue/WhenAnyValueTests.cs +++ b/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/WhenAnyValue/WhenAnyValueTests.cs @@ -48,14 +48,14 @@ public async Task SingleProperty_EmitsInitialAndChanges() public async Task TwoProperties_EmitsTuples() { var fixture = new WhenAnyTestFixture { Value1 = "A", Value2 = "B" }; - var values = new List<(string property1, string property2)>(); + var values = new List<(string Property1, string Property2)>(); using var sub = WhenAnyValueScenarios.TwoProperties(fixture) .Subscribe(values.Add); await Assert.That(values.Count).IsGreaterThanOrEqualTo(1); - await Assert.That(values[0].property1).IsEqualTo("A"); - await Assert.That(values[0].property2).IsEqualTo("B"); + await Assert.That(values[0].Property1).IsEqualTo("A"); + await Assert.That(values[0].Property2).IsEqualTo("B"); } /// Verifies that three-property WhenAnyValue emits tuples. @@ -64,15 +64,15 @@ public async Task TwoProperties_EmitsTuples() public async Task ThreeProperties_EmitsTuples() { var fixture = new WhenAnyTestFixture { Value1 = "A", Value2 = "B", Value3 = "C" }; - var values = new List<(string property1, string property2, string property3)>(); + var values = new List<(string Property1, string Property2, string Property3)>(); using var sub = WhenAnyValueScenarios.ThreeProperties(fixture) .Subscribe(values.Add); await Assert.That(values.Count).IsGreaterThanOrEqualTo(1); - await Assert.That(values[0].property1).IsEqualTo("A"); - await Assert.That(values[0].property2).IsEqualTo("B"); - await Assert.That(values[0].property3).IsEqualTo("C"); + await Assert.That(values[0].Property1).IsEqualTo("A"); + await Assert.That(values[0].Property2).IsEqualTo("B"); + await Assert.That(values[0].Property3).IsEqualTo("C"); } /// Verifies that WhenAnyValue with a selector projects values correctly. diff --git a/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/WhenChanged/WhenChangedEdgeCaseTests.cs b/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/WhenChanged/WhenChangedEdgeCaseTests.cs index 9bfeb7d1..0e720ef7 100644 --- a/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/WhenChanged/WhenChangedEdgeCaseTests.cs +++ b/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/WhenChanged/WhenChangedEdgeCaseTests.cs @@ -147,20 +147,20 @@ public async Task MultiProperty_WithDeepChain_EmitsOnNestedChange() { var vm = new BigViewModel { Prop1 = HelloValue }; vm.Address.City = Seattle; - var values = new List<(string city, string prop1)>(); + var values = new List<(string City, string Prop1)>(); using var sub = WhenChangedScenarios.MultiProperty_WithDeepChain(vm) .Subscribe(values.Add); await Assert.That(values.Count).IsGreaterThanOrEqualTo(1); - await Assert.That(values[0].city).IsEqualTo(Seattle); - await Assert.That(values[0].prop1).IsEqualTo(HelloValue); + await Assert.That(values[0].City).IsEqualTo(Seattle); + await Assert.That(values[0].Prop1).IsEqualTo(HelloValue); // Change the nested property vm.Address.City = Portland; - await Assert.That(values[^1].city).IsEqualTo(Portland); - await Assert.That(values[^1].prop1).IsEqualTo(HelloValue); + await Assert.That(values[^1].City).IsEqualTo(Portland); + await Assert.That(values[^1].Prop1).IsEqualTo(HelloValue); } /// Verifies that multi-property observation with a deep chain emits when the simple property changes. @@ -170,7 +170,7 @@ public async Task MultiProperty_WithDeepChain_EmitsOnSimpleChange() { var vm = new BigViewModel { Prop1 = HelloValue }; vm.Address.City = Seattle; - var values = new List<(string city, string prop1)>(); + var values = new List<(string City, string Prop1)>(); using var sub = WhenChangedScenarios.MultiProperty_WithDeepChain(vm) .Subscribe(values.Add); @@ -178,8 +178,8 @@ public async Task MultiProperty_WithDeepChain_EmitsOnSimpleChange() // Change the simple property vm.Prop1 = "World"; - await Assert.That(values[^1].city).IsEqualTo(Seattle); - await Assert.That(values[^1].prop1).IsEqualTo("World"); + await Assert.That(values[^1].City).IsEqualTo(Seattle); + await Assert.That(values[^1].Prop1).IsEqualTo("World"); } /// Verifies that multi-property observation with a deep chain re-subscribes when the intermediate object is replaced. @@ -189,7 +189,7 @@ public async Task MultiProperty_WithDeepChain_IntermediateReplacement() { var vm = new BigViewModel { Prop1 = HelloValue }; vm.Address.City = Seattle; - var values = new List<(string city, string prop1)>(); + var values = new List<(string City, string Prop1)>(); using var sub = WhenChangedScenarios.MultiProperty_WithDeepChain(vm) .Subscribe(values.Add); @@ -197,12 +197,12 @@ public async Task MultiProperty_WithDeepChain_IntermediateReplacement() // Replace the intermediate object vm.Address = new() { City = Portland }; - await Assert.That(values[^1].city).IsEqualTo(Portland); + await Assert.That(values[^1].City).IsEqualTo(Portland); // Change the new object's property vm.Address.City = Eugene; - await Assert.That(values[^1].city).IsEqualTo(Eugene); + await Assert.That(values[^1].City).IsEqualTo(Eugene); } /// Verifies that multiple subscriptions to the same WhenChanged observable each receive independent emissions. diff --git a/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/WhenChanged/WhenChangedTests.cs b/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/WhenChanged/WhenChangedTests.cs index b5a8d650..ddb1ad1b 100644 --- a/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/WhenChanged/WhenChangedTests.cs +++ b/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/WhenChanged/WhenChangedTests.cs @@ -115,14 +115,14 @@ public async Task SingleProperty_EmitsSequentialChanges() public async Task TwoProperties_EmitsInitialTuple() { var vm = new BigViewModel { Prop1 = HelloValue, Prop2 = TwoPropIntValue }; - var values = new List<(string property1, int property2)>(); + var values = new List<(string Property1, int Property2)>(); using var sub = WhenChangedScenarios.TwoProperties(vm) .Subscribe(values.Add); await Assert.That(values.Count).IsGreaterThanOrEqualTo(1); - await Assert.That(values[0].property1).IsEqualTo(HelloValue); - await Assert.That(values[0].property2).IsEqualTo(TwoPropIntValue); + await Assert.That(values[0].Property1).IsEqualTo(HelloValue); + await Assert.That(values[0].Property2).IsEqualTo(TwoPropIntValue); } /// Verifies that a two-property WhenChanged emits when either property changes. @@ -131,7 +131,7 @@ public async Task TwoProperties_EmitsInitialTuple() public async Task TwoProperties_EmitsOnEitherChange() { var vm = new BigViewModel { Prop1 = "A", Prop2 = 1 }; - var values = new List<(string property1, int property2)>(); + var values = new List<(string Property1, int Property2)>(); using var sub = WhenChangedScenarios.TwoProperties(vm) .Subscribe(values.Add); @@ -139,14 +139,14 @@ public async Task TwoProperties_EmitsOnEitherChange() vm.Prop1 = "B"; await Assert.That(values.Count).IsGreaterThanOrEqualTo(MinEmissionsAfterChange); - await Assert.That(values[^1].property1).IsEqualTo("B"); - await Assert.That(values[^1].property2).IsEqualTo(1); + await Assert.That(values[^1].Property1).IsEqualTo("B"); + await Assert.That(values[^1].Property2).IsEqualTo(1); vm.Prop2 = UpdatedIntValue; await Assert.That(values.Count).IsGreaterThanOrEqualTo(MinEmissionsAfterTwoChanges); - await Assert.That(values[^1].property1).IsEqualTo("B"); - await Assert.That(values[^1].property2).IsEqualTo(UpdatedIntValue); + await Assert.That(values[^1].Property1).IsEqualTo("B"); + await Assert.That(values[^1].Property2).IsEqualTo(UpdatedIntValue); } /// Verifies that three-property WhenChanged emits initial values. @@ -155,15 +155,15 @@ public async Task TwoProperties_EmitsOnEitherChange() public async Task ThreeProperties_EmitsInitialValues() { var vm = new BigViewModel { Prop1 = "X", Prop2 = ThreePropIntValue, Prop3 = ThreePropDoubleValue }; - var values = new List<(string property1, int property2, double property3)>(); + var values = new List<(string Property1, int Property2, double Property3)>(); using var sub = WhenChangedScenarios.ThreeProperties(vm) .Subscribe(values.Add); await Assert.That(values.Count).IsGreaterThanOrEqualTo(1); - await Assert.That(values[0].property1).IsEqualTo("X"); - await Assert.That(values[0].property2).IsEqualTo(ThreePropIntValue); - await Assert.That(values[0].property3).IsEqualTo(ThreePropDoubleValue); + await Assert.That(values[0].Property1).IsEqualTo("X"); + await Assert.That(values[0].Property2).IsEqualTo(ThreePropIntValue); + await Assert.That(values[0].Property3).IsEqualTo(ThreePropDoubleValue); } /// Verifies that four-property WhenChanged emits initial values. @@ -172,16 +172,16 @@ public async Task ThreeProperties_EmitsInitialValues() public async Task FourProperties_EmitsInitialValues() { var vm = new BigViewModel { Prop1 = "Y", Prop2 = FourPropIntValue, Prop3 = FourPropDoubleValue, Prop4 = true }; - var values = new List<(string property1, int property2, double property3, bool property4)>(); + var values = new List<(string Property1, int Property2, double Property3, bool Property4)>(); using var sub = WhenChangedScenarios.FourProperties(vm) .Subscribe(values.Add); await Assert.That(values.Count).IsGreaterThanOrEqualTo(1); - await Assert.That(values[0].property1).IsEqualTo("Y"); - await Assert.That(values[0].property2).IsEqualTo(FourPropIntValue); - await Assert.That(values[0].property3).IsEqualTo(FourPropDoubleValue); - await Assert.That(values[0].property4).IsTrue(); + await Assert.That(values[0].Property1).IsEqualTo("Y"); + await Assert.That(values[0].Property2).IsEqualTo(FourPropIntValue); + await Assert.That(values[0].Property3).IsEqualTo(FourPropDoubleValue); + await Assert.That(values[0].Property4).IsTrue(); } /// Verifies that WhenChanged with a selector combines property values. diff --git a/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/WhenChanged/WhenChangingEdgeCaseTests.cs b/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/WhenChanged/WhenChangingEdgeCaseTests.cs index 3cc2ce77..bf537e67 100644 --- a/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/WhenChanged/WhenChangingEdgeCaseTests.cs +++ b/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/WhenChanged/WhenChangingEdgeCaseTests.cs @@ -67,15 +67,15 @@ public async Task DeepChain_EmitsBeforeNestedChange() public async Task TwoProperties_EmitsOnEitherChange() { var vm = new BigViewModel { Prop1 = "A", Prop2 = 1 }; - var values = new List<(string property1, int property2)>(); + var values = new List<(string Property1, int Property2)>(); using var sub = WhenChangingScenarios.TwoProperties(vm) .Subscribe(values.Add); // Initial emission await Assert.That(values.Count).IsGreaterThanOrEqualTo(1); - await Assert.That(values[0].property1).IsEqualTo("A"); - await Assert.That(values[0].property2).IsEqualTo(1); + await Assert.That(values[0].Property1).IsEqualTo("A"); + await Assert.That(values[0].Property2).IsEqualTo(1); // Change Prop1 — should emit before-change values vm.Prop1 = "B"; @@ -83,8 +83,8 @@ public async Task TwoProperties_EmitsOnEitherChange() await Assert.That(values.Count).IsGreaterThanOrEqualTo(MinEmissionsAfterChange); // The before-change value for Prop1 should still be "A" - await Assert.That(values[1].property1).IsEqualTo("A"); - await Assert.That(values[1].property2).IsEqualTo(1); + await Assert.That(values[1].Property1).IsEqualTo("A"); + await Assert.That(values[1].Property2).IsEqualTo(1); } /// Verifies that disposing the WhenChanging deep chain subscription stops listening. @@ -113,7 +113,7 @@ public async Task DeepChain_Disposal_StopsListening() public async Task TwoProperties_SequentialChanges() { var vm = new BigViewModel { Prop1 = "A", Prop2 = 1 }; - var values = new List<(string property1, int property2)>(); + var values = new List<(string Property1, int Property2)>(); using var sub = WhenChangingScenarios.TwoProperties(vm) .Subscribe(values.Add); diff --git a/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/WhenChanged/WhenChangingTests.cs b/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/WhenChanged/WhenChangingTests.cs index e85f50ce..f9acb78c 100644 --- a/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/WhenChanged/WhenChangingTests.cs +++ b/src/tests/ReactiveUI.Binding.GeneratedCode.Tests/WhenChanged/WhenChangingTests.cs @@ -108,14 +108,14 @@ public async Task SingleProperty_EmitsSequentialBeforeChangeValues() public async Task TwoProperties_EmitsInitialTuple() { var vm = new BigViewModel { Prop1 = "Hello", Prop2 = TwoPropIntValue }; - var values = new List<(string property1, int property2)>(); + var values = new List<(string Property1, int Property2)>(); using var sub = WhenChangingScenarios.TwoProperties(vm) .Subscribe(values.Add); await Assert.That(values.Count).IsGreaterThanOrEqualTo(1); - await Assert.That(values[0].property1).IsEqualTo("Hello"); - await Assert.That(values[0].property2).IsEqualTo(TwoPropIntValue); + await Assert.That(values[0].Property1).IsEqualTo("Hello"); + await Assert.That(values[0].Property2).IsEqualTo(TwoPropIntValue); } /// Verifies that three-property WhenChanging emits initial values. @@ -124,15 +124,15 @@ public async Task TwoProperties_EmitsInitialTuple() public async Task ThreeProperties_EmitsInitialValues() { var vm = new BigViewModel { Prop1 = "X", Prop2 = ThreePropIntValue, Prop3 = ThreePropDoubleValue }; - var values = new List<(string property1, int property2, double property3)>(); + var values = new List<(string Property1, int Property2, double Property3)>(); using var sub = WhenChangingScenarios.ThreeProperties(vm) .Subscribe(values.Add); await Assert.That(values.Count).IsGreaterThanOrEqualTo(1); - await Assert.That(values[0].property1).IsEqualTo("X"); - await Assert.That(values[0].property2).IsEqualTo(ThreePropIntValue); - await Assert.That(values[0].property3).IsEqualTo(ThreePropDoubleValue); + await Assert.That(values[0].Property1).IsEqualTo("X"); + await Assert.That(values[0].Property2).IsEqualTo(ThreePropIntValue); + await Assert.That(values[0].Property3).IsEqualTo(ThreePropDoubleValue); } /// Verifies that four-property WhenChanging emits initial values. @@ -141,16 +141,16 @@ public async Task ThreeProperties_EmitsInitialValues() public async Task FourProperties_EmitsInitialValues() { var vm = new BigViewModel { Prop1 = "Y", Prop2 = FourPropIntValue, Prop3 = FourPropDoubleValue, Prop4 = true }; - var values = new List<(string property1, int property2, double property3, bool property4)>(); + var values = new List<(string Property1, int Property2, double Property3, bool Property4)>(); using var sub = WhenChangingScenarios.FourProperties(vm) .Subscribe(values.Add); await Assert.That(values.Count).IsGreaterThanOrEqualTo(1); - await Assert.That(values[0].property1).IsEqualTo("Y"); - await Assert.That(values[0].property2).IsEqualTo(FourPropIntValue); - await Assert.That(values[0].property3).IsEqualTo(FourPropDoubleValue); - await Assert.That(values[0].property4).IsTrue(); + await Assert.That(values[0].Property1).IsEqualTo("Y"); + await Assert.That(values[0].Property2).IsEqualTo(FourPropIntValue); + await Assert.That(values[0].Property3).IsEqualTo(FourPropDoubleValue); + await Assert.That(values[0].Property4).IsTrue(); } /// Verifies that disposing the subscription stops listening for changes. diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.BasicNoParam#BindCommandDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.BasicNoParam#BindCommandDispatch.g.verified.cs index 0676bdad..fcdace55 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.BasicNoParam#BindCommandDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.BasicNoParam#BindCommandDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindCommandDispatch.g.cs +//HintName: BindCommandDispatch.g.cs // #pragma warning disable #nullable enable @@ -30,20 +30,20 @@ internal static partial class __ReactiveUIGeneratedBindings if (propertyNameExpression == "x => x.Save" && controlNameExpression == "x => x.SaveButton") { - return __BindCommand_7FFFF69B2C59DF23(view, viewModel); + return __BindCommand_7FFFF69B2C59DF80(view, viewModel); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindCommand_7FFFF69B2C59DF23( + private static global::System.IDisposable __BindCommand_7FFFF69B2C59DF80( global::SharedScenarios.BindCommand.BasicNoParam.MyView view, global::SharedScenarios.BindCommand.BasicNoParam.MyViewModel viewModel) { // BindCommand: Save -> SaveButton (event: Click) if (viewModel == null) { - return global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + return global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; } var commandObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -59,24 +59,24 @@ internal static partial class __ReactiveUIGeneratedBindings .GetBinder(true); if (__customBinder != null) { - var __serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __binderCmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, __cmd => + var __serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __binderCmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, __cmd => { - __serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + __serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; global::System.IObservable __paramObs = global::ReactiveUI.Binding.Observables.EmptyObservable.Instance; __serial.Disposable = __customBinder.BindCommandToObject( __cmd, view.SaveButton, __paramObs) - ?? global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + ?? global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__binderCmdSub, __serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__binderCmdSub, __serial); } } - var serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __cmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, cmd => + var serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __cmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, cmd => { - serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; if (cmd == null) { return; @@ -91,10 +91,10 @@ void __Handler(object? sender, global::System.EventArgs e) } view.SaveButton.Click += __Handler; - serial.Disposable = new global::ReactiveUI.Binding.Observables.ActionDisposable(() => + serial.Disposable = new global::ReactiveUI.Primitives.Disposables.ActionDisposable(() => view.SaveButton.Click -= __Handler); }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__cmdSub, serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__cmdSub, serial); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CFPFallback#BindCommandDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CFPFallback#BindCommandDispatch.g.verified.cs index a5f8d5a5..0aa790ff 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CFPFallback#BindCommandDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CFPFallback#BindCommandDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindCommandDispatch.g.cs +//HintName: BindCommandDispatch.g.cs // #pragma warning disable #nullable enable @@ -24,23 +24,23 @@ internal static partial class __ReactiveUIGeneratedBindings [global::System.Runtime.CompilerServices.CallerFilePath] string callerFilePath = "", [global::System.Runtime.CompilerServices.CallerLineNumber] int callerLineNumber = 0) { - if (callerLineNumber == 73 + if (callerLineNumber == 76 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) { - return __BindCommand_7FFFF69B2C59DF23(view, viewModel); + return __BindCommand_7FFFF69B2C59DF80(view, viewModel); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindCommand_7FFFF69B2C59DF23( + private static global::System.IDisposable __BindCommand_7FFFF69B2C59DF80( global::SharedScenarios.BindCommand.BasicNoParam.MyView view, global::SharedScenarios.BindCommand.BasicNoParam.MyViewModel viewModel) { // BindCommand: Save -> SaveButton (event: Click) if (viewModel == null) { - return global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + return global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; } var commandObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -56,24 +56,24 @@ internal static partial class __ReactiveUIGeneratedBindings .GetBinder(true); if (__customBinder != null) { - var __serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __binderCmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, __cmd => + var __serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __binderCmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, __cmd => { - __serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + __serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; global::System.IObservable __paramObs = global::ReactiveUI.Binding.Observables.EmptyObservable.Instance; __serial.Disposable = __customBinder.BindCommandToObject( __cmd, view.SaveButton, __paramObs) - ?? global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + ?? global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__binderCmdSub, __serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__binderCmdSub, __serial); } } - var serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __cmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, cmd => + var serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __cmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, cmd => { - serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; if (cmd == null) { return; @@ -88,10 +88,10 @@ void __Handler(object? sender, global::System.EventArgs e) } view.SaveButton.Click += __Handler; - serial.Disposable = new global::ReactiveUI.Binding.Observables.ActionDisposable(() => + serial.Disposable = new global::ReactiveUI.Primitives.Disposables.ActionDisposable(() => view.SaveButton.Click -= __Handler); }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__cmdSub, serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__cmdSub, serial); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CFPFallback_ExpressionParam#BindCommandDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CFPFallback_ExpressionParam#BindCommandDispatch.g.verified.cs index cfec9fbd..a2552810 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CFPFallback_ExpressionParam#BindCommandDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CFPFallback_ExpressionParam#BindCommandDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindCommandDispatch.g.cs +//HintName: BindCommandDispatch.g.cs // #pragma warning disable #nullable enable @@ -26,23 +26,23 @@ internal static partial class __ReactiveUIGeneratedBindings [global::System.Runtime.CompilerServices.CallerFilePath] string callerFilePath = "", [global::System.Runtime.CompilerServices.CallerLineNumber] int callerLineNumber = 0) { - if (callerLineNumber == 92 + if (callerLineNumber == 95 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) { - return __BindCommand_7FFFEA737737D1B3(view, viewModel); + return __BindCommand_7FFFEA737737D210(view, viewModel); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindCommand_7FFFEA737737D1B3( + private static global::System.IDisposable __BindCommand_7FFFEA737737D210( global::SharedScenarios.BindCommand.ExpressionParam.MyView view, global::SharedScenarios.BindCommand.ExpressionParam.MyViewModel viewModel) { // BindCommand: Save -> SaveButton (event: Click) if (viewModel == null) { - return global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + return global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; } var commandObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -58,24 +58,24 @@ internal static partial class __ReactiveUIGeneratedBindings .GetBinder(true); if (__customBinder != null) { - var __serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __binderCmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, __cmd => + var __serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __binderCmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, __cmd => { - __serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + __serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; global::System.IObservable __paramObs = new global::ReactiveUI.Binding.Observables.ReturnObservable(viewModel.CurrentItem); __serial.Disposable = __customBinder.BindCommandToObject( __cmd, view.SaveButton, __paramObs) - ?? global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + ?? global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__binderCmdSub, __serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__binderCmdSub, __serial); } } - var serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __cmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, cmd => + var serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __cmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, cmd => { - serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; if (cmd == null) { return; @@ -91,10 +91,10 @@ void __Handler(object? sender, global::System.EventArgs e) } view.SaveButton.Click += __Handler; - serial.Disposable = new global::ReactiveUI.Binding.Observables.ActionDisposable(() => + serial.Disposable = new global::ReactiveUI.Primitives.Disposables.ActionDisposable(() => view.SaveButton.Click -= __Handler); }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__cmdSub, serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__cmdSub, serial); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CFPFallback_ObservableParam#BindCommandDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CFPFallback_ObservableParam#BindCommandDispatch.g.verified.cs index f730ac9d..cc061351 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CFPFallback_ObservableParam#BindCommandDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CFPFallback_ObservableParam#BindCommandDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindCommandDispatch.g.cs +//HintName: BindCommandDispatch.g.cs // #pragma warning disable #nullable enable @@ -25,23 +25,23 @@ internal static partial class __ReactiveUIGeneratedBindings [global::System.Runtime.CompilerServices.CallerFilePath] string callerFilePath = "", [global::System.Runtime.CompilerServices.CallerLineNumber] int callerLineNumber = 0) { - if (callerLineNumber == 74 + if (callerLineNumber == 77 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) { - return __BindCommand_00000F3AD26C974E(view, viewModel, withParameter); + return __BindCommand_00000F3AD26C97AB(view, viewModel, withParameter); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindCommand_00000F3AD26C974E( + private static global::System.IDisposable __BindCommand_00000F3AD26C97AB( global::SharedScenarios.BindCommand.ObservableParam.MyView view, global::SharedScenarios.BindCommand.ObservableParam.MyViewModel viewModel, global::System.IObservable withParameter) { // BindCommand: Save -> SaveButton (event: Click) if (viewModel == null) { - return global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + return global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; } var commandObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -57,28 +57,28 @@ internal static partial class __ReactiveUIGeneratedBindings .GetBinder(true); if (__customBinder != null) { - var __serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __binderCmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, __cmd => + var __serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __binderCmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, __cmd => { - __serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + __serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; global::System.IObservable __paramObs = new global::ReactiveUI.Binding.Observables.SelectObservable(withParameter, __p => __p); __serial.Disposable = __customBinder.BindCommandToObject( __cmd, view.SaveButton, __paramObs) - ?? global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + ?? global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__binderCmdSub, __serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__binderCmdSub, __serial); } } string? __latestParam = default; - var __paramSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe( + var __paramSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe( withParameter, p => System.Threading.Volatile.Write(ref __latestParam, p)); - var serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __cmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, cmd => + var serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __cmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, cmd => { - serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; if (cmd == null) { return; @@ -94,11 +94,11 @@ void __Handler(object? sender, global::System.EventArgs e) } view.SaveButton.Click += __Handler; - serial.Disposable = new global::ReactiveUI.Binding.Observables.ActionDisposable(() => + serial.Disposable = new global::ReactiveUI.Primitives.Disposables.ActionDisposable(() => view.SaveButton.Click -= __Handler); }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2( - new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__cmdSub, __paramSub), serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable( + new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__cmdSub, __paramSub), serial); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CommandProperty#BindCommandDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CommandProperty#BindCommandDispatch.g.verified.cs index 791849d2..faf10a86 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CommandProperty#BindCommandDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CommandProperty#BindCommandDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindCommandDispatch.g.cs +//HintName: BindCommandDispatch.g.cs // #pragma warning disable #nullable enable @@ -30,20 +30,20 @@ internal static partial class __ReactiveUIGeneratedBindings if (propertyNameExpression == "x => x.Save" && controlNameExpression == "x => x.SaveButton") { - return __BindCommand_00000A6C4A2CDD6C(view, viewModel); + return __BindCommand_00000A6C4A2CDDAA(view, viewModel); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindCommand_00000A6C4A2CDD6C( + private static global::System.IDisposable __BindCommand_00000A6C4A2CDDAA( global::SharedScenarios.BindCommand.CommandProperty.MyView view, global::SharedScenarios.BindCommand.CommandProperty.MyViewModel viewModel) { // BindCommand: Save -> SaveButton (event: none) if (viewModel == null) { - return global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + return global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; } var commandObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -59,27 +59,27 @@ internal static partial class __ReactiveUIGeneratedBindings .GetBinder(false); if (__customBinder != null) { - var __serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __binderCmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, __cmd => + var __serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __binderCmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, __cmd => { - __serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + __serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; global::System.IObservable __paramObs = global::ReactiveUI.Binding.Observables.EmptyObservable.Instance; __serial.Disposable = __customBinder.BindCommandToObject( __cmd, view.SaveButton, __paramObs) - ?? global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + ?? global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__binderCmdSub, __serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__binderCmdSub, __serial); } } - var serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __cmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, cmd => + var serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __cmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, cmd => { - serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; view.SaveButton.Command = cmd; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__cmdSub, serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__cmdSub, serial); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CommandPropertyExprParam#BindCommandDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CommandPropertyExprParam#BindCommandDispatch.g.verified.cs index e9f17c0c..47b505f0 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CommandPropertyExprParam#BindCommandDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CommandPropertyExprParam#BindCommandDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindCommandDispatch.g.cs +//HintName: BindCommandDispatch.g.cs // #pragma warning disable #nullable enable @@ -32,20 +32,20 @@ internal static partial class __ReactiveUIGeneratedBindings if (propertyNameExpression == "x => x.Save" && controlNameExpression == "x => x.SaveButton") { - return __BindCommand_00000CE640706F39(view, viewModel); + return __BindCommand_00000CE640706F77(view, viewModel); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindCommand_00000CE640706F39( + private static global::System.IDisposable __BindCommand_00000CE640706F77( global::SharedScenarios.BindCommand.CommandPropertyExprParam.MyView view, global::SharedScenarios.BindCommand.CommandPropertyExprParam.MyViewModel viewModel) { // BindCommand: Save -> SaveButton (event: none) if (viewModel == null) { - return global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + return global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; } var commandObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -61,28 +61,28 @@ internal static partial class __ReactiveUIGeneratedBindings .GetBinder(false); if (__customBinder != null) { - var __serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __binderCmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, __cmd => + var __serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __binderCmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, __cmd => { - __serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + __serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; global::System.IObservable __paramObs = new global::ReactiveUI.Binding.Observables.ReturnObservable(viewModel.CurrentItem); __serial.Disposable = __customBinder.BindCommandToObject( __cmd, view.SaveButton, __paramObs) - ?? global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + ?? global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__binderCmdSub, __serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__binderCmdSub, __serial); } } - var serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __cmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, cmd => + var serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __cmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, cmd => { - serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; view.SaveButton.Command = cmd; view.SaveButton.CommandParameter = viewModel.CurrentItem; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__cmdSub, serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__cmdSub, serial); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CommandPropertyObsParam#BindCommandDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CommandPropertyObsParam#BindCommandDispatch.g.verified.cs index 088849be..d048ff5a 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CommandPropertyObsParam#BindCommandDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CommandPropertyObsParam#BindCommandDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindCommandDispatch.g.cs +//HintName: BindCommandDispatch.g.cs // #pragma warning disable #nullable enable @@ -31,20 +31,20 @@ internal static partial class __ReactiveUIGeneratedBindings if (propertyNameExpression == "x => x.Save" && controlNameExpression == "x => x.SaveButton") { - return __BindCommand_000025BD0B2B0110(view, viewModel, withParameter); + return __BindCommand_000025BD0B2B014E(view, viewModel, withParameter); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindCommand_000025BD0B2B0110( + private static global::System.IDisposable __BindCommand_000025BD0B2B014E( global::SharedScenarios.BindCommand.CommandPropertyObsParam.MyView view, global::SharedScenarios.BindCommand.CommandPropertyObsParam.MyViewModel viewModel, global::System.IObservable withParameter) { // BindCommand: Save -> SaveButton (event: none) if (viewModel == null) { - return global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + return global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; } var commandObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -60,34 +60,34 @@ internal static partial class __ReactiveUIGeneratedBindings .GetBinder(false); if (__customBinder != null) { - var __serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __binderCmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, __cmd => + var __serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __binderCmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, __cmd => { - __serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + __serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; global::System.IObservable __paramObs = new global::ReactiveUI.Binding.Observables.SelectObservable(withParameter, __p => __p); __serial.Disposable = __customBinder.BindCommandToObject( __cmd, view.SaveButton, __paramObs) - ?? global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + ?? global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__binderCmdSub, __serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__binderCmdSub, __serial); } } string? __latestParam = default; - var __paramSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe( + var __paramSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe( withParameter, p => System.Threading.Volatile.Write(ref __latestParam, p)); - var serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __cmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, cmd => + var serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __cmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, cmd => { - serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; view.SaveButton.Command = cmd; var param = System.Threading.Volatile.Read(ref __latestParam); view.SaveButton.CommandParameter = param; if (cmd != null) { - serial.Disposable = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe( + serial.Disposable = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe( withParameter, p => { System.Threading.Volatile.Write(ref __latestParam, p); @@ -95,8 +95,8 @@ internal static partial class __ReactiveUIGeneratedBindings }); } }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2( - new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__cmdSub, __paramSub), serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable( + new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__cmdSub, __paramSub), serial); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CustomEvent#BindCommandDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CustomEvent#BindCommandDispatch.g.verified.cs index 43a5e448..e24f65e5 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CustomEvent#BindCommandDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.CustomEvent#BindCommandDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindCommandDispatch.g.cs +//HintName: BindCommandDispatch.g.cs // #pragma warning disable #nullable enable @@ -30,20 +30,20 @@ internal static partial class __ReactiveUIGeneratedBindings if (propertyNameExpression == "x => x.Save" && controlNameExpression == "x => x.SaveButton") { - return __BindCommand_000010E32465707C(view, viewModel); + return __BindCommand_000010E3246570D9(view, viewModel); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindCommand_000010E32465707C( + private static global::System.IDisposable __BindCommand_000010E3246570D9( global::SharedScenarios.BindCommand.CustomEvent.MyView view, global::SharedScenarios.BindCommand.CustomEvent.MyViewModel viewModel) { // BindCommand: Save -> SaveButton (event: MouseUp) if (viewModel == null) { - return global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + return global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; } var commandObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -59,24 +59,24 @@ internal static partial class __ReactiveUIGeneratedBindings .GetBinder(true); if (__customBinder != null) { - var __serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __binderCmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, __cmd => + var __serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __binderCmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, __cmd => { - __serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + __serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; global::System.IObservable __paramObs = global::ReactiveUI.Binding.Observables.EmptyObservable.Instance; __serial.Disposable = __customBinder.BindCommandToObject( __cmd, view.SaveButton, __paramObs) - ?? global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + ?? global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__binderCmdSub, __serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__binderCmdSub, __serial); } } - var serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __cmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, cmd => + var serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __cmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, cmd => { - serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; if (cmd == null) { return; @@ -91,10 +91,10 @@ void __Handler(object? sender, global::System.EventArgs e) } view.SaveButton.MouseUp += __Handler; - serial.Disposable = new global::ReactiveUI.Binding.Observables.ActionDisposable(() => + serial.Disposable = new global::ReactiveUI.Primitives.Disposables.ActionDisposable(() => view.SaveButton.MouseUp -= __Handler); }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__cmdSub, serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__cmdSub, serial); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.DeepCommandPath#BindCommandDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.DeepCommandPath#BindCommandDispatch.g.verified.cs index 52c981d4..a7455646 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.DeepCommandPath#BindCommandDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.DeepCommandPath#BindCommandDispatch.g.verified.cs @@ -30,20 +30,20 @@ internal static partial class __ReactiveUIGeneratedBindings if (propertyNameExpression == "x => x.Child!.SaveCommand" && controlNameExpression == "x => x.SaveButton") { - return __BindCommand_7FFFEA7C178C3514(view, viewModel); + return __BindCommand_7FFFEA7C178C3571(view, viewModel); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindCommand_7FFFEA7C178C3514( + private static global::System.IDisposable __BindCommand_7FFFEA7C178C3571( global::SharedScenarios.BindCommand.DeepCommandPath.MyView view, global::SharedScenarios.BindCommand.DeepCommandPath.MyViewModel viewModel) { // BindCommand: Child.SaveCommand -> SaveButton (event: Click) if (viewModel == null) { - return global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + return global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; } var __commandObs_s0 = (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -52,16 +52,15 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindCommand.DeepCommandPath.MyViewModel)__o).Child, false); - var __commandObs_s1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__commandObs_s0, - __p1 => __p1 != null - ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( - __p1, - "SaveCommand", - (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindCommand.DeepCommandPath.ChildViewModel)__o).SaveCommand, - false) - : (global::System.IObservable)new global::ReactiveUI.Binding.Observables.ReturnObservable(default(global::System.Windows.Input.ICommand)))); - var commandObs = global::ReactiveUI.Binding.Observables.RxBindingExtensions.DistinctUntilChanged(__commandObs_s1); + var __commandObs_s1 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal(__commandObs_s0, + __p1 => __p1 != null + ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( + (global::System.ComponentModel.INotifyPropertyChanged)__p1, + "SaveCommand", + (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindCommand.DeepCommandPath.ChildViewModel)__o).SaveCommand, + false) + : (global::System.IObservable)new global::ReactiveUI.Binding.Observables.ReturnObservable(default(global::System.Windows.Input.ICommand))); + var commandObs = global::ReactiveUI.Primitives.LinqExtensions.DistinctUntilChanged(__commandObs_s1); if (global::ReactiveUI.Binding.Fallback.CommandBindingAffinityChecker .HasHigherAffinityPlugin(3, true)) @@ -70,24 +69,24 @@ internal static partial class __ReactiveUIGeneratedBindings .GetBinder(true); if (__customBinder != null) { - var __serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __binderCmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, __cmd => + var __serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __binderCmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, __cmd => { - __serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + __serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; global::System.IObservable __paramObs = global::ReactiveUI.Binding.Observables.EmptyObservable.Instance; __serial.Disposable = __customBinder.BindCommandToObject( __cmd, view.SaveButton, __paramObs) - ?? global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + ?? global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__binderCmdSub, __serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__binderCmdSub, __serial); } } - var serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __cmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, cmd => + var serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __cmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, cmd => { - serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; if (cmd == null) { return; @@ -102,10 +101,10 @@ void __Handler(object? sender, global::System.EventArgs e) } view.SaveButton.Click += __Handler; - serial.Disposable = new global::ReactiveUI.Binding.Observables.ActionDisposable(() => + serial.Disposable = new global::ReactiveUI.Primitives.Disposables.ActionDisposable(() => view.SaveButton.Click -= __Handler); }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__cmdSub, serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__cmdSub, serial); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.EventEnabled#BindCommandDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.EventEnabled#BindCommandDispatch.g.verified.cs index 4112b196..04ff5a5a 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.EventEnabled#BindCommandDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.EventEnabled#BindCommandDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindCommandDispatch.g.cs +//HintName: BindCommandDispatch.g.cs // #pragma warning disable #nullable enable @@ -30,20 +30,20 @@ internal static partial class __ReactiveUIGeneratedBindings if (propertyNameExpression == "x => x.Save" && controlNameExpression == "x => x.SaveButton") { - return __BindCommand_0000372503979B7B(view, viewModel); + return __BindCommand_0000372503979BB9(view, viewModel); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindCommand_0000372503979B7B( + private static global::System.IDisposable __BindCommand_0000372503979BB9( global::SharedScenarios.BindCommand.EventEnabled.MyView view, global::SharedScenarios.BindCommand.EventEnabled.MyViewModel viewModel) { // BindCommand: Save -> SaveButton (event: Click) if (viewModel == null) { - return global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + return global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; } var commandObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -59,24 +59,24 @@ internal static partial class __ReactiveUIGeneratedBindings .GetBinder(true); if (__customBinder != null) { - var __serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __binderCmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, __cmd => + var __serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __binderCmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, __cmd => { - __serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + __serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; global::System.IObservable __paramObs = global::ReactiveUI.Binding.Observables.EmptyObservable.Instance; __serial.Disposable = __customBinder.BindCommandToObject( __cmd, view.SaveButton, __paramObs) - ?? global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + ?? global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__binderCmdSub, __serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__binderCmdSub, __serial); } } - var serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __cmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, cmd => + var serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __cmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, cmd => { - serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; if (cmd == null) { view.SaveButton.Enabled = false; @@ -97,13 +97,13 @@ void __Handler(object? sender, global::System.EventArgs e) } view.SaveButton.Click += __Handler; - serial.Disposable = new global::ReactiveUI.Binding.Observables.ActionDisposable(() => + serial.Disposable = new global::ReactiveUI.Primitives.Disposables.ActionDisposable(() => { view.SaveButton.Click -= __Handler; cmd.CanExecuteChanged -= __canExecHandler; }); }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__cmdSub, serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__cmdSub, serial); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.EventEnabledExprParam#BindCommandDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.EventEnabledExprParam#BindCommandDispatch.g.verified.cs index 0c6dbb0d..ecf194a6 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.EventEnabledExprParam#BindCommandDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.EventEnabledExprParam#BindCommandDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindCommandDispatch.g.cs +//HintName: BindCommandDispatch.g.cs // #pragma warning disable #nullable enable @@ -32,20 +32,20 @@ internal static partial class __ReactiveUIGeneratedBindings if (propertyNameExpression == "x => x.Save" && controlNameExpression == "x => x.SaveButton") { - return __BindCommand_00001A92FB3E1A3A(view, viewModel); + return __BindCommand_00001A92FB3E1A78(view, viewModel); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindCommand_00001A92FB3E1A3A( + private static global::System.IDisposable __BindCommand_00001A92FB3E1A78( global::SharedScenarios.BindCommand.EventEnabledExprParam.MyView view, global::SharedScenarios.BindCommand.EventEnabledExprParam.MyViewModel viewModel) { // BindCommand: Save -> SaveButton (event: Click) if (viewModel == null) { - return global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + return global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; } var commandObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -61,24 +61,24 @@ internal static partial class __ReactiveUIGeneratedBindings .GetBinder(true); if (__customBinder != null) { - var __serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __binderCmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, __cmd => + var __serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __binderCmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, __cmd => { - __serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + __serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; global::System.IObservable __paramObs = new global::ReactiveUI.Binding.Observables.ReturnObservable(viewModel.CurrentItem); __serial.Disposable = __customBinder.BindCommandToObject( __cmd, view.SaveButton, __paramObs) - ?? global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + ?? global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__binderCmdSub, __serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__binderCmdSub, __serial); } } - var serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __cmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, cmd => + var serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __cmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, cmd => { - serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; if (cmd == null) { view.SaveButton.Enabled = false; @@ -100,13 +100,13 @@ void __Handler(object? sender, global::System.EventArgs e) } view.SaveButton.Click += __Handler; - serial.Disposable = new global::ReactiveUI.Binding.Observables.ActionDisposable(() => + serial.Disposable = new global::ReactiveUI.Primitives.Disposables.ActionDisposable(() => { view.SaveButton.Click -= __Handler; cmd.CanExecuteChanged -= __canExecHandler; }); }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__cmdSub, serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__cmdSub, serial); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.EventEnabledObsParam#BindCommandDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.EventEnabledObsParam#BindCommandDispatch.g.verified.cs index 740a5952..a1f74174 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.EventEnabledObsParam#BindCommandDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.EventEnabledObsParam#BindCommandDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindCommandDispatch.g.cs +//HintName: BindCommandDispatch.g.cs // #pragma warning disable #nullable enable @@ -31,20 +31,20 @@ internal static partial class __ReactiveUIGeneratedBindings if (propertyNameExpression == "x => x.Save" && controlNameExpression == "x => x.SaveButton") { - return __BindCommand_00001723A43D0325(view, viewModel, withParameter); + return __BindCommand_00001723A43D0363(view, viewModel, withParameter); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindCommand_00001723A43D0325( + private static global::System.IDisposable __BindCommand_00001723A43D0363( global::SharedScenarios.BindCommand.EventEnabledObsParam.MyView view, global::SharedScenarios.BindCommand.EventEnabledObsParam.MyViewModel viewModel, global::System.IObservable withParameter) { // BindCommand: Save -> SaveButton (event: Click) if (viewModel == null) { - return global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + return global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; } var commandObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -60,28 +60,28 @@ internal static partial class __ReactiveUIGeneratedBindings .GetBinder(true); if (__customBinder != null) { - var __serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __binderCmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, __cmd => + var __serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __binderCmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, __cmd => { - __serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + __serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; global::System.IObservable __paramObs = new global::ReactiveUI.Binding.Observables.SelectObservable(withParameter, __p => __p); __serial.Disposable = __customBinder.BindCommandToObject( __cmd, view.SaveButton, __paramObs) - ?? global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + ?? global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__binderCmdSub, __serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__binderCmdSub, __serial); } } string? __latestParam = default; - var __paramSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe( + var __paramSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe( withParameter, p => System.Threading.Volatile.Write(ref __latestParam, p)); - var serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __cmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, cmd => + var serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __cmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, cmd => { - serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; if (cmd == null) { view.SaveButton.Enabled = false; @@ -104,14 +104,14 @@ void __Handler(object? sender, global::System.EventArgs e) } view.SaveButton.Click += __Handler; - serial.Disposable = new global::ReactiveUI.Binding.Observables.ActionDisposable(() => + serial.Disposable = new global::ReactiveUI.Primitives.Disposables.ActionDisposable(() => { view.SaveButton.Click -= __Handler; cmd.CanExecuteChanged -= __canExecHandler; }); }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2( - new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__cmdSub, __paramSub), serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable( + new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__cmdSub, __paramSub), serial); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.ExpressionParam#BindCommandDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.ExpressionParam#BindCommandDispatch.g.verified.cs index 97187f61..1d860c38 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.ExpressionParam#BindCommandDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.ExpressionParam#BindCommandDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindCommandDispatch.g.cs +//HintName: BindCommandDispatch.g.cs // #pragma warning disable #nullable enable @@ -32,20 +32,20 @@ internal static partial class __ReactiveUIGeneratedBindings if (propertyNameExpression == "x => x.Save" && controlNameExpression == "x => x.SaveButton") { - return __BindCommand_7FFFEA737737D1B3(view, viewModel); + return __BindCommand_7FFFEA737737D210(view, viewModel); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindCommand_7FFFEA737737D1B3( + private static global::System.IDisposable __BindCommand_7FFFEA737737D210( global::SharedScenarios.BindCommand.ExpressionParam.MyView view, global::SharedScenarios.BindCommand.ExpressionParam.MyViewModel viewModel) { // BindCommand: Save -> SaveButton (event: Click) if (viewModel == null) { - return global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + return global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; } var commandObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -61,24 +61,24 @@ internal static partial class __ReactiveUIGeneratedBindings .GetBinder(true); if (__customBinder != null) { - var __serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __binderCmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, __cmd => + var __serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __binderCmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, __cmd => { - __serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + __serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; global::System.IObservable __paramObs = new global::ReactiveUI.Binding.Observables.ReturnObservable(viewModel.CurrentItem); __serial.Disposable = __customBinder.BindCommandToObject( __cmd, view.SaveButton, __paramObs) - ?? global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + ?? global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__binderCmdSub, __serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__binderCmdSub, __serial); } } - var serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __cmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, cmd => + var serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __cmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, cmd => { - serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; if (cmd == null) { return; @@ -94,10 +94,10 @@ void __Handler(object? sender, global::System.EventArgs e) } view.SaveButton.Click += __Handler; - serial.Disposable = new global::ReactiveUI.Binding.Observables.ActionDisposable(() => + serial.Disposable = new global::ReactiveUI.Primitives.Disposables.ActionDisposable(() => view.SaveButton.Click -= __Handler); }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__cmdSub, serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__cmdSub, serial); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.NoEvent#BindCommandDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.NoEvent#BindCommandDispatch.g.verified.cs index 2b8a253b..9d488bf6 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.NoEvent#BindCommandDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.NoEvent#BindCommandDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindCommandDispatch.g.cs +//HintName: BindCommandDispatch.g.cs // #pragma warning disable #nullable enable @@ -30,20 +30,20 @@ internal static partial class __ReactiveUIGeneratedBindings if (propertyNameExpression == "x => x.Save" && controlNameExpression == "x => x.Label") { - return __BindCommand_000006F07B8E70B0(view, viewModel); + return __BindCommand_000006F07B8E70EE(view, viewModel); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindCommand_000006F07B8E70B0( + private static global::System.IDisposable __BindCommand_000006F07B8E70EE( global::SharedScenarios.BindCommand.NoEvent.MyView view, global::SharedScenarios.BindCommand.NoEvent.MyViewModel viewModel) { // BindCommand: Save -> Label (event: none) if (viewModel == null) { - return global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + return global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; } var commandObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -59,16 +59,16 @@ internal static partial class __ReactiveUIGeneratedBindings .GetBinder(false); if (__customBinder != null) { - var __serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __binderCmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, __cmd => + var __serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __binderCmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, __cmd => { - __serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + __serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; global::System.IObservable __paramObs = global::ReactiveUI.Binding.Observables.EmptyObservable.Instance; __serial.Disposable = __customBinder.BindCommandToObject( __cmd, view.Label, __paramObs) - ?? global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + ?? global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__binderCmdSub, __serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__binderCmdSub, __serial); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.ObservableParam#BindCommandDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.ObservableParam#BindCommandDispatch.g.verified.cs index 49cd777f..13d8caeb 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.ObservableParam#BindCommandDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BCG.ObservableParam#BindCommandDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindCommandDispatch.g.cs +//HintName: BindCommandDispatch.g.cs // #pragma warning disable #nullable enable @@ -31,20 +31,20 @@ internal static partial class __ReactiveUIGeneratedBindings if (propertyNameExpression == "x => x.Save" && controlNameExpression == "x => x.SaveButton") { - return __BindCommand_00000F3AD26C974E(view, viewModel, withParameter); + return __BindCommand_00000F3AD26C97AB(view, viewModel, withParameter); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindCommand_00000F3AD26C974E( + private static global::System.IDisposable __BindCommand_00000F3AD26C97AB( global::SharedScenarios.BindCommand.ObservableParam.MyView view, global::SharedScenarios.BindCommand.ObservableParam.MyViewModel viewModel, global::System.IObservable withParameter) { // BindCommand: Save -> SaveButton (event: Click) if (viewModel == null) { - return global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + return global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; } var commandObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -60,28 +60,28 @@ internal static partial class __ReactiveUIGeneratedBindings .GetBinder(true); if (__customBinder != null) { - var __serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __binderCmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, __cmd => + var __serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __binderCmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, __cmd => { - __serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + __serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; global::System.IObservable __paramObs = new global::ReactiveUI.Binding.Observables.SelectObservable(withParameter, __p => __p); __serial.Disposable = __customBinder.BindCommandToObject( __cmd, view.SaveButton, __paramObs) - ?? global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + ?? global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__binderCmdSub, __serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__binderCmdSub, __serial); } } string? __latestParam = default; - var __paramSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe( + var __paramSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe( withParameter, p => System.Threading.Volatile.Write(ref __latestParam, p)); - var serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); - var __cmdSub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(commandObs, cmd => + var serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); + var __cmdSub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(commandObs, cmd => { - serial.Disposable = global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + serial.Disposable = global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; if (cmd == null) { return; @@ -97,11 +97,11 @@ void __Handler(object? sender, global::System.EventArgs e) } view.SaveButton.Click += __Handler; - serial.Disposable = new global::ReactiveUI.Binding.Observables.ActionDisposable(() => + serial.Disposable = new global::ReactiveUI.Primitives.Disposables.ActionDisposable(() => view.SaveButton.Click -= __Handler); }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2( - new global::ReactiveUI.Binding.Observables.CompositeDisposable2(__cmdSub, __paramSub), serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable( + new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(__cmdSub, __paramSub), serial); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BG.2STB_GEI#BindDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BG.2STB_GEI#BindDispatch.g.verified.cs index a42ea6ce..afa09f0f 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BG.2STB_GEI#BindDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BG.2STB_GEI#BindDispatch.g.verified.cs @@ -13,7 +13,7 @@ internal static partial class __ReactiveUIGeneratedBindings /// Concrete typed overload for Bind from global::SharedScenarios.Bind.TwoSameTypeBindings.MyViewModel to global::SharedScenarios.Bind.TwoSameTypeBindings.MyView. /// Uses CallerArgumentExpression for dispatch. /// - public static global::ReactiveUI.Binding.IReactiveBinding Bind( + public static global::ReactiveUI.Binding.IReactiveBinding Bind( this global::SharedScenarios.Bind.TwoSameTypeBindings.MyView view, global::SharedScenarios.Bind.TwoSameTypeBindings.MyViewModel viewModel, global::System.Linq.Expressions.Expression> viewModelProperty, @@ -37,7 +37,7 @@ internal static partial class __ReactiveUIGeneratedBindings "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::ReactiveUI.Binding.IReactiveBinding __Bind_7FFFE38A2E1A448A(global::SharedScenarios.Bind.TwoSameTypeBindings.MyViewModel viewModel, global::SharedScenarios.Bind.TwoSameTypeBindings.MyView view) + private static global::ReactiveUI.Binding.IReactiveBinding __Bind_7FFFE38A2E1A448A(global::SharedScenarios.Bind.TwoSameTypeBindings.MyViewModel viewModel, global::SharedScenarios.Bind.TwoSameTypeBindings.MyView view) { // Bind: FirstName <-> FirstNameText var vmObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -51,31 +51,31 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.Bind.TwoSameTypeBindings.MyView)__o).FirstNameText, true); - var d1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(vmObs, value => + var d1 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(vmObs, value => { view.FirstNameText = value; }); - var __viewSkipped = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Skip(viewObs, 1); - var d2 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(__viewSkipped, value => + var __viewSkipped = global::ReactiveUI.Primitives.LinqExtensions.Skip(viewObs, 1); + var d2 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(__viewSkipped, value => { viewModel.FirstName = value; }); - var __vmTagged = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(vmObs, v => ((object?)v, true)); - var __viewTagged = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__viewSkipped, v => ((object?)v, false)); - var changed = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Merge(__vmTagged, __viewTagged); + var __vmTagged = new global::ReactiveUI.Primitives.Signals.MapSignal(vmObs, v => ((object?)v, true)); + var __viewTagged = new global::ReactiveUI.Primitives.Signals.MapSignal(__viewSkipped, v => ((object?)v, false)); + var changed = new global::ReactiveUI.Primitives.Advanced.MergeSignal<(object?, bool)>(__vmTagged, __viewTagged); - var disposable = new global::ReactiveUI.Binding.Observables.CompositeDisposable2(d1, d2); + var disposable = new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(d1, d2); - return new global::ReactiveUI.Binding.ReactiveBinding( + return new global::ReactiveUI.Binding.ReactiveBinding( view, changed, global::ReactiveUI.Binding.BindingDirection.TwoWay, disposable); } - private static global::ReactiveUI.Binding.IReactiveBinding __Bind_7FFFE389FC4EEB01(global::SharedScenarios.Bind.TwoSameTypeBindings.MyViewModel viewModel, global::SharedScenarios.Bind.TwoSameTypeBindings.MyView view) + private static global::ReactiveUI.Binding.IReactiveBinding __Bind_7FFFE389FC4EEB01(global::SharedScenarios.Bind.TwoSameTypeBindings.MyViewModel viewModel, global::SharedScenarios.Bind.TwoSameTypeBindings.MyView view) { // Bind: LastName <-> LastNameText var vmObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -89,24 +89,24 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.Bind.TwoSameTypeBindings.MyView)__o).LastNameText, true); - var d1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(vmObs, value => + var d1 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(vmObs, value => { view.LastNameText = value; }); - var __viewSkipped = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Skip(viewObs, 1); - var d2 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(__viewSkipped, value => + var __viewSkipped = global::ReactiveUI.Primitives.LinqExtensions.Skip(viewObs, 1); + var d2 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(__viewSkipped, value => { viewModel.LastName = value; }); - var __vmTagged = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(vmObs, v => ((object?)v, true)); - var __viewTagged = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__viewSkipped, v => ((object?)v, false)); - var changed = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Merge(__vmTagged, __viewTagged); + var __vmTagged = new global::ReactiveUI.Primitives.Signals.MapSignal(vmObs, v => ((object?)v, true)); + var __viewTagged = new global::ReactiveUI.Primitives.Signals.MapSignal(__viewSkipped, v => ((object?)v, false)); + var changed = new global::ReactiveUI.Primitives.Advanced.MergeSignal<(object?, bool)>(__vmTagged, __viewTagged); - var disposable = new global::ReactiveUI.Binding.Observables.CompositeDisposable2(d1, d2); + var disposable = new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(d1, d2); - return new global::ReactiveUI.Binding.ReactiveBinding( + return new global::ReactiveUI.Binding.ReactiveBinding( view, changed, global::ReactiveUI.Binding.BindingDirection.TwoWay, diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BG.MB#BindDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BG.MB#BindDispatch.g.verified.cs index 8656b613..8f5d9943 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BG.MB#BindDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BG.MB#BindDispatch.g.verified.cs @@ -13,7 +13,7 @@ internal static partial class __ReactiveUIGeneratedBindings /// Concrete typed overload for Bind from global::SharedScenarios.Bind.MultipleBindings.MyViewModel to global::SharedScenarios.Bind.MultipleBindings.MyView. /// Uses CallerArgumentExpression for dispatch. /// - public static global::ReactiveUI.Binding.IReactiveBinding Bind( + public static global::ReactiveUI.Binding.IReactiveBinding Bind( this global::SharedScenarios.Bind.MultipleBindings.MyView view, global::SharedScenarios.Bind.MultipleBindings.MyViewModel viewModel, global::System.Linq.Expressions.Expression> viewModelProperty, @@ -32,7 +32,7 @@ internal static partial class __ReactiveUIGeneratedBindings "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::ReactiveUI.Binding.IReactiveBinding __Bind_7FFFFC09455D2B72(global::SharedScenarios.Bind.MultipleBindings.MyViewModel viewModel, global::SharedScenarios.Bind.MultipleBindings.MyView view) + private static global::ReactiveUI.Binding.IReactiveBinding __Bind_7FFFFC09455D2B72(global::SharedScenarios.Bind.MultipleBindings.MyViewModel viewModel, global::SharedScenarios.Bind.MultipleBindings.MyView view) { // Bind: Name <-> NameText var vmObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -46,24 +46,24 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.Bind.MultipleBindings.MyView)__o).NameText, true); - var d1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(vmObs, value => + var d1 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(vmObs, value => { view.NameText = value; }); - var __viewSkipped = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Skip(viewObs, 1); - var d2 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(__viewSkipped, value => + var __viewSkipped = global::ReactiveUI.Primitives.LinqExtensions.Skip(viewObs, 1); + var d2 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(__viewSkipped, value => { viewModel.Name = value; }); - var __vmTagged = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(vmObs, v => ((object?)v, true)); - var __viewTagged = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__viewSkipped, v => ((object?)v, false)); - var changed = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Merge(__vmTagged, __viewTagged); + var __vmTagged = new global::ReactiveUI.Primitives.Signals.MapSignal(vmObs, v => ((object?)v, true)); + var __viewTagged = new global::ReactiveUI.Primitives.Signals.MapSignal(__viewSkipped, v => ((object?)v, false)); + var changed = new global::ReactiveUI.Primitives.Advanced.MergeSignal<(object?, bool)>(__vmTagged, __viewTagged); - var disposable = new global::ReactiveUI.Binding.Observables.CompositeDisposable2(d1, d2); + var disposable = new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(d1, d2); - return new global::ReactiveUI.Binding.ReactiveBinding( + return new global::ReactiveUI.Binding.ReactiveBinding( view, changed, global::ReactiveUI.Binding.BindingDirection.TwoWay, @@ -74,7 +74,7 @@ internal static partial class __ReactiveUIGeneratedBindings /// Concrete typed overload for Bind from global::SharedScenarios.Bind.MultipleBindings.MyViewModel to global::SharedScenarios.Bind.MultipleBindings.MyView. /// Uses CallerArgumentExpression for dispatch. /// - public static global::ReactiveUI.Binding.IReactiveBinding Bind( + public static global::ReactiveUI.Binding.IReactiveBinding Bind( this global::SharedScenarios.Bind.MultipleBindings.MyView view, global::SharedScenarios.Bind.MultipleBindings.MyViewModel viewModel, global::System.Linq.Expressions.Expression> viewModelProperty, @@ -93,7 +93,7 @@ internal static partial class __ReactiveUIGeneratedBindings "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::ReactiveUI.Binding.IReactiveBinding __Bind_7FFFFC08E70C4031(global::SharedScenarios.Bind.MultipleBindings.MyViewModel viewModel, global::SharedScenarios.Bind.MultipleBindings.MyView view) + private static global::ReactiveUI.Binding.IReactiveBinding __Bind_7FFFFC08E70C4031(global::SharedScenarios.Bind.MultipleBindings.MyViewModel viewModel, global::SharedScenarios.Bind.MultipleBindings.MyView view) { // Bind: Age <-> AgeText var vmObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -107,24 +107,24 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.Bind.MultipleBindings.MyView)__o).AgeText, true); - var d1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(vmObs, value => + var d1 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(vmObs, value => { view.AgeText = value; }); - var __viewSkipped = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Skip(viewObs, 1); - var d2 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(__viewSkipped, value => + var __viewSkipped = global::ReactiveUI.Primitives.LinqExtensions.Skip(viewObs, 1); + var d2 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(__viewSkipped, value => { viewModel.Age = value; }); - var __vmTagged = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(vmObs, v => ((object?)v, true)); - var __viewTagged = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__viewSkipped, v => ((object?)v, false)); - var changed = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Merge(__vmTagged, __viewTagged); + var __vmTagged = new global::ReactiveUI.Primitives.Signals.MapSignal(vmObs, v => ((object?)v, true)); + var __viewTagged = new global::ReactiveUI.Primitives.Signals.MapSignal(__viewSkipped, v => ((object?)v, false)); + var changed = new global::ReactiveUI.Primitives.Advanced.MergeSignal<(object?, bool)>(__vmTagged, __viewTagged); - var disposable = new global::ReactiveUI.Binding.Observables.CompositeDisposable2(d1, d2); + var disposable = new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(d1, d2); - return new global::ReactiveUI.Binding.ReactiveBinding( + return new global::ReactiveUI.Binding.ReactiveBinding( view, changed, global::ReactiveUI.Binding.BindingDirection.TwoWay, diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BG.SP_S2S#BindDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BG.SP_S2S#BindDispatch.g.verified.cs index 70b472a3..02d2993d 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BG.SP_S2S#BindDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BG.SP_S2S#BindDispatch.g.verified.cs @@ -13,7 +13,7 @@ internal static partial class __ReactiveUIGeneratedBindings /// Concrete typed overload for Bind from global::SharedScenarios.Bind.SinglePropertyStringToString.MyViewModel to global::SharedScenarios.Bind.SinglePropertyStringToString.MyView. /// Uses CallerArgumentExpression for dispatch. /// - public static global::ReactiveUI.Binding.IReactiveBinding Bind( + public static global::ReactiveUI.Binding.IReactiveBinding Bind( this global::SharedScenarios.Bind.SinglePropertyStringToString.MyView view, global::SharedScenarios.Bind.SinglePropertyStringToString.MyViewModel viewModel, global::System.Linq.Expressions.Expression> viewModelProperty, @@ -26,13 +26,13 @@ internal static partial class __ReactiveUIGeneratedBindings if (viewModelPropertyExpression == "x => x.Name" && viewPropertyExpression == "x => x.NameText") { - return __Bind_000011908961B60B(viewModel, view); + return __Bind_000011908961B668(viewModel, view); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::ReactiveUI.Binding.IReactiveBinding __Bind_000011908961B60B(global::SharedScenarios.Bind.SinglePropertyStringToString.MyViewModel viewModel, global::SharedScenarios.Bind.SinglePropertyStringToString.MyView view) + private static global::ReactiveUI.Binding.IReactiveBinding __Bind_000011908961B668(global::SharedScenarios.Bind.SinglePropertyStringToString.MyViewModel viewModel, global::SharedScenarios.Bind.SinglePropertyStringToString.MyView view) { // Bind: Name <-> NameText var vmObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -46,24 +46,24 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.Bind.SinglePropertyStringToString.MyView)__o).NameText, true); - var d1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(vmObs, value => + var d1 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(vmObs, value => { view.NameText = value; }); - var __viewSkipped = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Skip(viewObs, 1); - var d2 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(__viewSkipped, value => + var __viewSkipped = global::ReactiveUI.Primitives.LinqExtensions.Skip(viewObs, 1); + var d2 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(__viewSkipped, value => { viewModel.Name = value; }); - var __vmTagged = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(vmObs, v => ((object?)v, true)); - var __viewTagged = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__viewSkipped, v => ((object?)v, false)); - var changed = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Merge(__vmTagged, __viewTagged); + var __vmTagged = new global::ReactiveUI.Primitives.Signals.MapSignal(vmObs, v => ((object?)v, true)); + var __viewTagged = new global::ReactiveUI.Primitives.Signals.MapSignal(__viewSkipped, v => ((object?)v, false)); + var changed = new global::ReactiveUI.Primitives.Advanced.MergeSignal<(object?, bool)>(__vmTagged, __viewTagged); - var disposable = new global::ReactiveUI.Binding.Observables.CompositeDisposable2(d1, d2); + var disposable = new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(d1, d2); - return new global::ReactiveUI.Binding.ReactiveBinding( + return new global::ReactiveUI.Binding.ReactiveBinding( view, changed, global::ReactiveUI.Binding.BindingDirection.TwoWay, diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BG.SP_S2S_CFP#BindDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BG.SP_S2S_CFP#BindDispatch.g.verified.cs index af4d14d6..ca46c35c 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BG.SP_S2S_CFP#BindDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BG.SP_S2S_CFP#BindDispatch.g.verified.cs @@ -13,7 +13,7 @@ internal static partial class __ReactiveUIGeneratedBindings /// Concrete typed overload for Bind from global::SharedScenarios.Bind.SinglePropertyStringToString.MyViewModel to global::SharedScenarios.Bind.SinglePropertyStringToString.MyView. /// Uses CallerFilePath + CallerLineNumber for dispatch. /// - public static global::ReactiveUI.Binding.IReactiveBinding Bind( + public static global::ReactiveUI.Binding.IReactiveBinding Bind( this global::SharedScenarios.Bind.SinglePropertyStringToString.MyView view, global::SharedScenarios.Bind.SinglePropertyStringToString.MyViewModel viewModel, global::System.Linq.Expressions.Expression> viewModelProperty, @@ -23,16 +23,16 @@ internal static partial class __ReactiveUIGeneratedBindings [global::System.Runtime.CompilerServices.CallerFilePath] string callerFilePath = "", [global::System.Runtime.CompilerServices.CallerLineNumber] int callerLineNumber = 0) { - if (callerLineNumber == 74 + if (callerLineNumber == 77 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) { - return __Bind_000011908961B60B(viewModel, view); + return __Bind_000011908961B668(viewModel, view); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::ReactiveUI.Binding.IReactiveBinding __Bind_000011908961B60B(global::SharedScenarios.Bind.SinglePropertyStringToString.MyViewModel viewModel, global::SharedScenarios.Bind.SinglePropertyStringToString.MyView view) + private static global::ReactiveUI.Binding.IReactiveBinding __Bind_000011908961B668(global::SharedScenarios.Bind.SinglePropertyStringToString.MyViewModel viewModel, global::SharedScenarios.Bind.SinglePropertyStringToString.MyView view) { // Bind: Name <-> NameText var vmObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -46,24 +46,24 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.Bind.SinglePropertyStringToString.MyView)__o).NameText, true); - var d1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(vmObs, value => + var d1 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(vmObs, value => { view.NameText = value; }); - var __viewSkipped = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Skip(viewObs, 1); - var d2 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(__viewSkipped, value => + var __viewSkipped = global::ReactiveUI.Primitives.LinqExtensions.Skip(viewObs, 1); + var d2 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(__viewSkipped, value => { viewModel.Name = value; }); - var __vmTagged = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(vmObs, v => ((object?)v, true)); - var __viewTagged = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__viewSkipped, v => ((object?)v, false)); - var changed = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Merge(__vmTagged, __viewTagged); + var __vmTagged = new global::ReactiveUI.Primitives.Signals.MapSignal(vmObs, v => ((object?)v, true)); + var __viewTagged = new global::ReactiveUI.Primitives.Signals.MapSignal(__viewSkipped, v => ((object?)v, false)); + var changed = new global::ReactiveUI.Primitives.Advanced.MergeSignal<(object?, bool)>(__vmTagged, __viewTagged); - var disposable = new global::ReactiveUI.Binding.Observables.CompositeDisposable2(d1, d2); + var disposable = new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(d1, d2); - return new global::ReactiveUI.Binding.ReactiveBinding( + return new global::ReactiveUI.Binding.ReactiveBinding( view, changed, global::ReactiveUI.Binding.BindingDirection.TwoWay, diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BG.SP_WC#BindDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BG.SP_WC#BindDispatch.g.verified.cs index 8c760e10..9912a511 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BG.SP_WC#BindDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BG.SP_WC#BindDispatch.g.verified.cs @@ -13,7 +13,7 @@ internal static partial class __ReactiveUIGeneratedBindings /// Concrete typed overload for Bind from global::SharedScenarios.Bind.SinglePropertyWithConverters.MyViewModel to global::SharedScenarios.Bind.SinglePropertyWithConverters.MyView. /// Uses CallerArgumentExpression for dispatch. /// - public static global::ReactiveUI.Binding.IReactiveBinding Bind( + public static global::ReactiveUI.Binding.IReactiveBinding Bind( this global::SharedScenarios.Bind.SinglePropertyWithConverters.MyView view, global::SharedScenarios.Bind.SinglePropertyWithConverters.MyViewModel viewModel, global::System.Linq.Expressions.Expression> viewModelProperty, @@ -28,13 +28,13 @@ internal static partial class __ReactiveUIGeneratedBindings if (viewModelPropertyExpression == "x => x.Count" && viewPropertyExpression == "x => x.CountText") { - return __Bind_0000102A67853C5B(viewModel, view, viewModelToViewConverter, viewToViewModelConverter); + return __Bind_0000102A67853CB8(viewModel, view, viewModelToViewConverter, viewToViewModelConverter); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::ReactiveUI.Binding.IReactiveBinding __Bind_0000102A67853C5B(global::SharedScenarios.Bind.SinglePropertyWithConverters.MyViewModel viewModel, global::SharedScenarios.Bind.SinglePropertyWithConverters.MyView view, global::System.Func viewModelToViewConverter, global::System.Func viewToViewModelConverter) + private static global::ReactiveUI.Binding.IReactiveBinding __Bind_0000102A67853CB8(global::SharedScenarios.Bind.SinglePropertyWithConverters.MyViewModel viewModel, global::SharedScenarios.Bind.SinglePropertyWithConverters.MyView view, global::System.Func viewModelToViewConverter, global::System.Func viewToViewModelConverter) { // Bind: Count <-> CountText (with conversion) var vmObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -47,27 +47,27 @@ internal static partial class __ReactiveUIGeneratedBindings "CountText", (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.Bind.SinglePropertyWithConverters.MyView)__o).CountText, true); - var vmBind = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(vmObs, viewModelToViewConverter); - var viewBind = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(viewObs, viewToViewModelConverter); + var vmBind = new global::ReactiveUI.Primitives.Signals.MapSignal(vmObs, viewModelToViewConverter); + var viewBind = new global::ReactiveUI.Primitives.Signals.MapSignal(viewObs, viewToViewModelConverter); - var d1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(vmBind, value => + var d1 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(vmBind, value => { view.CountText = value; }); - var __viewSkipped = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Skip(viewBind, 1); - var d2 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(__viewSkipped, value => + var __viewSkipped = global::ReactiveUI.Primitives.LinqExtensions.Skip(viewBind, 1); + var d2 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(__viewSkipped, value => { viewModel.Count = value; }); - var __vmTagged = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(vmBind, v => ((object?)v, true)); - var __viewTagged = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__viewSkipped, v => ((object?)v, false)); - var changed = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Merge(__vmTagged, __viewTagged); + var __vmTagged = new global::ReactiveUI.Primitives.Signals.MapSignal(vmBind, v => ((object?)v, true)); + var __viewTagged = new global::ReactiveUI.Primitives.Signals.MapSignal(__viewSkipped, v => ((object?)v, false)); + var changed = new global::ReactiveUI.Primitives.Advanced.MergeSignal<(object?, bool)>(__vmTagged, __viewTagged); - var disposable = new global::ReactiveUI.Binding.Observables.CompositeDisposable2(d1, d2); + var disposable = new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(d1, d2); - return new global::ReactiveUI.Binding.ReactiveBinding( + return new global::ReactiveUI.Binding.ReactiveBinding( view, changed, global::ReactiveUI.Binding.BindingDirection.TwoWay, diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BG.SP_WCSched#BindDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BG.SP_WCSched#BindDispatch.g.verified.cs index 38a61b00..14fded5e 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BG.SP_WCSched#BindDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BG.SP_WCSched#BindDispatch.g.verified.cs @@ -13,7 +13,7 @@ internal static partial class __ReactiveUIGeneratedBindings /// Concrete typed overload for Bind from global::SharedScenarios.Bind.SinglePropertyWithConvertersAndScheduler.MyViewModel to global::SharedScenarios.Bind.SinglePropertyWithConvertersAndScheduler.MyView. /// Uses CallerArgumentExpression for dispatch. /// - public static global::ReactiveUI.Binding.IReactiveBinding Bind( + public static global::ReactiveUI.Binding.IReactiveBinding Bind( this global::SharedScenarios.Bind.SinglePropertyWithConvertersAndScheduler.MyView view, global::SharedScenarios.Bind.SinglePropertyWithConvertersAndScheduler.MyViewModel viewModel, global::System.Linq.Expressions.Expression> viewModelProperty, @@ -29,13 +29,13 @@ internal static partial class __ReactiveUIGeneratedBindings if (viewModelPropertyExpression == "x => x.Count" && viewPropertyExpression == "x => x.CountText") { - return __Bind_7FFFD53F494404E1(viewModel, view, viewModelToViewConverter, viewToViewModelConverter, scheduler); + return __Bind_7FFFD53F4944055D(viewModel, view, viewModelToViewConverter, viewToViewModelConverter, scheduler); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::ReactiveUI.Binding.IReactiveBinding __Bind_7FFFD53F494404E1(global::SharedScenarios.Bind.SinglePropertyWithConvertersAndScheduler.MyViewModel viewModel, global::SharedScenarios.Bind.SinglePropertyWithConvertersAndScheduler.MyView view, global::System.Func viewModelToViewConverter, global::System.Func viewToViewModelConverter, global::ReactiveUI.Primitives.Concurrency.ISequencer scheduler) + private static global::ReactiveUI.Binding.IReactiveBinding __Bind_7FFFD53F4944055D(global::SharedScenarios.Bind.SinglePropertyWithConvertersAndScheduler.MyViewModel viewModel, global::SharedScenarios.Bind.SinglePropertyWithConvertersAndScheduler.MyView view, global::System.Func viewModelToViewConverter, global::System.Func viewToViewModelConverter, global::ReactiveUI.Primitives.Concurrency.ISequencer scheduler) { // Bind: Count <-> CountText (with conversion) (with scheduler) var vmObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -48,29 +48,29 @@ internal static partial class __ReactiveUIGeneratedBindings "CountText", (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.Bind.SinglePropertyWithConvertersAndScheduler.MyView)__o).CountText, true); - var __vmSelected = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(vmObs, viewModelToViewConverter); - var __viewSelected = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(viewObs, viewToViewModelConverter); + var __vmSelected = new global::ReactiveUI.Primitives.Signals.MapSignal(vmObs, viewModelToViewConverter); + var __viewSelected = new global::ReactiveUI.Primitives.Signals.MapSignal(viewObs, viewToViewModelConverter); var vmBind = new global::ReactiveUI.Binding.Observables.ObserveOnObservable(__vmSelected, scheduler); var viewBind = new global::ReactiveUI.Binding.Observables.ObserveOnObservable(__viewSelected, scheduler); - var d1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(vmBind, value => + var d1 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(vmBind, value => { view.CountText = value; }); - var __viewSkipped = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Skip(viewBind, 1); - var d2 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(__viewSkipped, value => + var __viewSkipped = global::ReactiveUI.Primitives.LinqExtensions.Skip(viewBind, 1); + var d2 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(__viewSkipped, value => { viewModel.Count = value; }); - var __vmTagged = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(vmBind, v => ((object?)v, true)); - var __viewTagged = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__viewSkipped, v => ((object?)v, false)); - var changed = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Merge(__vmTagged, __viewTagged); + var __vmTagged = new global::ReactiveUI.Primitives.Signals.MapSignal(vmBind, v => ((object?)v, true)); + var __viewTagged = new global::ReactiveUI.Primitives.Signals.MapSignal(__viewSkipped, v => ((object?)v, false)); + var changed = new global::ReactiveUI.Primitives.Advanced.MergeSignal<(object?, bool)>(__vmTagged, __viewTagged); - var disposable = new global::ReactiveUI.Binding.Observables.CompositeDisposable2(d1, d2); + var disposable = new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(d1, d2); - return new global::ReactiveUI.Binding.ReactiveBinding( + return new global::ReactiveUI.Binding.ReactiveBinding( view, changed, global::ReactiveUI.Binding.BindingDirection.TwoWay, diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.CFPFallback#BindInteractionDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.CFPFallback#BindInteractionDispatch.g.verified.cs index 95cd27de..e2e6f6e5 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.CFPFallback#BindInteractionDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.CFPFallback#BindInteractionDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindInteractionDispatch.g.cs +//HintName: BindInteractionDispatch.g.cs // #pragma warning disable #nullable enable @@ -22,21 +22,21 @@ internal static partial class __ReactiveUIGeneratedBindings [global::System.Runtime.CompilerServices.CallerFilePath] string callerFilePath = "", [global::System.Runtime.CompilerServices.CallerLineNumber] int callerLineNumber = 0) { - if (callerLineNumber == 60 + if (callerLineNumber == 62 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) { - return __BindInteraction_000025C4B6C67EA9(viewModel, handler); + return __BindInteraction_000025C4B6C67EE7(viewModel, handler); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindInteraction_000025C4B6C67EA9( + private static global::System.IDisposable __BindInteraction_000025C4B6C67EE7( global::SharedScenarios.BindInteraction.TaskHandler.MyViewModel viewModel, global::System.Func, global::System.Threading.Tasks.Task> handler) { // BindInteraction: Confirm - var serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); + var serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); if (viewModel == null) { @@ -49,13 +49,13 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindInteraction.TaskHandler.MyViewModel)__o).Confirm, true); - var sub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(interactionObs, interaction => + var sub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(interactionObs, interaction => { serial.Disposable = interaction != null ? interaction.RegisterHandler(handler) - : global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + : global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(sub, serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(sub, serial); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.CFPFallback_DeepPropertyPath#BindInteractionDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.CFPFallback_DeepPropertyPath#BindInteractionDispatch.g.verified.cs index dd81e733..b562f489 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.CFPFallback_DeepPropertyPath#BindInteractionDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.CFPFallback_DeepPropertyPath#BindInteractionDispatch.g.verified.cs @@ -22,21 +22,21 @@ internal static partial class __ReactiveUIGeneratedBindings [global::System.Runtime.CompilerServices.CallerFilePath] string callerFilePath = "", [global::System.Runtime.CompilerServices.CallerLineNumber] int callerLineNumber = 0) { - if (callerLineNumber == 86 + if (callerLineNumber == 88 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) { - return __BindInteraction_7FFFEF09AD5AF2CD(viewModel, handler); + return __BindInteraction_7FFFEF09AD5AF30B(viewModel, handler); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindInteraction_7FFFEF09AD5AF2CD( + private static global::System.IDisposable __BindInteraction_7FFFEF09AD5AF30B( global::SharedScenarios.BindInteraction.DeepPropertyPath.MyViewModel viewModel, global::System.Func, global::System.Threading.Tasks.Task> handler) { // BindInteraction: Child.Confirm - var serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); + var serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); if (viewModel == null) { @@ -48,24 +48,23 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindInteraction.DeepPropertyPath.MyViewModel)__o).Child, false); - var __interactionObs_s1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__interactionObs_s0, - __p1 => __p1 != null - ? (global::System.IObservable>)new global::ReactiveUI.Binding.Observables.PropertyObservable>( - __p1, - "Confirm", - (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindInteraction.DeepPropertyPath.ChildViewModel)__o).Confirm, - false) - : (global::System.IObservable>)new global::ReactiveUI.Binding.Observables.ReturnObservable>(default(global::ReactiveUI.Binding.Interaction)))); - var interactionObs = global::ReactiveUI.Binding.Observables.RxBindingExtensions.DistinctUntilChanged(__interactionObs_s1); + var __interactionObs_s1 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal>(__interactionObs_s0, + __p1 => __p1 != null + ? (global::System.IObservable>)new global::ReactiveUI.Binding.Observables.PropertyObservable>( + (global::System.ComponentModel.INotifyPropertyChanged)__p1, + "Confirm", + (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindInteraction.DeepPropertyPath.ChildViewModel)__o).Confirm, + false) + : (global::System.IObservable>)new global::ReactiveUI.Binding.Observables.ReturnObservable>(default(global::ReactiveUI.Binding.Interaction))); + var interactionObs = global::ReactiveUI.Primitives.LinqExtensions.DistinctUntilChanged(__interactionObs_s1); - var sub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(interactionObs, interaction => + var sub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(interactionObs, interaction => { serial.Disposable = interaction != null ? interaction.RegisterHandler(handler) - : global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + : global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(sub, serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(sub, serial); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.CFPFallback_NonINPCViewModel#BindInteractionDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.CFPFallback_NonINPCViewModel#BindInteractionDispatch.g.verified.cs index ce7a6199..c79358e3 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.CFPFallback_NonINPCViewModel#BindInteractionDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.CFPFallback_NonINPCViewModel#BindInteractionDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindInteractionDispatch.g.cs +//HintName: BindInteractionDispatch.g.cs // #pragma warning disable #nullable enable @@ -22,21 +22,21 @@ internal static partial class __ReactiveUIGeneratedBindings [global::System.Runtime.CompilerServices.CallerFilePath] string callerFilePath = "", [global::System.Runtime.CompilerServices.CallerLineNumber] int callerLineNumber = 0) { - if (callerLineNumber == 44 + if (callerLineNumber == 46 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) { - return __BindInteraction_7FFFCBE90BBDA2DD(viewModel, handler); + return __BindInteraction_7FFFCBE90BBDA31B(viewModel, handler); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindInteraction_7FFFCBE90BBDA2DD( + private static global::System.IDisposable __BindInteraction_7FFFCBE90BBDA31B( global::SharedScenarios.BindInteraction.NonINPCViewModel.MyViewModel viewModel, global::System.Func, global::System.Threading.Tasks.Task> handler) { // BindInteraction: Confirm - var serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); + var serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); if (viewModel == null) { @@ -45,13 +45,13 @@ internal static partial class __ReactiveUIGeneratedBindings var interactionObs = new global::ReactiveUI.Binding.Observables.ReturnObservable>(viewModel.Confirm); - var sub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(interactionObs, interaction => + var sub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(interactionObs, interaction => { serial.Disposable = interaction != null ? interaction.RegisterHandler(handler) - : global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + : global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(sub, serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(sub, serial); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.CFPFallback_ObservableHandler#BindInteractionDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.CFPFallback_ObservableHandler#BindInteractionDispatch.g.verified.cs index 9f4fff9a..3fc9da17 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.CFPFallback_ObservableHandler#BindInteractionDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.CFPFallback_ObservableHandler#BindInteractionDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindInteractionDispatch.g.cs +//HintName: BindInteractionDispatch.g.cs // #pragma warning disable #nullable enable @@ -22,21 +22,21 @@ internal static partial class __ReactiveUIGeneratedBindings [global::System.Runtime.CompilerServices.CallerFilePath] string callerFilePath = "", [global::System.Runtime.CompilerServices.CallerLineNumber] int callerLineNumber = 0) { - if (callerLineNumber == 59 + if (callerLineNumber == 61 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) { - return __BindInteraction_7FFFDDE16443ACF6(viewModel, handler); + return __BindInteraction_7FFFDDE16443AD34(viewModel, handler); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindInteraction_7FFFDDE16443ACF6( + private static global::System.IDisposable __BindInteraction_7FFFDDE16443AD34( global::SharedScenarios.BindInteraction.ObservableHandler.MyViewModel viewModel, global::System.Func, global::System.IObservable> handler) { // BindInteraction: Confirm - var serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); + var serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); if (viewModel == null) { @@ -49,13 +49,13 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindInteraction.ObservableHandler.MyViewModel)__o).Confirm, true); - var sub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(interactionObs, interaction => + var sub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(interactionObs, interaction => { serial.Disposable = interaction != null ? interaction.RegisterHandler(handler) - : global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + : global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(sub, serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(sub, serial); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.DeepPropertyPath#BindInteractionDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.DeepPropertyPath#BindInteractionDispatch.g.verified.cs index 267b21f9..22b79759 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.DeepPropertyPath#BindInteractionDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.DeepPropertyPath#BindInteractionDispatch.g.verified.cs @@ -26,18 +26,18 @@ internal static partial class __ReactiveUIGeneratedBindings if (propertyNameExpression == "x => x.Child!.Confirm") { - return __BindInteraction_7FFFEF09AD5AF2CD(viewModel, handler); + return __BindInteraction_7FFFEF09AD5AF30B(viewModel, handler); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindInteraction_7FFFEF09AD5AF2CD( + private static global::System.IDisposable __BindInteraction_7FFFEF09AD5AF30B( global::SharedScenarios.BindInteraction.DeepPropertyPath.MyViewModel viewModel, global::System.Func, global::System.Threading.Tasks.Task> handler) { // BindInteraction: Child.Confirm - var serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); + var serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); if (viewModel == null) { @@ -49,24 +49,23 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindInteraction.DeepPropertyPath.MyViewModel)__o).Child, false); - var __interactionObs_s1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__interactionObs_s0, - __p1 => __p1 != null - ? (global::System.IObservable>)new global::ReactiveUI.Binding.Observables.PropertyObservable>( - __p1, - "Confirm", - (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindInteraction.DeepPropertyPath.ChildViewModel)__o).Confirm, - false) - : (global::System.IObservable>)new global::ReactiveUI.Binding.Observables.ReturnObservable>(default(global::ReactiveUI.Binding.Interaction)))); - var interactionObs = global::ReactiveUI.Binding.Observables.RxBindingExtensions.DistinctUntilChanged(__interactionObs_s1); + var __interactionObs_s1 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal>(__interactionObs_s0, + __p1 => __p1 != null + ? (global::System.IObservable>)new global::ReactiveUI.Binding.Observables.PropertyObservable>( + (global::System.ComponentModel.INotifyPropertyChanged)__p1, + "Confirm", + (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindInteraction.DeepPropertyPath.ChildViewModel)__o).Confirm, + false) + : (global::System.IObservable>)new global::ReactiveUI.Binding.Observables.ReturnObservable>(default(global::ReactiveUI.Binding.Interaction))); + var interactionObs = global::ReactiveUI.Primitives.LinqExtensions.DistinctUntilChanged(__interactionObs_s1); - var sub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(interactionObs, interaction => + var sub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(interactionObs, interaction => { serial.Disposable = interaction != null ? interaction.RegisterHandler(handler) - : global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + : global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(sub, serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(sub, serial); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.NonINPCViewModel#BindInteractionDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.NonINPCViewModel#BindInteractionDispatch.g.verified.cs index 1026c3ee..5793f7f0 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.NonINPCViewModel#BindInteractionDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.NonINPCViewModel#BindInteractionDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindInteractionDispatch.g.cs +//HintName: BindInteractionDispatch.g.cs // #pragma warning disable #nullable enable @@ -26,18 +26,18 @@ internal static partial class __ReactiveUIGeneratedBindings if (propertyNameExpression == "x => x.Confirm") { - return __BindInteraction_7FFFCBE90BBDA2DD(viewModel, handler); + return __BindInteraction_7FFFCBE90BBDA31B(viewModel, handler); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindInteraction_7FFFCBE90BBDA2DD( + private static global::System.IDisposable __BindInteraction_7FFFCBE90BBDA31B( global::SharedScenarios.BindInteraction.NonINPCViewModel.MyViewModel viewModel, global::System.Func, global::System.Threading.Tasks.Task> handler) { // BindInteraction: Confirm - var serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); + var serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); if (viewModel == null) { @@ -46,13 +46,13 @@ internal static partial class __ReactiveUIGeneratedBindings var interactionObs = new global::ReactiveUI.Binding.Observables.ReturnObservable>(viewModel.Confirm); - var sub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(interactionObs, interaction => + var sub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(interactionObs, interaction => { serial.Disposable = interaction != null ? interaction.RegisterHandler(handler) - : global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + : global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(sub, serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(sub, serial); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.ObservableHandler#BindInteractionDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.ObservableHandler#BindInteractionDispatch.g.verified.cs index 38912971..841b28fb 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.ObservableHandler#BindInteractionDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.ObservableHandler#BindInteractionDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindInteractionDispatch.g.cs +//HintName: BindInteractionDispatch.g.cs // #pragma warning disable #nullable enable @@ -26,18 +26,18 @@ internal static partial class __ReactiveUIGeneratedBindings if (propertyNameExpression == "x => x.Confirm") { - return __BindInteraction_7FFFDDE16443ACF6(viewModel, handler); + return __BindInteraction_7FFFDDE16443AD34(viewModel, handler); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindInteraction_7FFFDDE16443ACF6( + private static global::System.IDisposable __BindInteraction_7FFFDDE16443AD34( global::SharedScenarios.BindInteraction.ObservableHandler.MyViewModel viewModel, global::System.Func, global::System.IObservable> handler) { // BindInteraction: Confirm - var serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); + var serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); if (viewModel == null) { @@ -50,13 +50,13 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindInteraction.ObservableHandler.MyViewModel)__o).Confirm, true); - var sub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(interactionObs, interaction => + var sub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(interactionObs, interaction => { serial.Disposable = interaction != null ? interaction.RegisterHandler(handler) - : global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + : global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(sub, serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(sub, serial); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.TaskHandler#BindInteractionDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.TaskHandler#BindInteractionDispatch.g.verified.cs index 9bfa5bd6..ecdb800b 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.TaskHandler#BindInteractionDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BIG.TaskHandler#BindInteractionDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindInteractionDispatch.g.cs +//HintName: BindInteractionDispatch.g.cs // #pragma warning disable #nullable enable @@ -26,18 +26,18 @@ internal static partial class __ReactiveUIGeneratedBindings if (propertyNameExpression == "x => x.Confirm") { - return __BindInteraction_000025C4B6C67EA9(viewModel, handler); + return __BindInteraction_000025C4B6C67EE7(viewModel, handler); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindInteraction_000025C4B6C67EA9( + private static global::System.IDisposable __BindInteraction_000025C4B6C67EE7( global::SharedScenarios.BindInteraction.TaskHandler.MyViewModel viewModel, global::System.Func, global::System.Threading.Tasks.Task> handler) { // BindInteraction: Confirm - var serial = new global::ReactiveUI.Binding.Observables.SerialDisposable(); + var serial = new global::ReactiveUI.Primitives.Disposables.SwapDisposable(); if (viewModel == null) { @@ -50,13 +50,13 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindInteraction.TaskHandler.MyViewModel)__o).Confirm, true); - var sub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(interactionObs, interaction => + var sub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(interactionObs, interaction => { serial.Disposable = interaction != null ? interaction.RegisterHandler(handler) - : global::ReactiveUI.Binding.Observables.EmptyDisposable.Instance; + : global::ReactiveUI.Primitives.Disposables.EmptyDisposable.Instance; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(sub, serial); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(sub, serial); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.KVO_NSObject_Source#BindOneWayDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.KVO_NSObject_Source#BindOneWayDispatch.g.verified.cs index e1f57c68..7c570a6c 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.KVO_NSObject_Source#BindOneWayDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.KVO_NSObject_Source#BindOneWayDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindOneWayDispatch.g.cs +//HintName: BindOneWayDispatch.g.cs // #pragma warning disable #nullable enable @@ -45,7 +45,7 @@ internal static partial class __ReactiveUIGeneratedBindings true, false); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + return global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { target.Name = value; }); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.MB#BindOneWayDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.MB#BindOneWayDispatch.g.verified.cs index a362c3f4..1c61f321 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.MB#BindOneWayDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.MB#BindOneWayDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindOneWayDispatch.g.cs +//HintName: BindOneWayDispatch.g.cs // #pragma warning disable #nullable enable @@ -44,7 +44,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindOneWay.MultipleBindings.MyViewModel)__o).Name, true); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + return global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { target.NameText = value; }); @@ -85,7 +85,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindOneWay.MultipleBindings.MyViewModel)__o).Age, true); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + return global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { target.AgeDisplay = value; }); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.MSTB#BindOneWayDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.MSTB#BindOneWayDispatch.g.verified.cs index 9c0e6a0c..e27d727f 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.MSTB#BindOneWayDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.MSTB#BindOneWayDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindOneWayDispatch.g.cs +//HintName: BindOneWayDispatch.g.cs // #pragma warning disable #nullable enable @@ -49,7 +49,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindOneWay.MultipleSameTypeBindings.MyViewModel)__o).FirstName, true); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + return global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { target.FirstNameText = value; }); @@ -64,7 +64,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindOneWay.MultipleSameTypeBindings.MyViewModel)__o).LastName, true); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + return global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { target.LastNameText = value; }); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.MSTB_CFP#BindOneWayDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.MSTB_CFP#BindOneWayDispatch.g.verified.cs index 0a43a7f6..47fab307 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.MSTB_CFP#BindOneWayDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.MSTB_CFP#BindOneWayDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindOneWayDispatch.g.cs +//HintName: BindOneWayDispatch.g.cs // #pragma warning disable #nullable enable @@ -46,7 +46,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindOneWay.MultipleSameTypeBindings.MyViewModel)__o).FirstName, true); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + return global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { target.FirstNameText = value; }); @@ -61,7 +61,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindOneWay.MultipleSameTypeBindings.MyViewModel)__o).LastName, true); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + return global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { target.LastNameText = value; }); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.ReactiveObject_Source#BindOneWayDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.ReactiveObject_Source#BindOneWayDispatch.g.verified.cs index 0f2b0f1c..6b769231 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.ReactiveObject_Source#BindOneWayDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.ReactiveObject_Source#BindOneWayDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindOneWayDispatch.g.cs +//HintName: BindOneWayDispatch.g.cs // #pragma warning disable #nullable enable @@ -29,13 +29,13 @@ internal static partial class __ReactiveUIGeneratedBindings if (sourcePropertyExpression == "x => x.Name" && targetPropertyExpression == "x => x.NameText") { - return __BindOneWay_7FFFEB54CB43751E(source, target); + return __BindOneWay_7FFFEB54CB43755C(source, target); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindOneWay_7FFFEB54CB43751E(global::SharedScenarios.BindOneWay.ReactiveObjectSource.MyViewModel source, global::SharedScenarios.BindOneWay.ReactiveObjectSource.MyView target) + private static global::System.IDisposable __BindOneWay_7FFFEB54CB43755C(global::SharedScenarios.BindOneWay.ReactiveObjectSource.MyViewModel source, global::SharedScenarios.BindOneWay.ReactiveObjectSource.MyView target) { // BindOneWay: Name -> NameText var sourceObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -44,7 +44,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindOneWay.ReactiveObjectSource.MyViewModel)__o).Name, true); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + return global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { target.NameText = value; }); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.SP_I2I#BindOneWayDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.SP_I2I#BindOneWayDispatch.g.verified.cs index 5c3b8dc1..1e130411 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.SP_I2I#BindOneWayDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.SP_I2I#BindOneWayDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindOneWayDispatch.g.cs +//HintName: BindOneWayDispatch.g.cs // #pragma warning disable #nullable enable @@ -29,13 +29,13 @@ internal static partial class __ReactiveUIGeneratedBindings if (sourcePropertyExpression == "x => x.Count" && targetPropertyExpression == "x => x.DisplayCount") { - return __BindOneWay_7FFFCFD371F7E2C3(source, target); + return __BindOneWay_7FFFCFD371F7E301(source, target); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindOneWay_7FFFCFD371F7E2C3(global::SharedScenarios.BindOneWay.SinglePropertyIntToInt.MyViewModel source, global::SharedScenarios.BindOneWay.SinglePropertyIntToInt.MyView target) + private static global::System.IDisposable __BindOneWay_7FFFCFD371F7E301(global::SharedScenarios.BindOneWay.SinglePropertyIntToInt.MyViewModel source, global::SharedScenarios.BindOneWay.SinglePropertyIntToInt.MyView target) { // BindOneWay: Count -> DisplayCount var sourceObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -44,7 +44,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindOneWay.SinglePropertyIntToInt.MyViewModel)__o).Count, true); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + return global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { target.DisplayCount = value; }); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.SP_S2S#BindOneWayDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.SP_S2S#BindOneWayDispatch.g.verified.cs index 38eb71ef..82e44bd3 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.SP_S2S#BindOneWayDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.SP_S2S#BindOneWayDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindOneWayDispatch.g.cs +//HintName: BindOneWayDispatch.g.cs // #pragma warning disable #nullable enable @@ -29,13 +29,13 @@ internal static partial class __ReactiveUIGeneratedBindings if (sourcePropertyExpression == "x => x.Name" && targetPropertyExpression == "x => x.NameText") { - return __BindOneWay_7FFFD267615F26AE(source, target); + return __BindOneWay_7FFFD267615F26EC(source, target); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindOneWay_7FFFD267615F26AE(global::SharedScenarios.BindOneWay.SinglePropertyStringToString.MyViewModel source, global::SharedScenarios.BindOneWay.SinglePropertyStringToString.MyView target) + private static global::System.IDisposable __BindOneWay_7FFFD267615F26EC(global::SharedScenarios.BindOneWay.SinglePropertyStringToString.MyViewModel source, global::SharedScenarios.BindOneWay.SinglePropertyStringToString.MyView target) { // BindOneWay: Name -> NameText var sourceObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -44,7 +44,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindOneWay.SinglePropertyStringToString.MyViewModel)__o).Name, true); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + return global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { target.NameText = value; }); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.SP_S2S_CFP#BindOneWayDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.SP_S2S_CFP#BindOneWayDispatch.g.verified.cs index bb7382f4..ca9e073b 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.SP_S2S_CFP#BindOneWayDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.SP_S2S_CFP#BindOneWayDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindOneWayDispatch.g.cs +//HintName: BindOneWayDispatch.g.cs // #pragma warning disable #nullable enable @@ -23,16 +23,16 @@ internal static partial class __ReactiveUIGeneratedBindings [global::System.Runtime.CompilerServices.CallerFilePath] string callerFilePath = "", [global::System.Runtime.CompilerServices.CallerLineNumber] int callerLineNumber = 0) { - if (callerLineNumber == 72 + if (callerLineNumber == 74 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) { - return __BindOneWay_7FFFD267615F26AE(source, target); + return __BindOneWay_7FFFD267615F26EC(source, target); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindOneWay_7FFFD267615F26AE(global::SharedScenarios.BindOneWay.SinglePropertyStringToString.MyViewModel source, global::SharedScenarios.BindOneWay.SinglePropertyStringToString.MyView target) + private static global::System.IDisposable __BindOneWay_7FFFD267615F26EC(global::SharedScenarios.BindOneWay.SinglePropertyStringToString.MyViewModel source, global::SharedScenarios.BindOneWay.SinglePropertyStringToString.MyView target) { // BindOneWay: Name -> NameText var sourceObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -41,7 +41,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindOneWay.SinglePropertyStringToString.MyViewModel)__o).Name, true); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + return global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { target.NameText = value; }); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.SP_WC#BindOneWayDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.SP_WC#BindOneWayDispatch.g.verified.cs index 112edc52..814a5bb9 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.SP_WC#BindOneWayDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.SP_WC#BindOneWayDispatch.g.verified.cs @@ -30,13 +30,13 @@ internal static partial class __ReactiveUIGeneratedBindings if (sourcePropertyExpression == "x => x.Count" && targetPropertyExpression == "x => x.CountText") { - return __BindOneWay_7FFFE88AB8C050DB(source, target, conversionFunc); + return __BindOneWay_7FFFE88AB8C05119(source, target, conversionFunc); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindOneWay_7FFFE88AB8C050DB(global::SharedScenarios.BindOneWay.SinglePropertyWithConverter.MyViewModel source, global::SharedScenarios.BindOneWay.SinglePropertyWithConverter.MyView target, global::System.Func conversionFunc) + private static global::System.IDisposable __BindOneWay_7FFFE88AB8C05119(global::SharedScenarios.BindOneWay.SinglePropertyWithConverter.MyViewModel source, global::SharedScenarios.BindOneWay.SinglePropertyWithConverter.MyView target, global::System.Func conversionFunc) { // BindOneWay: Count -> CountText (with conversion) var sourceObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -44,9 +44,9 @@ internal static partial class __ReactiveUIGeneratedBindings "Count", (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindOneWay.SinglePropertyWithConverter.MyViewModel)__o).Count, true); - var bindObs = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(sourceObs, conversionFunc); + var bindObs = new global::ReactiveUI.Primitives.Signals.MapSignal(sourceObs, conversionFunc); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(bindObs, value => + return global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(bindObs, value => { target.CountText = value; }); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.SP_WCSched#BindOneWayDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.SP_WCSched#BindOneWayDispatch.g.verified.cs index 84a697f7..76a899c0 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.SP_WCSched#BindOneWayDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.SP_WCSched#BindOneWayDispatch.g.verified.cs @@ -31,13 +31,13 @@ internal static partial class __ReactiveUIGeneratedBindings if (sourcePropertyExpression == "x => x.Count" && targetPropertyExpression == "x => x.CountText") { - return __BindOneWay_7FFFED3E0F13A543(source, target, conversionFunc, scheduler); + return __BindOneWay_7FFFED3E0F13A581(source, target, conversionFunc, scheduler); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindOneWay_7FFFED3E0F13A543(global::SharedScenarios.BindOneWay.SinglePropertyWithConverterAndScheduler.MyViewModel source, global::SharedScenarios.BindOneWay.SinglePropertyWithConverterAndScheduler.MyView target, global::System.Func conversionFunc, global::ReactiveUI.Primitives.Concurrency.ISequencer scheduler) + private static global::System.IDisposable __BindOneWay_7FFFED3E0F13A581(global::SharedScenarios.BindOneWay.SinglePropertyWithConverterAndScheduler.MyViewModel source, global::SharedScenarios.BindOneWay.SinglePropertyWithConverterAndScheduler.MyView target, global::System.Func conversionFunc, global::ReactiveUI.Primitives.Concurrency.ISequencer scheduler) { // BindOneWay: Count -> CountText (with conversion) (with scheduler) var sourceObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -45,10 +45,10 @@ internal static partial class __ReactiveUIGeneratedBindings "Count", (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindOneWay.SinglePropertyWithConverterAndScheduler.MyViewModel)__o).Count, true); - var __selected = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(sourceObs, conversionFunc); + var __selected = new global::ReactiveUI.Primitives.Signals.MapSignal(sourceObs, conversionFunc); var bindObs = new global::ReactiveUI.Binding.Observables.ObserveOnObservable(__selected, scheduler); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(bindObs, value => + return global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(bindObs, value => { target.CountText = value; }); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.SP_WithScheduler#BindOneWayDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.SP_WithScheduler#BindOneWayDispatch.g.verified.cs index a144c863..a5d5b3f3 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.SP_WithScheduler#BindOneWayDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BOG.SP_WithScheduler#BindOneWayDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindOneWayDispatch.g.cs +//HintName: BindOneWayDispatch.g.cs // #pragma warning disable #nullable enable @@ -30,13 +30,13 @@ internal static partial class __ReactiveUIGeneratedBindings if (sourcePropertyExpression == "x => x.Name" && targetPropertyExpression == "x => x.NameText") { - return __BindOneWay_000023CFCD42C47A(source, target, scheduler); + return __BindOneWay_000023CFCD42C4B8(source, target, scheduler); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindOneWay_000023CFCD42C47A(global::SharedScenarios.BindOneWay.SinglePropertyWithScheduler.MyViewModel source, global::SharedScenarios.BindOneWay.SinglePropertyWithScheduler.MyView target, global::ReactiveUI.Primitives.Concurrency.ISequencer scheduler) + private static global::System.IDisposable __BindOneWay_000023CFCD42C4B8(global::SharedScenarios.BindOneWay.SinglePropertyWithScheduler.MyViewModel source, global::SharedScenarios.BindOneWay.SinglePropertyWithScheduler.MyView target, global::ReactiveUI.Primitives.Concurrency.ISequencer scheduler) { // BindOneWay: Name -> NameText (with scheduler) var sourceObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -46,7 +46,7 @@ internal static partial class __ReactiveUIGeneratedBindings true); var bindObs = new global::ReactiveUI.Binding.Observables.ObserveOnObservable(sourceObs, scheduler); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(bindObs, value => + return global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(bindObs, value => { target.NameText = value; }); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.KVO_NSObject_Target#BindTwoWayDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.KVO_NSObject_Target#BindTwoWayDispatch.g.verified.cs index 12e4393a..ca006029 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.KVO_NSObject_Target#BindTwoWayDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.KVO_NSObject_Target#BindTwoWayDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindTwoWayDispatch.g.cs +//HintName: BindTwoWayDispatch.g.cs // #pragma warning disable #nullable enable @@ -50,18 +50,18 @@ internal static partial class __ReactiveUIGeneratedBindings true, false); - var d1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + var d1 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { target.Text = value; }); - var __targetSkipped = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Skip(targetObs, 1); - var d2 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(__targetSkipped, value => + var __targetSkipped = global::ReactiveUI.Primitives.LinqExtensions.Skip(targetObs, 1); + var d2 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(__targetSkipped, value => { source.Name = value; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(d1, d2); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(d1, d2); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.MB#BindTwoWayDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.MB#BindTwoWayDispatch.g.verified.cs index 25f97975..bccafbe1 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.MB#BindTwoWayDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.MB#BindTwoWayDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindTwoWayDispatch.g.cs +//HintName: BindTwoWayDispatch.g.cs // #pragma warning disable #nullable enable @@ -49,18 +49,18 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindTwoWay.MultipleBindings.MyView)__o).NameText, true); - var d1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + var d1 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { target.NameText = value; }); - var __targetSkipped = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Skip(targetObs, 1); - var d2 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(__targetSkipped, value => + var __targetSkipped = global::ReactiveUI.Primitives.LinqExtensions.Skip(targetObs, 1); + var d2 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(__targetSkipped, value => { source.Name = value; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(d1, d2); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(d1, d2); } /// @@ -103,18 +103,18 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindTwoWay.MultipleBindings.MyView)__o).AgeDisplay, true); - var d1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + var d1 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { target.AgeDisplay = value; }); - var __targetSkipped = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Skip(targetObs, 1); - var d2 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(__targetSkipped, value => + var __targetSkipped = global::ReactiveUI.Primitives.LinqExtensions.Skip(targetObs, 1); + var d2 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(__targetSkipped, value => { source.Age = value; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(d1, d2); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(d1, d2); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.MSTB#BindTwoWayDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.MSTB#BindTwoWayDispatch.g.verified.cs index 56812f8b..0b47b3c0 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.MSTB#BindTwoWayDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.MSTB#BindTwoWayDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindTwoWayDispatch.g.cs +//HintName: BindTwoWayDispatch.g.cs // #pragma warning disable #nullable enable @@ -54,18 +54,18 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindTwoWay.MultipleSameTypeBindings.MyView)__o).FirstNameText, true); - var d1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + var d1 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { target.FirstNameText = value; }); - var __targetSkipped = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Skip(targetObs, 1); - var d2 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(__targetSkipped, value => + var __targetSkipped = global::ReactiveUI.Primitives.LinqExtensions.Skip(targetObs, 1); + var d2 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(__targetSkipped, value => { source.FirstName = value; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(d1, d2); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(d1, d2); } private static global::System.IDisposable __BindTwoWay_7FFFD5F5F103D3E1(global::SharedScenarios.BindTwoWay.MultipleSameTypeBindings.MyViewModel source, global::SharedScenarios.BindTwoWay.MultipleSameTypeBindings.MyView target) @@ -82,18 +82,18 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindTwoWay.MultipleSameTypeBindings.MyView)__o).LastNameText, true); - var d1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + var d1 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { target.LastNameText = value; }); - var __targetSkipped = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Skip(targetObs, 1); - var d2 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(__targetSkipped, value => + var __targetSkipped = global::ReactiveUI.Primitives.LinqExtensions.Skip(targetObs, 1); + var d2 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(__targetSkipped, value => { source.LastName = value; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(d1, d2); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(d1, d2); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.MSTB_CFP#BindTwoWayDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.MSTB_CFP#BindTwoWayDispatch.g.verified.cs index 1ef6994b..b5a326b4 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.MSTB_CFP#BindTwoWayDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.MSTB_CFP#BindTwoWayDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindTwoWayDispatch.g.cs +//HintName: BindTwoWayDispatch.g.cs // #pragma warning disable #nullable enable @@ -51,18 +51,18 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindTwoWay.MultipleSameTypeBindings.MyView)__o).FirstNameText, true); - var d1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + var d1 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { target.FirstNameText = value; }); - var __targetSkipped = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Skip(targetObs, 1); - var d2 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(__targetSkipped, value => + var __targetSkipped = global::ReactiveUI.Primitives.LinqExtensions.Skip(targetObs, 1); + var d2 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(__targetSkipped, value => { source.FirstName = value; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(d1, d2); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(d1, d2); } private static global::System.IDisposable __BindTwoWay_7FFFD5F5F103D3E1(global::SharedScenarios.BindTwoWay.MultipleSameTypeBindings.MyViewModel source, global::SharedScenarios.BindTwoWay.MultipleSameTypeBindings.MyView target) @@ -79,18 +79,18 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindTwoWay.MultipleSameTypeBindings.MyView)__o).LastNameText, true); - var d1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + var d1 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { target.LastNameText = value; }); - var __targetSkipped = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Skip(targetObs, 1); - var d2 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(__targetSkipped, value => + var __targetSkipped = global::ReactiveUI.Primitives.LinqExtensions.Skip(targetObs, 1); + var d2 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(__targetSkipped, value => { source.LastName = value; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(d1, d2); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(d1, d2); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.MixedWithBindOneWay#BindOneWayDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.MixedWithBindOneWay#BindOneWayDispatch.g.verified.cs index b649684a..6dbec48a 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.MixedWithBindOneWay#BindOneWayDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.MixedWithBindOneWay#BindOneWayDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindOneWayDispatch.g.cs +//HintName: BindOneWayDispatch.g.cs // #pragma warning disable #nullable enable @@ -44,7 +44,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindTwoWay.MixedWithBindOneWay.MyViewModel)__o).ReadOnlyCount, true); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + return global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { target.CountDisplay = value; }); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.MixedWithBindOneWay#BindTwoWayDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.MixedWithBindOneWay#BindTwoWayDispatch.g.verified.cs index 0a2fc13c..0928c491 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.MixedWithBindOneWay#BindTwoWayDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.MixedWithBindOneWay#BindTwoWayDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindTwoWayDispatch.g.cs +//HintName: BindTwoWayDispatch.g.cs // #pragma warning disable #nullable enable @@ -49,18 +49,18 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindTwoWay.MixedWithBindOneWay.MyView)__o).NameText, true); - var d1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + var d1 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { target.NameText = value; }); - var __targetSkipped = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Skip(targetObs, 1); - var d2 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(__targetSkipped, value => + var __targetSkipped = global::ReactiveUI.Primitives.LinqExtensions.Skip(targetObs, 1); + var d2 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(__targetSkipped, value => { source.Name = value; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(d1, d2); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(d1, d2); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.ReactiveObject_Both#BindTwoWayDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.ReactiveObject_Both#BindTwoWayDispatch.g.verified.cs index 94602885..39dc1edc 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.ReactiveObject_Both#BindTwoWayDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.ReactiveObject_Both#BindTwoWayDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindTwoWayDispatch.g.cs +//HintName: BindTwoWayDispatch.g.cs // #pragma warning disable #nullable enable @@ -29,13 +29,13 @@ internal static partial class __ReactiveUIGeneratedBindings if (sourcePropertyExpression == "x => x.Name" && targetPropertyExpression == "x => x.NameText") { - return __BindTwoWay_000022F0C1901D5C(source, target); + return __BindTwoWay_000022F0C1901D9A(source, target); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindTwoWay_000022F0C1901D5C(global::SharedScenarios.BindTwoWay.ReactiveObjectBoth.MyViewModel source, global::SharedScenarios.BindTwoWay.ReactiveObjectBoth.MyView target) + private static global::System.IDisposable __BindTwoWay_000022F0C1901D9A(global::SharedScenarios.BindTwoWay.ReactiveObjectBoth.MyViewModel source, global::SharedScenarios.BindTwoWay.ReactiveObjectBoth.MyView target) { // BindTwoWay: Name <-> NameText var sourceObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -49,18 +49,18 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindTwoWay.ReactiveObjectBoth.MyView)__o).NameText, true); - var d1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + var d1 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { target.NameText = value; }); - var __targetSkipped = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Skip(targetObs, 1); - var d2 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(__targetSkipped, value => + var __targetSkipped = global::ReactiveUI.Primitives.LinqExtensions.Skip(targetObs, 1); + var d2 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(__targetSkipped, value => { source.Name = value; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(d1, d2); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(d1, d2); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.SP_I2I#BindTwoWayDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.SP_I2I#BindTwoWayDispatch.g.verified.cs index 6cc9fa82..52f20303 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.SP_I2I#BindTwoWayDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.SP_I2I#BindTwoWayDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindTwoWayDispatch.g.cs +//HintName: BindTwoWayDispatch.g.cs // #pragma warning disable #nullable enable @@ -29,13 +29,13 @@ internal static partial class __ReactiveUIGeneratedBindings if (sourcePropertyExpression == "x => x.Count" && targetPropertyExpression == "x => x.DisplayCount") { - return __BindTwoWay_000002183E718F05(source, target); + return __BindTwoWay_000002183E718F43(source, target); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindTwoWay_000002183E718F05(global::SharedScenarios.BindTwoWay.SinglePropertyIntToInt.MyViewModel source, global::SharedScenarios.BindTwoWay.SinglePropertyIntToInt.MyView target) + private static global::System.IDisposable __BindTwoWay_000002183E718F43(global::SharedScenarios.BindTwoWay.SinglePropertyIntToInt.MyViewModel source, global::SharedScenarios.BindTwoWay.SinglePropertyIntToInt.MyView target) { // BindTwoWay: Count <-> DisplayCount var sourceObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -49,18 +49,18 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindTwoWay.SinglePropertyIntToInt.MyView)__o).DisplayCount, true); - var d1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + var d1 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { target.DisplayCount = value; }); - var __targetSkipped = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Skip(targetObs, 1); - var d2 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(__targetSkipped, value => + var __targetSkipped = global::ReactiveUI.Primitives.LinqExtensions.Skip(targetObs, 1); + var d2 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(__targetSkipped, value => { source.Count = value; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(d1, d2); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(d1, d2); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.SP_S2S#BindTwoWayDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.SP_S2S#BindTwoWayDispatch.g.verified.cs index cb8bc63a..8bad2b18 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.SP_S2S#BindTwoWayDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.SP_S2S#BindTwoWayDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindTwoWayDispatch.g.cs +//HintName: BindTwoWayDispatch.g.cs // #pragma warning disable #nullable enable @@ -29,13 +29,13 @@ internal static partial class __ReactiveUIGeneratedBindings if (sourcePropertyExpression == "x => x.Name" && targetPropertyExpression == "x => x.NameText") { - return __BindTwoWay_7FFFEF88F2A77910(source, target); + return __BindTwoWay_7FFFEF88F2A7794E(source, target); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindTwoWay_7FFFEF88F2A77910(global::SharedScenarios.BindTwoWay.SinglePropertyStringToString.MyViewModel source, global::SharedScenarios.BindTwoWay.SinglePropertyStringToString.MyView target) + private static global::System.IDisposable __BindTwoWay_7FFFEF88F2A7794E(global::SharedScenarios.BindTwoWay.SinglePropertyStringToString.MyViewModel source, global::SharedScenarios.BindTwoWay.SinglePropertyStringToString.MyView target) { // BindTwoWay: Name <-> NameText var sourceObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -49,18 +49,18 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindTwoWay.SinglePropertyStringToString.MyView)__o).NameText, true); - var d1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + var d1 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { target.NameText = value; }); - var __targetSkipped = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Skip(targetObs, 1); - var d2 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(__targetSkipped, value => + var __targetSkipped = global::ReactiveUI.Primitives.LinqExtensions.Skip(targetObs, 1); + var d2 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(__targetSkipped, value => { source.Name = value; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(d1, d2); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(d1, d2); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.SP_S2S_CFP#BindTwoWayDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.SP_S2S_CFP#BindTwoWayDispatch.g.verified.cs index ead8edc9..75c5d3fb 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.SP_S2S_CFP#BindTwoWayDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.SP_S2S_CFP#BindTwoWayDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindTwoWayDispatch.g.cs +//HintName: BindTwoWayDispatch.g.cs // #pragma warning disable #nullable enable @@ -23,16 +23,16 @@ internal static partial class __ReactiveUIGeneratedBindings [global::System.Runtime.CompilerServices.CallerFilePath] string callerFilePath = "", [global::System.Runtime.CompilerServices.CallerLineNumber] int callerLineNumber = 0) { - if (callerLineNumber == 72 + if (callerLineNumber == 74 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) { - return __BindTwoWay_7FFFEF88F2A77910(source, target); + return __BindTwoWay_7FFFEF88F2A7794E(source, target); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindTwoWay_7FFFEF88F2A77910(global::SharedScenarios.BindTwoWay.SinglePropertyStringToString.MyViewModel source, global::SharedScenarios.BindTwoWay.SinglePropertyStringToString.MyView target) + private static global::System.IDisposable __BindTwoWay_7FFFEF88F2A7794E(global::SharedScenarios.BindTwoWay.SinglePropertyStringToString.MyViewModel source, global::SharedScenarios.BindTwoWay.SinglePropertyStringToString.MyView target) { // BindTwoWay: Name <-> NameText var sourceObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -46,18 +46,18 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindTwoWay.SinglePropertyStringToString.MyView)__o).NameText, true); - var d1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + var d1 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { target.NameText = value; }); - var __targetSkipped = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Skip(targetObs, 1); - var d2 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(__targetSkipped, value => + var __targetSkipped = global::ReactiveUI.Primitives.LinqExtensions.Skip(targetObs, 1); + var d2 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(__targetSkipped, value => { source.Name = value; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(d1, d2); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(d1, d2); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.SP_WC#BindTwoWayDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.SP_WC#BindTwoWayDispatch.g.verified.cs index 026d051e..415adad2 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.SP_WC#BindTwoWayDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.SP_WC#BindTwoWayDispatch.g.verified.cs @@ -31,13 +31,13 @@ internal static partial class __ReactiveUIGeneratedBindings if (sourcePropertyExpression == "x => x.Count" && targetPropertyExpression == "x => x.CountText") { - return __BindTwoWay_000013957A2E9404(source, target, sourceToTargetConv, targetToSourceConv); + return __BindTwoWay_000013957A2E9442(source, target, sourceToTargetConv, targetToSourceConv); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindTwoWay_000013957A2E9404(global::SharedScenarios.BindTwoWay.SinglePropertyWithConverters.MyViewModel source, global::SharedScenarios.BindTwoWay.SinglePropertyWithConverters.MyView target, global::System.Func sourceToTargetConv, global::System.Func targetToSourceConv) + private static global::System.IDisposable __BindTwoWay_000013957A2E9442(global::SharedScenarios.BindTwoWay.SinglePropertyWithConverters.MyViewModel source, global::SharedScenarios.BindTwoWay.SinglePropertyWithConverters.MyView target, global::System.Func sourceToTargetConv, global::System.Func targetToSourceConv) { // BindTwoWay: Count <-> CountText (with conversion) var sourceObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -50,21 +50,21 @@ internal static partial class __ReactiveUIGeneratedBindings "CountText", (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindTwoWay.SinglePropertyWithConverters.MyView)__o).CountText, true); - var sourceBind = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(sourceObs, sourceToTargetConv); - var targetBind = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(targetObs, targetToSourceConv); + var sourceBind = new global::ReactiveUI.Primitives.Signals.MapSignal(sourceObs, sourceToTargetConv); + var targetBind = new global::ReactiveUI.Primitives.Signals.MapSignal(targetObs, targetToSourceConv); - var d1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceBind, value => + var d1 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceBind, value => { target.CountText = value; }); - var __targetSkipped = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Skip(targetBind, 1); - var d2 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(__targetSkipped, value => + var __targetSkipped = global::ReactiveUI.Primitives.LinqExtensions.Skip(targetBind, 1); + var d2 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(__targetSkipped, value => { source.Count = value; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(d1, d2); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(d1, d2); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.SP_WCSched#BindTwoWayDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.SP_WCSched#BindTwoWayDispatch.g.verified.cs index 612fe71f..b24acdd4 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.SP_WCSched#BindTwoWayDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.SP_WCSched#BindTwoWayDispatch.g.verified.cs @@ -32,13 +32,13 @@ internal static partial class __ReactiveUIGeneratedBindings if (sourcePropertyExpression == "x => x.Count" && targetPropertyExpression == "x => x.CountText") { - return __BindTwoWay_00000972B7EA330C(source, target, sourceToTargetConv, targetToSourceConv, scheduler); + return __BindTwoWay_00000972B7EA334A(source, target, sourceToTargetConv, targetToSourceConv, scheduler); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindTwoWay_00000972B7EA330C(global::SharedScenarios.BindTwoWay.SinglePropertyWithConvertersAndScheduler.MyViewModel source, global::SharedScenarios.BindTwoWay.SinglePropertyWithConvertersAndScheduler.MyView target, global::System.Func sourceToTargetConv, global::System.Func targetToSourceConv, global::ReactiveUI.Primitives.Concurrency.ISequencer scheduler) + private static global::System.IDisposable __BindTwoWay_00000972B7EA334A(global::SharedScenarios.BindTwoWay.SinglePropertyWithConvertersAndScheduler.MyViewModel source, global::SharedScenarios.BindTwoWay.SinglePropertyWithConvertersAndScheduler.MyView target, global::System.Func sourceToTargetConv, global::System.Func targetToSourceConv, global::ReactiveUI.Primitives.Concurrency.ISequencer scheduler) { // BindTwoWay: Count <-> CountText (with conversion) (with scheduler) var sourceObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -51,23 +51,23 @@ internal static partial class __ReactiveUIGeneratedBindings "CountText", (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.BindTwoWay.SinglePropertyWithConvertersAndScheduler.MyView)__o).CountText, true); - var __srcSelected = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(sourceObs, sourceToTargetConv); - var __tgtSelected = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(targetObs, targetToSourceConv); + var __srcSelected = new global::ReactiveUI.Primitives.Signals.MapSignal(sourceObs, sourceToTargetConv); + var __tgtSelected = new global::ReactiveUI.Primitives.Signals.MapSignal(targetObs, targetToSourceConv); var sourceBind = new global::ReactiveUI.Binding.Observables.ObserveOnObservable(__srcSelected, scheduler); var targetBind = new global::ReactiveUI.Binding.Observables.ObserveOnObservable(__tgtSelected, scheduler); - var d1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceBind, value => + var d1 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceBind, value => { target.CountText = value; }); - var __targetSkipped = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Skip(targetBind, 1); - var d2 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(__targetSkipped, value => + var __targetSkipped = global::ReactiveUI.Primitives.LinqExtensions.Skip(targetBind, 1); + var d2 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(__targetSkipped, value => { source.Count = value; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(d1, d2); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(d1, d2); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.SP_WithScheduler#BindTwoWayDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.SP_WithScheduler#BindTwoWayDispatch.g.verified.cs index 246fd316..b6a0d54a 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.SP_WithScheduler#BindTwoWayDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BTG.SP_WithScheduler#BindTwoWayDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindTwoWayDispatch.g.cs +//HintName: BindTwoWayDispatch.g.cs // #pragma warning disable #nullable enable @@ -30,13 +30,13 @@ internal static partial class __ReactiveUIGeneratedBindings if (sourcePropertyExpression == "x => x.Name" && targetPropertyExpression == "x => x.NameText") { - return __BindTwoWay_7FFFF863C3AFACCC(source, target, scheduler); + return __BindTwoWay_7FFFF863C3AFAD0A(source, target, scheduler); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindTwoWay_7FFFF863C3AFACCC(global::SharedScenarios.BindTwoWay.SinglePropertyWithScheduler.MyViewModel source, global::SharedScenarios.BindTwoWay.SinglePropertyWithScheduler.MyView target, global::ReactiveUI.Primitives.Concurrency.ISequencer scheduler) + private static global::System.IDisposable __BindTwoWay_7FFFF863C3AFAD0A(global::SharedScenarios.BindTwoWay.SinglePropertyWithScheduler.MyViewModel source, global::SharedScenarios.BindTwoWay.SinglePropertyWithScheduler.MyView target, global::ReactiveUI.Primitives.Concurrency.ISequencer scheduler) { // BindTwoWay: Name <-> NameText (with scheduler) var sourceObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -52,18 +52,18 @@ internal static partial class __ReactiveUIGeneratedBindings var sourceBind = new global::ReactiveUI.Binding.Observables.ObserveOnObservable(sourceObs, scheduler); var targetBind = new global::ReactiveUI.Binding.Observables.ObserveOnObservable(targetObs, scheduler); - var d1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceBind, value => + var d1 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceBind, value => { target.NameText = value; }); - var __targetSkipped = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Skip(targetBind, 1); - var d2 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(__targetSkipped, value => + var __targetSkipped = global::ReactiveUI.Primitives.LinqExtensions.Skip(targetBind, 1); + var d2 = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(__targetSkipped, value => { source.Name = value; }); - return new global::ReactiveUI.Binding.Observables.CompositeDisposable2(d1, d2); + return new global::ReactiveUI.Primitives.Disposables.MultipleDisposable(d1, d2); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BToG.DifferingTypes#BindToDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BToG.DifferingTypes#BindToDispatch.g.verified.cs index e639f795..6cae5bf0 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BToG.DifferingTypes#BindToDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BToG.DifferingTypes#BindToDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindToDispatch.g.cs +//HintName: BindToDispatch.g.cs // #pragma warning disable #nullable enable @@ -25,16 +25,16 @@ internal static partial class __ReactiveUIGeneratedBindings if (propertyExpression == "x => x.Caption") { - return __BindTo_7FFFF0EE063CE2EC(source, target); + return __BindTo_7FFFF0EE063CE32A(source, target); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindTo_7FFFF0EE063CE2EC(global::System.IObservable source, global::SharedScenarios.BindTo.DifferingTypes.MyView target) + private static global::System.IDisposable __BindTo_7FFFF0EE063CE32A(global::System.IObservable source, global::SharedScenarios.BindTo.DifferingTypes.MyView target) { // BindTo: observable -> Caption - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(source, value => + return global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(source, value => { if (global::ReactiveUI.Binding.Fallback.RuntimeBindingConverter.TryConvert(value, null, null, out var __converted)) { diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BToG.SameTypeString#BindToDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BToG.SameTypeString#BindToDispatch.g.verified.cs index 59ddd2da..b0ed5e3d 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BToG.SameTypeString#BindToDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BToG.SameTypeString#BindToDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindToDispatch.g.cs +//HintName: BindToDispatch.g.cs // #pragma warning disable #nullable enable @@ -25,16 +25,16 @@ internal static partial class __ReactiveUIGeneratedBindings if (propertyExpression == "x => x.Caption") { - return __BindTo_000016A7FA446AFA(source, target); + return __BindTo_000016A7FA446B38(source, target); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindTo_000016A7FA446AFA(global::System.IObservable source, global::SharedScenarios.BindTo.SameTypeString.MyView target) + private static global::System.IDisposable __BindTo_000016A7FA446B38(global::System.IObservable source, global::SharedScenarios.BindTo.SameTypeString.MyView target) { // BindTo: observable -> Caption - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(source, value => + return global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(source, value => { target.Caption = value; }); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BToG.SameTypeString_CFP#BindToDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BToG.SameTypeString_CFP#BindToDispatch.g.verified.cs index bfe608a6..36d48b89 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BToG.SameTypeString_CFP#BindToDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BToG.SameTypeString_CFP#BindToDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindToDispatch.g.cs +//HintName: BindToDispatch.g.cs // #pragma warning disable #nullable enable @@ -21,19 +21,19 @@ internal static partial class __ReactiveUIGeneratedBindings [global::System.Runtime.CompilerServices.CallerFilePath] string callerFilePath = "", [global::System.Runtime.CompilerServices.CallerLineNumber] int callerLineNumber = 0) { - if (callerLineNumber == 46 + if (callerLineNumber == 48 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) { - return __BindTo_000016A7FA446AFA(source, target); + return __BindTo_000016A7FA446B38(source, target); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindTo_000016A7FA446AFA(global::System.IObservable source, global::SharedScenarios.BindTo.SameTypeString.MyView target) + private static global::System.IDisposable __BindTo_000016A7FA446B38(global::System.IObservable source, global::SharedScenarios.BindTo.SameTypeString.MyView target) { // BindTo: observable -> Caption - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(source, value => + return global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(source, value => { target.Caption = value; }); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BToG.WCOverride#BindToDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BToG.WCOverride#BindToDispatch.g.verified.cs index 6e47ef08..20822ea6 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BToG.WCOverride#BindToDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BToG.WCOverride#BindToDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindToDispatch.g.cs +//HintName: BindToDispatch.g.cs // #pragma warning disable #nullable enable @@ -26,16 +26,16 @@ internal static partial class __ReactiveUIGeneratedBindings if (propertyExpression == "x => x.Caption") { - return __BindTo_7FFFF5030A82ACFC(source, target, converterOverride); + return __BindTo_7FFFF5030A82AD3A(source, target, converterOverride); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindTo_7FFFF5030A82ACFC(global::System.IObservable source, global::SharedScenarios.BindTo.WithConverterOverride.MyView target, global::ReactiveUI.Binding.IBindingTypeConverter converterOverride) + private static global::System.IDisposable __BindTo_7FFFF5030A82AD3A(global::System.IObservable source, global::SharedScenarios.BindTo.WithConverterOverride.MyView target, global::ReactiveUI.Binding.IBindingTypeConverter converterOverride) { // BindTo: observable -> Caption - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(source, value => + return global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(source, value => { if (global::ReactiveUI.Binding.Fallback.RuntimeBindingConverter.TryConvert(value, null, converterOverride, out var __converted)) { diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BToG.WithConversionHint#BindToDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BToG.WithConversionHint#BindToDispatch.g.verified.cs index 93faf0ba..414fd097 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BToG.WithConversionHint#BindToDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/BToG.WithConversionHint#BindToDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: BindToDispatch.g.cs +//HintName: BindToDispatch.g.cs // #pragma warning disable #nullable enable @@ -26,16 +26,16 @@ internal static partial class __ReactiveUIGeneratedBindings if (propertyExpression == "x => x.Caption") { - return __BindTo_7FFFC579FC797738(source, target, conversionHint); + return __BindTo_7FFFC579FC797776(source, target, conversionHint); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IDisposable __BindTo_7FFFC579FC797738(global::System.IObservable source, global::SharedScenarios.BindTo.WithConversionHint.MyView target, object conversionHint) + private static global::System.IDisposable __BindTo_7FFFC579FC797776(global::System.IObservable source, global::SharedScenarios.BindTo.WithConversionHint.MyView target, object conversionHint) { // BindTo: observable -> Caption - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(source, value => + return global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(source, value => { if (global::ReactiveUI.Binding.Fallback.RuntimeBindingConverter.TryConvert(value, conversionHint, null, out var __converted)) { diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/BindCommandCodeGeneratorHelperTests.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/BindCommandCodeGeneratorHelperTests.cs index 4e3e9bfa..241b79ee 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/BindCommandCodeGeneratorHelperTests.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/BindCommandCodeGeneratorHelperTests.cs @@ -86,7 +86,7 @@ public async Task CommandPropertyPlugin_EmitBinding_ObservableParam_EmitsVolatil await Assert.That(result).Contains("Volatile.Write(ref __latestParam, p)"); await Assert.That(result).Contains(ViewSaveButtonCommandCmdFragment); await Assert.That(result).Contains("view.SaveButton.CommandParameter = param"); - await Assert.That(result).Contains("CompositeDisposable2"); + await Assert.That(result).Contains("MultipleDisposable"); } /// Verifies CommandPropertyBindingPlugin emits Command+CommandParameter+expression parameter code. diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/BindOneWayCodeGeneratorHelperTests.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/BindOneWayCodeGeneratorHelperTests.cs index c063a218..ec66ba88 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/BindOneWayCodeGeneratorHelperTests.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/BindOneWayCodeGeneratorHelperTests.cs @@ -254,7 +254,7 @@ public async Task FormatExtraMethodParams_WithScheduler_IncludesSchedulerParam() /// Verifies GenerateBindOneWayMethod with conversion includes .Select chain. /// A task representing the asynchronous test operation. [Test] - public async Task GenerateBindOneWayMethod_WithConversion_IncludesSelectChain() + public async Task GenerateBindOneWayMethod_WithConversion_IncludesMapChain() { var sb = new StringBuilder(); var inv = ModelFactory.CreateBindingInvocationInfo(hasConversion: true); @@ -263,7 +263,7 @@ public async Task GenerateBindOneWayMethod_WithConversion_IncludesSelectChain() BindOneWayCodeGenerator.GenerateBindOneWayMethod(sb, inv, classInfo, TEST00000000TESTName); var result = sb.ToString(); - await Assert.That(result).Contains("RxBindingExtensions.Select"); + await Assert.That(result).Contains("MapSignal<"); await Assert.That(result).Contains(ConversionFuncName); } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/BindTwoWayCodeGeneratorHelperTests.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/BindTwoWayCodeGeneratorHelperTests.cs index d23e814b..1dee9673 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/BindTwoWayCodeGeneratorHelperTests.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/BindTwoWayCodeGeneratorHelperTests.cs @@ -191,7 +191,7 @@ public async Task GenerateCallerFilePathOverload_SingleInvocation_GeneratesFileP /// Verifies GenerateBindTwoWayMethod generates PropertyObservable + CompositeDisposable pattern. /// A task representing the asynchronous test operation. [Test] - public async Task GenerateBindTwoWayMethod_StandardInvocation_GeneratesCompositeDisposable() + public async Task GenerateBindTwoWayMethod_StandardInvocation_GeneratesMultipleDisposable() { var sb = new StringBuilder(); var inv = ModelFactory.CreateBindingInvocationInfo(isTwoWay: true, methodName: BindTwoWayName); @@ -207,7 +207,7 @@ public async Task GenerateBindTwoWayMethod_StandardInvocation_GeneratesComposite await Assert.That(result).Contains("__BindTwoWay_TEST00000000TEST"); await Assert.That(result).Contains("PropertyObservable"); await Assert.That(result).Contains("INotifyPropertyChanged"); - await Assert.That(result).Contains("CompositeDisposable"); + await Assert.That(result).Contains("MultipleDisposable"); await Assert.That(result).Contains("target.Text = value"); await Assert.That(result).Contains("source.Name = value"); } @@ -306,7 +306,7 @@ public async Task FormatExtraMethodParams_WithConversion_IncludesTwoWayFuncParam /// Verifies GenerateBindTwoWayMethod with conversion includes .Select chains. /// A task representing the asynchronous test operation. [Test] - public async Task GenerateBindTwoWayMethod_WithConversion_IncludesSelectChains() + public async Task GenerateBindTwoWayMethod_WithConversion_IncludesMapChains() { var sb = new StringBuilder(); var inv = ModelFactory.CreateBindingInvocationInfo( @@ -322,7 +322,7 @@ public async Task GenerateBindTwoWayMethod_WithConversion_IncludesSelectChains() BindTwoWayCodeGenerator.GenerateBindTwoWayMethod(sb, inv, sourceClassInfo, targetClassInfo, TEST00000000TESTName); var result = sb.ToString(); - await Assert.That(result).Contains("RxBindingExtensions.Select"); + await Assert.That(result).Contains("MapSignal<"); await Assert.That(result).Contains(SourceToTargetConvName); await Assert.That(result).Contains(TargetToSourceConvName); } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/ObservationCodeGeneratorHelperTests.DeepChain.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/ObservationCodeGeneratorHelperTests.DeepChain.cs index ee28a1e8..3eb0235b 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/ObservationCodeGeneratorHelperTests.DeepChain.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/ObservationCodeGeneratorHelperTests.DeepChain.cs @@ -12,10 +12,10 @@ namespace ReactiveUI.Binding.SourceGenerators.Tests.CodeGeneration; /// Tests for — deep-chain and inline observation. public partial class ObservationCodeGeneratorHelperTests { - /// Verifies GenerateDeepChainObservation generates Select/Switch pattern for two-level chain. + /// Verifies GenerateDeepChainObservation generates a switch-map stage per segment of a two-level chain. /// A task representing the asynchronous test operation. [Test] - public async Task GenerateDeepChainObservation_TwoLevelChain_GeneratesSelectSwitch() + public async Task GenerateDeepChainObservation_TwoLevelChain_GeneratesSwitchMapStages() { var sb = new StringBuilder(); var paths = new EquatableArray>([ @@ -34,9 +34,8 @@ public async Task GenerateDeepChainObservation_TwoLevelChain_GeneratesSelectSwit var result = sb.ToString(); await Assert.That(result).Contains("__obs0"); await Assert.That(result).Contains("__obs1"); - await Assert.That(result).Contains("RxBindingExtensions.Select("); - await Assert.That(result).Contains(RxBindingExtensionsSwitchFragment); - await Assert.That(result).Contains(RxBindingExtensionsDistinctUntilChangedFragment); + await Assert.That(result).Contains(SwitchSinkFragment); + await Assert.That(result).Contains(DistinctUntilChangedFragment); } /// Verifies GenerateDeepChainObservation for before-change does not add DistinctUntilChanged. @@ -82,8 +81,8 @@ public async Task GenerateDeepChainVariable_TwoLevelChain_GeneratesVariableDecla await Assert.That(result).Contains("var __propObs0_s0"); await Assert.That(result).Contains("var __propObs0_s1"); await Assert.That(result).Contains("var __propObs0"); - await Assert.That(result).Contains(RxBindingExtensionsSwitchFragment); - await Assert.That(result).Contains(RxBindingExtensionsDistinctUntilChangedFragment); + await Assert.That(result).Contains(SwitchSinkFragment); + await Assert.That(result).Contains(DistinctUntilChangedFragment); } /// @@ -153,10 +152,10 @@ public async Task EmitInlineObservation_SingleProperty_NoINPC_GeneratesReturnObs await Assert.That(result).Contains(ReturnObservableName); } - /// Verifies EmitInlineObservation with deep chain generates Select/Switch pattern. + /// Verifies EmitInlineObservation with a deep chain generates a switch-map stage. /// A task representing the asynchronous test operation. [Test] - public async Task EmitInlineObservation_DeepChain_GeneratesSelectSwitchPattern() + public async Task EmitInlineObservation_DeepChain_GeneratesSwitchMapStage() { var sb = new StringBuilder(); var path = new EquatableArray([ @@ -174,8 +173,8 @@ public async Task EmitInlineObservation_DeepChain_GeneratesSelectSwitchPattern() SourceObsName); var result = sb.ToString(); - await Assert.That(result).Contains(RxBindingExtensionsSwitchFragment); - await Assert.That(result).Contains(RxBindingExtensionsDistinctUntilChangedFragment); + await Assert.That(result).Contains(SwitchSinkFragment); + await Assert.That(result).Contains(DistinctUntilChangedFragment); await Assert.That(result).Contains(SourceObsDeclaration); } @@ -321,7 +320,7 @@ public async Task EmitInlineObservation_ReactiveObject_DeepChain_GeneratesSwitch SourceObsName); var result = sb.ToString(); - await Assert.That(result).Contains(RxBindingExtensionsSwitchFragment); + await Assert.That(result).Contains(SwitchSinkFragment); await Assert.That(result).Contains(PropertyObservableName); } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/ObservationCodeGeneratorHelperTests.MethodGeneration.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/ObservationCodeGeneratorHelperTests.MethodGeneration.cs index 989bcb73..1d768239 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/ObservationCodeGeneratorHelperTests.MethodGeneration.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/ObservationCodeGeneratorHelperTests.MethodGeneration.cs @@ -44,57 +44,28 @@ public async Task GenerateConcreteOverload_CallerFilePath_GeneratesFilePathDispa await Assert.That(result).Contains("callerFilePath.EndsWith"); } - /// Verifies GenerateRuntimeFallback for single property generates throw (no runtime reflection fallback). + /// Verifies GenerateRuntimeFallback throws rather than falling back to runtime reflection. /// A task representing the asynchronous test operation. [Test] - public async Task GenerateRuntimeFallback_SingleProperty_GeneratesThrow() + public async Task GenerateRuntimeFallback_GeneratesThrowNamingTheMethod() { var sb = new StringBuilder(); - ObservationCodeGenerator.GenerateRuntimeFallback(sb, WhenChangedName, 1, false); + ObservationCodeGenerator.GenerateRuntimeFallback(sb, WhenChangedName); var result = sb.ToString(); await Assert.That(result).Contains(ThrowNewGlobalSystemInvalidOperationExceptionFragment); await Assert.That(result).Contains(WhenChangedName); } - /// Verifies GenerateRuntimeFallback for multi-property generates throw (no runtime reflection fallback). - /// A task representing the asynchronous test operation. - [Test] - public async Task GenerateRuntimeFallback_MultiPropertyWithSelector_GeneratesThrow() - { - const int PropCount = 2; - var sb = new StringBuilder(); - - ObservationCodeGenerator.GenerateRuntimeFallback(sb, WhenChangedName, PropCount, true); - - var result = sb.ToString(); - await Assert.That(result).Contains(ThrowNewGlobalSystemInvalidOperationExceptionFragment); - await Assert.That(result).Contains(WhenChangedName); - } - - /// Verifies GenerateRuntimeFallback for multi-property without selector generates throw. - /// A task representing the asynchronous test operation. - [Test] - public async Task GenerateRuntimeFallback_MultiPropertyNoSelector_GeneratesThrow() - { - const int PropCount = 2; - var sb = new StringBuilder(); - - ObservationCodeGenerator.GenerateRuntimeFallback(sb, WhenChangedName, PropCount, false); - - var result = sb.ToString(); - await Assert.That(result).Contains(ThrowNewGlobalSystemInvalidOperationExceptionFragment); - } - - /// Verifies GenerateRuntimeFallback for WhenChanging includes correct method prefix in error message. + /// Verifies the method prefix is interpolated into the message rather than hard-coded. /// A task representing the asynchronous test operation. [Test] public async Task GenerateRuntimeFallback_WhenChanging_IncludesMethodPrefixInErrorMessage() { var sb = new StringBuilder(); - ObservationCodeGenerator.GenerateRuntimeFallback(sb, WhenChangingName, 1, false); + ObservationCodeGenerator.GenerateRuntimeFallback(sb, WhenChangingName); var result = sb.ToString(); await Assert.That(result).Contains(ThrowNewGlobalSystemInvalidOperationExceptionFragment); @@ -123,7 +94,7 @@ public async Task GenerateObservationMethod_DeepChainWithSelector_GeneratesSwitc ObservationCodeGenerator.GenerateObservationMethod(sb, inv, classInfo, "DEADBEEF", false, WhenChangedName); var result = sb.ToString(); - await Assert.That(result).Contains("RxBindingExtensions.Switch("); + await Assert.That(result).Contains("SwitchMapSignal<"); await Assert.That(result).Contains("__WhenChanged_DEADBEEF"); } @@ -141,7 +112,7 @@ public async Task GenerateObservationMethod_SinglePropertyWithSelector_Generates ObservationCodeGenerator.GenerateObservationMethod(sb, inv, classInfo, "CAFEBABE", false, WhenChangedName); var result = sb.ToString(); - await Assert.That(result).Contains("RxBindingExtensions.Select("); + await Assert.That(result).Contains("LinqExtensions.Select("); await Assert.That(result).Contains("selector"); } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/ObservationCodeGeneratorHelperTests.MultiProperty.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/ObservationCodeGeneratorHelperTests.MultiProperty.cs index 0411181d..df868461 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/ObservationCodeGeneratorHelperTests.MultiProperty.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/ObservationCodeGeneratorHelperTests.MultiProperty.cs @@ -69,7 +69,7 @@ public async Task GenerateMultiPropertyObservation_WithDeepChainPath_GeneratesDe var result = sb.ToString(); await Assert.That(result).Contains("__propObs0"); await Assert.That(result).Contains("__propObs1"); - await Assert.That(result).Contains("RxBindingExtensions.Switch("); + await Assert.That(result).Contains("SwitchMapSignal<"); await Assert.That(result).Contains(CombineLatestName); } @@ -214,7 +214,7 @@ public async Task GenerateMultiPropertyObservation_NoSelector_GeneratesTupleResu var result = sb.ToString(); await Assert.That(result).Contains(CombineLatestName); - await Assert.That(result).Contains("property1: p1"); - await Assert.That(result).Contains("property2: p2"); + await Assert.That(result).Contains("Property1: p1"); + await Assert.That(result).Contains("Property2: p2"); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/ObservationCodeGeneratorHelperTests.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/ObservationCodeGeneratorHelperTests.cs index 10c3f999..15e558cf 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/ObservationCodeGeneratorHelperTests.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/CodeGeneration/ObservationCodeGeneratorHelperTests.cs @@ -85,11 +85,11 @@ public partial class ObservationCodeGeneratorHelperTests /// The x => x.Address.City property selector these tests bind against. private const string CitySelector = "x => x.Address.City"; - /// The RxBindingExtensions.DistinctUntilChanged( fragment these tests expect in the generated source. - private const string RxBindingExtensionsDistinctUntilChangedFragment = "RxBindingExtensions.DistinctUntilChanged("; + /// The DistinctUntilChanged( fragment these tests expect in the generated source. + private const string DistinctUntilChangedFragment = "LinqExtensions.DistinctUntilChanged("; - /// The RxBindingExtensions.Switch( fragment these tests expect in the generated source. - private const string RxBindingExtensionsSwitchFragment = "RxBindingExtensions.Switch("; + /// The projecting flattening sink these tests expect in the generated source. + private const string SwitchSinkFragment = "SwitchMapSignal<"; /// The throw new global::System.InvalidOperationException fragment these tests expect in the generated source. private const string ThrowNewGlobalSystemInvalidOperationExceptionFragment = "throw new global::System.InvalidOperationException"; diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/GeneratedNamespaceScopingTests.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/GeneratedNamespaceScopingTests.cs index 8b232905..4651b3e0 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/GeneratedNamespaceScopingTests.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/GeneratedNamespaceScopingTests.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using Microsoft.CodeAnalysis.CSharp; using ReactiveUI.Binding.SourceGenerators.Tests.Helpers; @@ -187,6 +188,7 @@ public async Task BeforeGlobalUsings_WithoutInternalsVisibleTo_KeepsTheSharedNam /// Renders the consumer source in the given namespace. /// The namespace the consumer's own code is declared in. /// The source code. + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static string SourceIn(string consumerNamespace) => SourceTemplate.Replace(NamespaceToken, consumerNamespace, StringComparison.Ordinal); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Helpers/CommandExtractorHelperTests.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Helpers/CommandExtractorHelperTests.cs index 31cc62cd..6aad1dd2 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Helpers/CommandExtractorHelperTests.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Helpers/CommandExtractorHelperTests.cs @@ -10,6 +10,9 @@ namespace ReactiveUI.Binding.SourceGenerators.Tests.Helpers; /// Tests for internal helper methods. public class CommandExtractorHelperTests { + /// The event name used by the explicit-event tests. + private const string ClickEventName = "Click"; + /// Verifies that IsToEventArgument returns true for a named argument with "toEvent". /// A task representing the asynchronous test operation. [Test] @@ -325,14 +328,358 @@ public void Method(Vm vm, View view, string s1, string s2) { } await Assert.That(result).IsNull(); } + /// Verifies that an empty toEvent string resolves to no event name. + /// A task representing the asynchronous test operation. + [Test] + public async Task ResolveExplicitEventName_EmptyString_ReturnsNull() => + await Assert.That(await ResolveToEventAsync("\"\"")).IsNull(); + + /// Verifies that a toEvent argument with no compile-time value resolves to no event name. + /// A task representing the asynchronous test operation. + [Test] + public async Task ResolveExplicitEventName_NonConstant_ReturnsNull() => + await Assert.That(await ResolveToEventAsync("System.Environment.MachineName")).IsNull(); + + /// Verifies that a non-empty constant toEvent string resolves to that event name. + /// A task representing the asynchronous test operation. + [Test] + public async Task ResolveExplicitEventName_ConstantString_ReturnsTheEventName() => + await Assert.That(await ResolveToEventAsync("\"Click\"")).IsEqualTo(ClickEventName); + + /// Verifies that a method with no toEvent parameter resolves no event name. + /// A task representing the asynchronous test operation. + [Test] + public async Task ResolveExplicitEventName_NoToEventParameter_ReturnsNull() + { + const string source = """ + namespace TestApp + { + public class Caller + { + public void Go() => Method("cmd"); + + public void Method(string command) { } + } + } + """; + + var compilation = TestHelper.CreateCompilation(source); + var tree = compilation.SyntaxTrees.First(); + var model = compilation.GetSemanticModel(tree); + var invocation = await FirstInvocationAsync(tree); + var methodSymbol = (Microsoft.CodeAnalysis.IMethodSymbol)model.GetSymbolInfo(invocation).Symbol!; + + var result = CommandExtractor.ResolveExplicitEventName( + methodSymbol, + invocation.ArgumentList.Arguments, + model, + CancellationToken.None); + + await Assert.That(result).IsNull(); + } + + /// Verifies that the view and view model sides are read from the receiver and first argument. + /// A task representing the asynchronous test operation. + [Test] + public async Task ResolveBindCommandSides_ReadsReceiverAndFirstArgument() + { + const string source = """ + namespace TestApp + { + public class Vm { } + public class View { public void Method(Vm vm) { } } + + public class Caller + { + public void Go() => new View().Method(new Vm()); + } + } + """; + + var compilation = TestHelper.CreateCompilation(source); + var tree = compilation.SyntaxTrees.First(); + var model = compilation.GetSemanticModel(tree); + var invocation = await FirstInvocationAsync(tree); + var memberAccess = (Microsoft.CodeAnalysis.CSharp.Syntax.MemberAccessExpressionSyntax)invocation.Expression; + + var (view, viewModel) = CommandExtractor.ResolveBindCommandSides( + memberAccess, + invocation.ArgumentList.Arguments, + model, + CancellationToken.None); + + await Assert.That(view).IsEqualTo("global::TestApp.View"); + await Assert.That(viewModel).IsEqualTo("global::TestApp.Vm"); + } + + /// Verifies that the control binding resolves the explicit event, its args type and the capabilities. + /// A task representing the asynchronous test operation. + [Test] + public async Task ResolveControlBinding_ExplicitEvent_ResolvesEventArgsAndCapabilities() + { + const string source = """ + using System; + using System.Windows.Input; + namespace TestApp + { + public class ButtonControl + { + public event EventHandler Click; + public ICommand Command { get; set; } + public object CommandParameter { get; set; } + public bool Enabled { get; set; } + } + + public class View { public ButtonControl Button { get; set; } } + + public class Caller + { + public void Go() => Method(v => v.Button, "Click"); + + public void Method(System.Linq.Expressions.Expression> controlName, string toEvent) { } + } + } + """; + + var compilation = TestHelper.CreateCompilation(source); + var tree = compilation.SyntaxTrees.First(); + var model = compilation.GetSemanticModel(tree); + var invocation = await FirstInvocationAsync(tree); + var methodSymbol = (Microsoft.CodeAnalysis.IMethodSymbol)model.GetSymbolInfo(invocation).Symbol!; + + var (eventName, eventArgs, capabilities) = CommandExtractor.ResolveControlBinding( + methodSymbol, + invocation.ArgumentList.Arguments, + invocation.ArgumentList.Arguments[0].Expression, + model, + CancellationToken.None); + + await Assert.That(eventName).IsEqualTo(ClickEventName); + await Assert.That(eventArgs).IsNotNull(); + await Assert.That(capabilities.HasCommand).IsTrue(); + await Assert.That(capabilities.HasCommandParameter).IsTrue(); + await Assert.That(capabilities.HasEnabled).IsTrue(); + } + + /// Verifies that a settable ICommand-typed Command property is recognized. + /// A task representing the asynchronous test operation. + [Test] + public async Task IsSettableICommandProperty_SettableCommand_ReturnsTrue() => + await Assert.That(CommandExtractor.IsSettableICommandProperty( + await PropertyAsync("public ICommand Command { get; set; }", "Command"))).IsTrue(); + + /// Verifies that a read-only Command property is rejected. + /// A task representing the asynchronous test operation. + [Test] + public async Task IsSettableICommandProperty_ReadOnlyCommand_ReturnsFalse() => + await Assert.That(CommandExtractor.IsSettableICommandProperty( + await PropertyAsync("public ICommand Command { get; }", "Command"))).IsFalse(); + + /// Verifies that a settable CommandParameter property is recognized. + /// A task representing the asynchronous test operation. + [Test] + public async Task IsSettableCommandParameterProperty_Settable_ReturnsTrue() => + await Assert.That(CommandExtractor.IsSettableCommandParameterProperty( + await PropertyAsync("public object CommandParameter { get; set; }", "CommandParameter"))).IsTrue(); + + /// Verifies that a differently named property is not treated as the command parameter. + /// A task representing the asynchronous test operation. + [Test] + public async Task IsSettableCommandParameterProperty_OtherName_ReturnsFalse() => + await Assert.That(CommandExtractor.IsSettableCommandParameterProperty( + await PropertyAsync("public object Tag { get; set; }", "Tag"))).IsFalse(); + + /// Verifies that a method with no withParameter reports neither overload shape. + /// A task representing the asynchronous test operation. + [Test] + public async Task DetectParameterOverload_NoWithParameter_ReportsNeitherShape() + { + const string source = """ + namespace TestApp + { + public class Caller + { + public void Go() => Method("cmd"); + + public void Method(string command) { } + } + } + """; + + var compilation = TestHelper.CreateCompilation(source); + var tree = compilation.SyntaxTrees.First(); + var model = compilation.GetSemanticModel(tree); + var invocation = await FirstInvocationAsync(tree); + var methodSymbol = (Microsoft.CodeAnalysis.IMethodSymbol)model.GetSymbolInfo(invocation).Symbol!; + + var result = CommandExtractor.DetectParameterOverload( + methodSymbol, + invocation.ArgumentList.Arguments, + model, + CancellationToken.None); + + await Assert.That(result.HasExpressionParameter).IsFalse(); + await Assert.That(result.HasObservableParameter).IsFalse(); + await Assert.That(result.ParameterTypeFullName).IsNull(); + } + + /// Verifies that a null control type resolves no event args type. + /// A task representing the asynchronous test operation. + [Test] + public async Task ResolveEventArgsTypeFullName_NullControlType_ReturnsNull() + { + var eventName = (string?)ClickEventName; + + await Assert.That(CommandExtractor.ResolveEventArgsTypeFullName(null, ref eventName)).IsNull(); + } + + /// Verifies that an explicit event name resolves that event's args type. + /// A task representing the asynchronous test operation. + [Test] + public async Task ResolveEventArgsTypeFullName_ExplicitEvent_ResolvesItsArgsType() + { + const string source = """ + using System; + namespace TestApp + { + public class ButtonControl { public event EventHandler Click; } + } + """; + + var compilation = TestHelper.CreateCompilation(source); + var tree = compilation.SyntaxTrees.First(); + var model = compilation.GetSemanticModel(tree); + var eventName = (string?)ClickEventName; + + var result = CommandExtractor.ResolveEventArgsTypeFullName(GetFirstClassSymbol(tree, model), ref eventName); + + await Assert.That(result).IsNotNull(); + await Assert.That(eventName).IsEqualTo(ClickEventName); + } + + /// Verifies that a null control type reports no capabilities. + /// A task representing the asynchronous test operation. + [Test] + public async Task DetectControlCapabilities_NullControlType_ReportsNone() + { + var result = CommandExtractor.DetectControlCapabilities(null); + + await Assert.That(result.HasCommand).IsFalse(); + await Assert.That(result.HasCommandParameter).IsFalse(); + await Assert.That(result.HasEnabled).IsFalse(); + } + + /// Verifies that a fully featured control reports every capability. + /// A task representing the asynchronous test operation. + [Test] + public async Task DetectControlCapabilities_FullControl_ReportsAll() + { + const string source = """ + using System.Windows.Input; + namespace TestApp + { + public class ButtonControl + { + public ICommand Command { get; set; } + public object CommandParameter { get; set; } + public bool Enabled { get; set; } + } + } + """; + + var compilation = TestHelper.CreateCompilation(source); + var tree = compilation.SyntaxTrees.First(); + var model = compilation.GetSemanticModel(tree); + + var result = CommandExtractor.DetectControlCapabilities(GetFirstClassSymbol(tree, model)); + + await Assert.That(result.HasCommand).IsTrue(); + await Assert.That(result.HasCommandParameter).IsTrue(); + await Assert.That(result.HasEnabled).IsTrue(); + } + + /// Compiles a control declaring the given member and returns one of its properties. + /// The property declaration to place on the control. + /// The name of the property to return. + /// The property symbol. + private static async Task PropertyAsync( + string memberDeclaration, + string propertyName) + { + var source = $$""" + using System.Windows.Input; + namespace TestApp + { + public class ButtonControl + { + {{memberDeclaration}} + } + } + """; + + var compilation = TestHelper.CreateCompilation(source); + var tree = compilation.SyntaxTrees.First(); + var model = compilation.GetSemanticModel(tree); + await Task.CompletedTask; + + return GetFirstClassSymbol(tree, model) + .GetMembers(propertyName) + .OfType() + .First(); + } + + /// Returns the first invocation expression in a syntax tree. + /// The tree to search. + /// The first invocation expression. + private static async Task FirstInvocationAsync( + Microsoft.CodeAnalysis.SyntaxTree tree) => + (await tree.GetRootAsync()) + .DescendantNodes() + .OfType() + .First(); + + /// Resolves the explicit event name for a call passing the given toEvent argument. + /// The argument expression to pass as toEvent. + /// The resolved event name, or null. + private static async Task ResolveToEventAsync(string toEventArgument) + { + var source = $$""" + namespace TestApp + { + public class Caller + { + public void Go() => Method("cmd", {{toEventArgument}}); + + public void Method(string command, string toEvent) { } + } + } + """; + + var compilation = TestHelper.CreateCompilation(source); + var tree = compilation.SyntaxTrees.First(); + var model = compilation.GetSemanticModel(tree); + + var invocation = (await tree.GetRootAsync()) + .DescendantNodes() + .OfType() + .First(); + + var methodSymbol = (Microsoft.CodeAnalysis.IMethodSymbol)model.GetSymbolInfo(invocation).Symbol!; + + return CommandExtractor.ResolveExplicitEventName( + methodSymbol, + invocation.ArgumentList.Arguments, + model, + CancellationToken.None); + } + /// Parses an invocation expression and returns the first argument. /// The invocation expression text to parse. /// The first argument syntax node. private static Microsoft.CodeAnalysis.CSharp.Syntax.ArgumentSyntax ParseFirstArgument(string expression) { var parsed = SyntaxFactory.ParseExpression(expression); - var invocation = (Microsoft.CodeAnalysis.CSharp.Syntax.InvocationExpressionSyntax)parsed; - return invocation.ArgumentList.Arguments[0]; + return ((Microsoft.CodeAnalysis.CSharp.Syntax.InvocationExpressionSyntax)parsed).ArgumentList.Arguments[0]; } /// Gets the first class symbol from a syntax tree. diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Helpers/ExtractorValidationTests.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Helpers/ExtractorValidationTests.cs index 59805364..896393c3 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Helpers/ExtractorValidationTests.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Helpers/ExtractorValidationTests.cs @@ -149,8 +149,7 @@ public async Task HasItems_EmptyArray_ReturnsFalse() [Test] public async Task HasItems_DefaultArray_ReturnsFalse() { - var items = default(ImmutableArray); - var result = ExtractorValidation.HasItems(items); + var result = ExtractorValidation.HasItems(default(ImmutableArray)); await Assert.That(result).IsFalse(); } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Helpers/SharedSourceReader.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Helpers/SharedSourceReader.cs index 21d99d0e..100b7831 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Helpers/SharedSourceReader.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Helpers/SharedSourceReader.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using System.Text; using System.Text.RegularExpressions; @@ -83,8 +84,6 @@ internal static string ReadScenario(string scenarioPath) return sb.ToString(); } - /// Finds the root directory of the SharedScenarios. - /// The path to the SharedScenarios directory. /// Lists every shared scenario, so a test can sweep all of them without a hand-kept list. /// The scenario paths, relative to the shared scenario root, in a stable order. internal static IReadOnlyList EnumerateScenarioPaths() @@ -106,6 +105,7 @@ internal static IReadOnlyList EnumerateScenarioPaths() /// Locates the shared scenario root in the test output directory. /// The absolute path to the shared scenario root. + [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static string FindRoot() => Path.Combine(Path.GetDirectoryName(typeof(SharedSourceReader).Assembly.Location)!, "SharedScenarios"); @@ -269,11 +269,13 @@ private static void SkipToBodyStart(string[] lines, ref int i) while (i < lines.Length && braceDepth > 0) { braceDepth = UpdateBraceDepth(lines[i], braceDepth); - if (braceDepth > 0) + if (braceDepth <= 0) { - bodyEnd = i; - i++; + continue; } + + bodyEnd = i; + i++; } while (bodyStart <= bodyEnd && string.IsNullOrWhiteSpace(lines[bodyStart])) @@ -366,9 +368,11 @@ public void Add(T item) public List ToList() => [.. _list]; /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public IEnumerator GetEnumerator() => _list.GetEnumerator(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Helpers/SymbolHelpersTests.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Helpers/SymbolHelpersTests.cs index 83bdd690..c6b61eb4 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Helpers/SymbolHelpersTests.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Helpers/SymbolHelpersTests.cs @@ -62,9 +62,8 @@ public class MyVm { public IObservable Obs { get; set; } } var compilation = TestHelper.CreateCompilation(source, LanguageVersion.CSharp10); var typeSymbol = GetNamedTypeSymbol(compilation, "MyVm"); var prop = typeSymbol.GetMembers("Obs").OfType().First(); - var obsPropType = (INamedTypeSymbol)prop.Type; - var result = SymbolHelpers.IsIObservable(obsPropType); + var result = SymbolHelpers.IsIObservable((INamedTypeSymbol)prop.Type); await Assert.That(result).IsTrue(); } @@ -84,9 +83,8 @@ public class MyVm { public string Name { get; set; } = ""; } var compilation = TestHelper.CreateCompilation(source); var typeSymbol = GetNamedTypeSymbol(compilation, "MyVm"); var prop = typeSymbol.GetMembers("Name").OfType().First(); - var stringType = (INamedTypeSymbol)prop.Type; - var result = SymbolHelpers.IsIObservable(stringType); + var result = SymbolHelpers.IsIObservable((INamedTypeSymbol)prop.Type); await Assert.That(result).IsFalse(); } @@ -107,9 +105,8 @@ public class MyVm { public IInteraction Confirm { get; set; } } var compilation = TestHelper.CreateCompilation(source, LanguageVersion.CSharp10); var typeSymbol = GetNamedTypeSymbol(compilation, "MyVm"); var prop = typeSymbol.GetMembers("Confirm").OfType().First(); - var interactionType = (INamedTypeSymbol)prop.Type; - var result = SymbolHelpers.IsInteractionType(interactionType); + var result = SymbolHelpers.IsInteractionType((INamedTypeSymbol)prop.Type); await Assert.That(result).IsTrue(); } @@ -129,9 +126,8 @@ public class MyVm { public string Name { get; set; } = ""; } var compilation = TestHelper.CreateCompilation(source); var typeSymbol = GetNamedTypeSymbol(compilation, "MyVm"); var prop = typeSymbol.GetMembers("Name").OfType().First(); - var stringType = (INamedTypeSymbol)prop.Type; - var result = SymbolHelpers.IsInteractionType(stringType); + var result = SymbolHelpers.IsInteractionType((INamedTypeSymbol)prop.Type); await Assert.That(result).IsFalse(); } @@ -364,37 +360,11 @@ public string Test(MyVm vm) var tree = compilation.SyntaxTrees.First(); var semanticModel = compilation.GetSemanticModel(tree); - // Get a valid segment from a separate compilation with expression-body lambda - const string simpleLambdaSource = """ - using System; - using System.Linq.Expressions; - namespace TestApp - { - public class MyVm2 { public string Name { get; set; } = ""; } - public class Usage2 - { - public void Test() - { - Expression> expr = x => x.Name; - } - } - } - """; - - var compilation2 = TestHelper.CreateCompilation(simpleLambdaSource, LanguageVersion.CSharp10); - var tree2 = compilation2.SyntaxTrees.First(); - var semanticModel2 = compilation2.GetSemanticModel(tree2); - var refLambda = (await tree2.GetRootAsync()).DescendantNodes().OfType().First(); - var path = SyntaxHelpers.ExtractPropertyPathFromLambda(refLambda, semanticModel2, default); - await Assert.That(path).IsNotNull(); - var segment = path![0]; - - // Now get the block-body parenthesized lambda from original source var blockLambda = (await tree.GetRootAsync()).DescendantNodes() .OfType() .First(); - var result = SymbolHelpers.ResolveNamedType(segment, semanticModel, blockLambda, default); + var result = SymbolHelpers.ResolveNamedType(semanticModel, blockLambda, default); await Assert.That(result).IsNull(); } @@ -430,8 +400,7 @@ public void Test() await Assert.That(path).IsNotNull(); // Pass the lambda BODY (a member access expression, not a lambda) as argExpression - var memberAccess = (ExpressionSyntax)lambda.Body; - var result = SymbolHelpers.ResolveNamedType(path![0], semanticModel, memberAccess, default); + var result = SymbolHelpers.ResolveNamedType(semanticModel, (ExpressionSyntax)lambda.Body, default); await Assert.That(result).IsNull(); } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Helpers/TestHelper.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Helpers/TestHelper.cs index 98f8693a..f76f6653 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Helpers/TestHelper.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Helpers/TestHelper.cs @@ -35,12 +35,14 @@ public static LanguageVersion FallbackLanguageVersion(bool nullableEnabled) => /// Creates a compilation from source code, targeting C# 7.3 to verify generated output compatibility. /// The source code to compile. /// A compilation ready for testing. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Compilation CreateCompilation(string source) => CreateCompilation(source, null); /// Creates a compilation from source code with appropriate references. Includes ReactiveUI for IReactiveObject testing. /// The source code to compile. /// The C# language version to target, or for C# 7.3. /// A compilation ready for testing. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Compilation CreateCompilation(string source, LanguageVersion? languageVersion) => CreateCompilation(source, languageVersion, false); @@ -83,13 +85,13 @@ public static Compilation CreateCompilation( : new[] { typeof(ReactiveUIBindingExtensions).Assembly, - typeof(ReactiveUI.Primitives.Concurrency.ISequencer).Assembly + typeof(ReactiveUI.Primitives.Concurrency.ISequencer).Assembly, }; var seedAssemblies = new[] { typeof(ReactiveObject).Assembly, typeof(IReactiveObject).Assembly, - typeof(System.Reactive.Linq.Observable).Assembly + typeof(System.Reactive.Linq.Observable).Assembly, }.Concat(runtimeSeeds).ToArray(); var allReferences = references.Concat(GetTransitiveReferences(seedAssemblies)); @@ -107,6 +109,7 @@ public static Compilation CreateCompilation( /// The source file path of the caller (automatically populated). /// The member name of the caller (automatically populated). /// A task representing the asynchronous verification operation. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Task TestPass( string source, Type callerType, @@ -163,6 +166,7 @@ public static Task TestPass( /// The source file path of the caller (automatically populated). /// The member name of the caller (automatically populated). /// The generator test result for additional assertions. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Task TestPassWithResult( string source, Type callerType, @@ -219,12 +223,14 @@ public static async Task TestPassWithResult( /// Runs the source generator on the provided source code and returns the result. /// The source code to compile and generate. /// A containing driver, compilation, and diagnostics. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static GeneratorTestResult RunGenerator(string source) => RunGenerator(source, null); /// Runs the source generator on the provided source code, targeting a specific language version. /// The source code to compile and generate. /// The C# language version to target, or for C# 7.3. /// A containing driver, compilation, and diagnostics. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static GeneratorTestResult RunGenerator(string source, LanguageVersion? languageVersion) => RunGenerator(source, languageVersion, null); @@ -239,6 +245,7 @@ public static GeneratorTestResult RunGenerator(string source, LanguageVersion? l /// other overload does, because an in-memory compilation carries no MSBuild properties. /// /// A containing driver, compilation, and diagnostics. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static GeneratorTestResult RunGenerator( string source, LanguageVersion? languageVersion, @@ -346,6 +353,7 @@ public static (Assembly Assembly, CollectibleAssemblyLoadContext Context) EmitAn /// /// The test method name. /// An abbreviated method name string. + [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static string AbbreviateMethodName(string methodName) => methodName .Replace("MultipleSameTypeBindings", "MSTB", StringComparison.Ordinal) .Replace("TwoSameTypeBindings", "2STB", StringComparison.Ordinal) diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Models/EquatableArrayTests.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Models/EquatableArrayTests.cs index 6566404f..6a1ec3fa 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Models/EquatableArrayTests.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Models/EquatableArrayTests.cs @@ -91,12 +91,8 @@ public async Task Constructor_CachesHashCode_MatchesComputeHashCode() /// Verifies default-constructed EquatableArray has hash code 0. /// A task representing the asynchronous test operation. [Test] - public async Task DefaultConstructed_HashCode_ReturnsZero() - { - var defaultArray = default(EquatableArray); - - await Assert.That(defaultArray.GetHashCode()).IsEqualTo(0); - } + public async Task DefaultConstructed_HashCode_ReturnsZero() => + await Assert.That(default(EquatableArray).GetHashCode()).IsEqualTo(0); /// Verifies equal arrays are equal via Equals method. /// A task representing the asynchronous test operation. @@ -127,13 +123,10 @@ public async Task Equals_DifferentContent_ReturnsFalse() /// Verifies default arrays are equal to each other. /// A task representing the asynchronous test operation. [Test] - public async Task Equals_BothDefault_ReturnsTrue() - { - var arr1 = default(EquatableArray); - var arr2 = default(EquatableArray); - - await Assert.That(arr1.Equals(arr2)).IsTrue(); - } + public async Task Equals_BothDefault_ReturnsTrue() => + await Assert.That(default(EquatableArray) + .Equals(default(EquatableArray))) + .IsTrue(); /// Verifies Length returns the number of elements. /// A task representing the asynchronous test operation. @@ -152,12 +145,8 @@ public async Task Length_MultipleElements_ReturnsCount() /// Verifies Length returns 0 for default-constructed array. /// A task representing the asynchronous test operation. [Test] - public async Task Length_DefaultConstructed_ReturnsZero() - { - var arr = default(EquatableArray); - - await Assert.That(arr.Length).IsEqualTo(0); - } + public async Task Length_DefaultConstructed_ReturnsZero() => + await Assert.That(default(EquatableArray).Length).IsEqualTo(0); /// /// Verifies ComputeHashCode handles null elements in the array by using 0 for their hash code. @@ -181,7 +170,7 @@ public async Task ComputeHashCode_NullElements_UsesZeroForNullHashCode() { new PropertyPathSegment("A", StringTypeName, GlobalTTypeName, true), new PropertyPathSegment("Name", StringTypeName, GlobalTTypeName, true), - new PropertyPathSegment("B", StringTypeName, GlobalTTypeName, true) + new PropertyPathSegment("B", StringTypeName, GlobalTTypeName, true), }; var nonNullHash = EquatableArray.ComputeHashCode(nonNullArr); @@ -348,13 +337,9 @@ public async Task NonGenericGetEnumerator_Works() /// Verifies operator== returns true for two default-constructed instances. /// A task representing the asynchronous test operation. [Test] - public async Task OperatorEquals_BothDefault_ReturnsTrue() - { - var arr1 = default(EquatableArray); - var arr2 = default(EquatableArray); - - await Assert.That(arr1 == arr2).IsTrue(); - } + public async Task OperatorEquals_BothDefault_ReturnsTrue() => + await Assert.That(default(EquatableArray) == default(EquatableArray)) + .IsTrue(); /// Verifies operator!= returns false for arrays with the same content. /// A task representing the asynchronous test operation. diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Models/ModelEqualityTests.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Models/ModelEqualityTests.cs index 2b792637..7ef05d9c 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Models/ModelEqualityTests.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/Models/ModelEqualityTests.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using ReactiveUI.Binding.SourceGenerators.CodeGeneration; using ReactiveUI.Binding.SourceGenerators.Models; using ReactiveUI.Binding.SourceGenerators.Tests.Helpers; @@ -636,5 +637,6 @@ public async Task TypeGroup_ReturnTypeFullName_DelegatesToFirst() /// to a constant (CA1508). /// /// A null object reference. + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static object? NullReference() => null; } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.2STB_GEI#OneWayBindDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.2STB_GEI#OneWayBindDispatch.g.verified.cs index cb783985..8614cbb0 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.2STB_GEI#OneWayBindDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.2STB_GEI#OneWayBindDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: OneWayBindDispatch.g.cs +//HintName: OneWayBindDispatch.g.cs // #pragma warning disable #nullable enable @@ -46,7 +46,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.OneWayBind.TwoSameTypeBindings.MyViewModel)__o).FirstName, true); - var sub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + var sub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { view.FirstNameText = value; }); @@ -67,7 +67,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.OneWayBind.TwoSameTypeBindings.MyViewModel)__o).LastName, true); - var sub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + var sub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { view.LastNameText = value; }); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.MB#OneWayBindDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.MB#OneWayBindDispatch.g.verified.cs index 8028568c..cffcbeec 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.MB#OneWayBindDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.MB#OneWayBindDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: OneWayBindDispatch.g.cs +//HintName: OneWayBindDispatch.g.cs // #pragma warning disable #nullable enable @@ -41,7 +41,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.OneWayBind.MultipleBindings.MyViewModel)__o).Name, true); - var sub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + var sub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { view.NameText = value; }); @@ -85,7 +85,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.OneWayBind.MultipleBindings.MyViewModel)__o).Age, true); - var sub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + var sub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { view.AgeText = value; }); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.SP_I2I#OneWayBindDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.SP_I2I#OneWayBindDispatch.g.verified.cs index c91fc9cb..8da6498c 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.SP_I2I#OneWayBindDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.SP_I2I#OneWayBindDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: OneWayBindDispatch.g.cs +//HintName: OneWayBindDispatch.g.cs // #pragma warning disable #nullable enable @@ -26,13 +26,13 @@ internal static partial class __ReactiveUIGeneratedBindings if (viewModelPropertyExpression == "x => x.Count" && viewPropertyExpression == "x => x.CountValue") { - return __OneWayBind_0000344EFEEA6340(viewModel, view); + return __OneWayBind_0000344EFEEA639D(viewModel, view); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::ReactiveUI.Binding.IReactiveBinding __OneWayBind_0000344EFEEA6340(global::SharedScenarios.OneWayBind.SinglePropertyIntToInt.MyViewModel viewModel, global::SharedScenarios.OneWayBind.SinglePropertyIntToInt.MyView view) + private static global::ReactiveUI.Binding.IReactiveBinding __OneWayBind_0000344EFEEA639D(global::SharedScenarios.OneWayBind.SinglePropertyIntToInt.MyViewModel viewModel, global::SharedScenarios.OneWayBind.SinglePropertyIntToInt.MyView view) { // OneWayBind: Count -> CountValue var sourceObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -41,7 +41,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.OneWayBind.SinglePropertyIntToInt.MyViewModel)__o).Count, true); - var sub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + var sub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { view.CountValue = value; }); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.SP_S2S#OneWayBindDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.SP_S2S#OneWayBindDispatch.g.verified.cs index 193d9430..daba8027 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.SP_S2S#OneWayBindDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.SP_S2S#OneWayBindDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: OneWayBindDispatch.g.cs +//HintName: OneWayBindDispatch.g.cs // #pragma warning disable #nullable enable @@ -26,13 +26,13 @@ internal static partial class __ReactiveUIGeneratedBindings if (viewModelPropertyExpression == "x => x.Name" && viewPropertyExpression == "x => x.NameText") { - return __OneWayBind_7FFFC4A056D62A34(viewModel, view); + return __OneWayBind_7FFFC4A056D62A91(viewModel, view); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::ReactiveUI.Binding.IReactiveBinding __OneWayBind_7FFFC4A056D62A34(global::SharedScenarios.OneWayBind.SinglePropertyStringToString.MyViewModel viewModel, global::SharedScenarios.OneWayBind.SinglePropertyStringToString.MyView view) + private static global::ReactiveUI.Binding.IReactiveBinding __OneWayBind_7FFFC4A056D62A91(global::SharedScenarios.OneWayBind.SinglePropertyStringToString.MyViewModel viewModel, global::SharedScenarios.OneWayBind.SinglePropertyStringToString.MyView view) { // OneWayBind: Name -> NameText var sourceObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -41,7 +41,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.OneWayBind.SinglePropertyStringToString.MyViewModel)__o).Name, true); - var sub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + var sub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { view.NameText = value; }); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.SP_S2S_CFP#OneWayBindDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.SP_S2S_CFP#OneWayBindDispatch.g.verified.cs index 6ec6a242..df40b763 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.SP_S2S_CFP#OneWayBindDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.SP_S2S_CFP#OneWayBindDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: OneWayBindDispatch.g.cs +//HintName: OneWayBindDispatch.g.cs // #pragma warning disable #nullable enable @@ -23,16 +23,16 @@ internal static partial class __ReactiveUIGeneratedBindings [global::System.Runtime.CompilerServices.CallerFilePath] string callerFilePath = "", [global::System.Runtime.CompilerServices.CallerLineNumber] int callerLineNumber = 0) { - if (callerLineNumber == 74 + if (callerLineNumber == 77 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) { - return __OneWayBind_7FFFC4A056D62A34(viewModel, view); + return __OneWayBind_7FFFC4A056D62A91(viewModel, view); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::ReactiveUI.Binding.IReactiveBinding __OneWayBind_7FFFC4A056D62A34(global::SharedScenarios.OneWayBind.SinglePropertyStringToString.MyViewModel viewModel, global::SharedScenarios.OneWayBind.SinglePropertyStringToString.MyView view) + private static global::ReactiveUI.Binding.IReactiveBinding __OneWayBind_7FFFC4A056D62A91(global::SharedScenarios.OneWayBind.SinglePropertyStringToString.MyViewModel viewModel, global::SharedScenarios.OneWayBind.SinglePropertyStringToString.MyView view) { // OneWayBind: Name -> NameText var sourceObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -41,7 +41,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.OneWayBind.SinglePropertyStringToString.MyViewModel)__o).Name, true); - var sub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(sourceObs, value => + var sub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(sourceObs, value => { view.NameText = value; }); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.SP_WS#OneWayBindDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.SP_WS#OneWayBindDispatch.g.verified.cs index b207fa3c..570a66db 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.SP_WS#OneWayBindDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.SP_WS#OneWayBindDispatch.g.verified.cs @@ -27,13 +27,13 @@ internal static partial class __ReactiveUIGeneratedBindings if (viewModelPropertyExpression == "x => x.Count" && viewPropertyExpression == "x => x.CountText") { - return __OneWayBind_0000321BF9FDEB10(viewModel, view, selector); + return __OneWayBind_0000321BF9FDEB6D(viewModel, view, selector); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::ReactiveUI.Binding.IReactiveBinding __OneWayBind_0000321BF9FDEB10(global::SharedScenarios.OneWayBind.SinglePropertyWithSelector.MyViewModel viewModel, global::SharedScenarios.OneWayBind.SinglePropertyWithSelector.MyView view, global::System.Func selector) + private static global::ReactiveUI.Binding.IReactiveBinding __OneWayBind_0000321BF9FDEB6D(global::SharedScenarios.OneWayBind.SinglePropertyWithSelector.MyViewModel viewModel, global::SharedScenarios.OneWayBind.SinglePropertyWithSelector.MyView view, global::System.Func selector) { // OneWayBind: Count -> CountText (with conversion) var sourceObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -41,9 +41,9 @@ internal static partial class __ReactiveUIGeneratedBindings "Count", (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.OneWayBind.SinglePropertyWithSelector.MyViewModel)__o).Count, true); - var bindObs = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(sourceObs, selector); + var bindObs = new global::ReactiveUI.Primitives.Signals.MapSignal(sourceObs, selector); - var sub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(bindObs, value => + var sub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(bindObs, value => { view.CountText = value; }); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.SP_WSSched#OneWayBindDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.SP_WSSched#OneWayBindDispatch.g.verified.cs index 1fccf21d..5cd834b6 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.SP_WSSched#OneWayBindDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/OBG.SP_WSSched#OneWayBindDispatch.g.verified.cs @@ -28,13 +28,13 @@ internal static partial class __ReactiveUIGeneratedBindings if (viewModelPropertyExpression == "x => x.Count" && viewPropertyExpression == "x => x.CountText") { - return __OneWayBind_7FFFFAB8DECC3770(viewModel, view, selector, scheduler); + return __OneWayBind_7FFFFAB8DECC37EC(viewModel, view, selector, scheduler); } throw new global::System.InvalidOperationException( "No generated binding found. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::ReactiveUI.Binding.IReactiveBinding __OneWayBind_7FFFFAB8DECC3770(global::SharedScenarios.OneWayBind.SinglePropertyWithSelectorAndScheduler.MyViewModel viewModel, global::SharedScenarios.OneWayBind.SinglePropertyWithSelectorAndScheduler.MyView view, global::System.Func selector, global::ReactiveUI.Primitives.Concurrency.ISequencer scheduler) + private static global::ReactiveUI.Binding.IReactiveBinding __OneWayBind_7FFFFAB8DECC37EC(global::SharedScenarios.OneWayBind.SinglePropertyWithSelectorAndScheduler.MyViewModel viewModel, global::SharedScenarios.OneWayBind.SinglePropertyWithSelectorAndScheduler.MyView view, global::System.Func selector, global::ReactiveUI.Primitives.Concurrency.ISequencer scheduler) { // OneWayBind: Count -> CountText (with conversion) (with scheduler) var sourceObs = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -42,10 +42,10 @@ internal static partial class __ReactiveUIGeneratedBindings "Count", (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.OneWayBind.SinglePropertyWithSelectorAndScheduler.MyViewModel)__o).Count, true); - var __selected = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(sourceObs, selector); + var __selected = new global::ReactiveUI.Primitives.Signals.MapSignal(sourceObs, selector); var bindObs = new global::ReactiveUI.Binding.Observables.ObserveOnObservable(__selected, scheduler); - var sub = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Subscribe(bindObs, value => + var sub = global::ReactiveUI.Primitives.SubscribeExtensions.Subscribe(bindObs, value => { view.CountText = value; }); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/ReactiveRuntimeFlavourTests.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/ReactiveRuntimeFlavourTests.cs index bb17cd74..88eb351b 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/ReactiveRuntimeFlavourTests.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/ReactiveRuntimeFlavourTests.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using Microsoft.CodeAnalysis.CSharp; using ReactiveUI.Binding.SourceGenerators.Tests.Helpers; @@ -41,6 +42,7 @@ public class ReactiveRuntimeFlavourTests /// Lists the shared scenarios for the sweep. /// Every shared scenario path. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IEnumerable Scenarios() => SharedSourceReader.EnumerateScenarioPaths(); /// Generated output for a System.Reactive consumer compiles against that package. @@ -96,6 +98,7 @@ public async Task LeanRuntime_NamesTheLeanTypes() /// /// The scenario source, written against the lean package. /// The same source, importing the System.Reactive package. + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static string ShiftToReactiveRuntime(string source) => source .Replace(LeanSchedulerImport, ReactiveSchedulerImport, StringComparison.Ordinal) diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAG.MI_STS#WhenAnyDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAG.MI_STS#WhenAnyDispatch.g.verified.cs index 67e3313b..03c5ee42 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAG.MI_STS#WhenAnyDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAG.MI_STS#WhenAnyDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: WhenAnyDispatch.g.cs +//HintName: WhenAnyDispatch.g.cs // #pragma warning disable #nullable enable @@ -41,7 +41,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAny.MultipleInvocationsSameType.MyViewModel)__o).FirstName, true); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__propObs0, + return global::ReactiveUI.Primitives.LinqExtensions.Select(__propObs0, value => selector(new global::ReactiveUI.Binding.ObservedChange(obj, null, value))); } @@ -53,7 +53,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAny.MultipleInvocationsSameType.MyViewModel)__o).LastName, true); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__propObs0, + return global::ReactiveUI.Primitives.LinqExtensions.Select(__propObs0, value => selector(new global::ReactiveUI.Binding.ObservedChange(obj, null, value))); } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAG.MP_2P#WhenAnyDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAG.MP_2P#WhenAnyDispatch.g.verified.cs index b89900ed..92f3cb67 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAG.MP_2P#WhenAnyDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAG.MP_2P#WhenAnyDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: WhenAnyDispatch.g.cs +//HintName: WhenAnyDispatch.g.cs // #pragma warning disable #nullable enable @@ -27,12 +27,12 @@ internal static partial class __ReactiveUIGeneratedBindings if (property1Expression == "x => x.FirstName" && property2Expression == "x => x.LastName") { - return __WhenAny_7FFFD022211E6772(objectToMonitor, selector); + return __WhenAny_7FFFD022211E67B0(objectToMonitor, selector); } throw new global::System.InvalidOperationException("No generated WhenAny dispatch matched. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IObservable __WhenAny_7FFFD022211E6772(global::SharedScenarios.WhenAny.MultiPropertyTwoProperties.MyViewModel obj, global::System.Func, global::ReactiveUI.Binding.IObservedChange, string> selector) + private static global::System.IObservable __WhenAny_7FFFD022211E67B0(global::SharedScenarios.WhenAny.MultiPropertyTwoProperties.MyViewModel obj, global::System.Func, global::ReactiveUI.Binding.IObservedChange, string> selector) { var __propObs0 = new global::ReactiveUI.Binding.Observables.PropertyObservable( obj, @@ -46,7 +46,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAny.MultiPropertyTwoProperties.MyViewModel)__o).LastName, true); - return global::ReactiveUI.Binding.Observables.CombineLatestObservable.Create( + return global::ReactiveUI.Primitives.LinqExtensions.CombineLatest( __propObs0, __propObs1, (v1, v2) => selector(new global::ReactiveUI.Binding.ObservedChange(obj, null, v1), new global::ReactiveUI.Binding.ObservedChange(obj, null, v2))); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAG.MP_DC#WhenAnyDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAG.MP_DC#WhenAnyDispatch.g.verified.cs index 759d8c66..bdf8d07d 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAG.MP_DC#WhenAnyDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAG.MP_DC#WhenAnyDispatch.g.verified.cs @@ -27,12 +27,12 @@ internal static partial class __ReactiveUIGeneratedBindings if (property1Expression == "x => x.Child.Name" && property2Expression == "x => x.Title") { - return __WhenAny_7FFFD8112D4F47EB(objectToMonitor, selector); + return __WhenAny_7FFFD8112D4F4829(objectToMonitor, selector); } throw new global::System.InvalidOperationException("No generated WhenAny dispatch matched. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IObservable __WhenAny_7FFFD8112D4F47EB(global::SharedScenarios.WhenAny.MultiPropertyDeepChain.ParentViewModel obj, global::System.Func, global::ReactiveUI.Binding.IObservedChange, string> selector) + private static global::System.IObservable __WhenAny_7FFFD8112D4F4829(global::SharedScenarios.WhenAny.MultiPropertyDeepChain.ParentViewModel obj, global::System.Func, global::ReactiveUI.Binding.IObservedChange, string> selector) { var __propObs0_s0 = (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( obj, @@ -40,16 +40,15 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAny.MultiPropertyDeepChain.ParentViewModel)__o).Child, false); - var __propObs0_s1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__propObs0_s0, - __propObs0_p1 => __propObs0_p1 != null - ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( - __propObs0_p1, - "Name", - (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAny.MultiPropertyDeepChain.ChildModel)__o).Name, - false) - : (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance)); - var __propObs0 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.DistinctUntilChanged(__propObs0_s1); + var __propObs0_s1 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal(__propObs0_s0, + __propObs0_p1 => __propObs0_p1 != null + ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( + (global::System.ComponentModel.INotifyPropertyChanged)__propObs0_p1, + "Name", + (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAny.MultiPropertyDeepChain.ChildModel)__o).Name, + false) + : (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance); + var __propObs0 = global::ReactiveUI.Primitives.LinqExtensions.DistinctUntilChanged(__propObs0_s1); var __propObs1 = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -58,7 +57,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAny.MultiPropertyDeepChain.ParentViewModel)__o).Title, true); - return global::ReactiveUI.Binding.Observables.CombineLatestObservable.Create( + return global::ReactiveUI.Primitives.LinqExtensions.CombineLatest( __propObs0, __propObs1, (v1, v2) => selector(new global::ReactiveUI.Binding.ObservedChange(obj, null, v1), new global::ReactiveUI.Binding.ObservedChange(obj, null, v2))); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAG.SP_DC#WhenAnyDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAG.SP_DC#WhenAnyDispatch.g.verified.cs index 882a6b9f..173c6291 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAG.SP_DC#WhenAnyDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAG.SP_DC#WhenAnyDispatch.g.verified.cs @@ -24,12 +24,12 @@ internal static partial class __ReactiveUIGeneratedBindings if (property1Expression == "x => x.Child.Name") { - return __WhenAny_0000044C01973E4E(objectToMonitor, selector); + return __WhenAny_0000044C01973E8C(objectToMonitor, selector); } throw new global::System.InvalidOperationException("No generated WhenAny dispatch matched. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IObservable __WhenAny_0000044C01973E4E(global::SharedScenarios.WhenAny.DeepPropertyChain.ParentViewModel obj, global::System.Func, string> selector) + private static global::System.IObservable __WhenAny_0000044C01973E8C(global::SharedScenarios.WhenAny.DeepPropertyChain.ParentViewModel obj, global::System.Func, string> selector) { var __propObs0_s0 = (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( obj, @@ -37,19 +37,18 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAny.DeepPropertyChain.ParentViewModel)__o).Child, false); - var __propObs0_s1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__propObs0_s0, - __propObs0_p1 => __propObs0_p1 != null - ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( - __propObs0_p1, - "Name", - (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAny.DeepPropertyChain.ChildModel)__o).Name, - false) - : (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance)); - var __propObs0 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.DistinctUntilChanged(__propObs0_s1); + var __propObs0_s1 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal(__propObs0_s0, + __propObs0_p1 => __propObs0_p1 != null + ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( + (global::System.ComponentModel.INotifyPropertyChanged)__propObs0_p1, + "Name", + (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAny.DeepPropertyChain.ChildModel)__o).Name, + false) + : (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance); + var __propObs0 = global::ReactiveUI.Primitives.LinqExtensions.DistinctUntilChanged(__propObs0_s1); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__propObs0, + return global::ReactiveUI.Primitives.LinqExtensions.Select(__propObs0, value => selector(new global::ReactiveUI.Binding.ObservedChange(obj, null, value))); } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAG.SP_INPC#WhenAnyDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAG.SP_INPC#WhenAnyDispatch.g.verified.cs index c219e284..b0ae5f9a 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAG.SP_INPC#WhenAnyDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAG.SP_INPC#WhenAnyDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: WhenAnyDispatch.g.cs +//HintName: WhenAnyDispatch.g.cs // #pragma warning disable #nullable enable @@ -24,12 +24,12 @@ internal static partial class __ReactiveUIGeneratedBindings if (property1Expression == "x => x.Name") { - return __WhenAny_00002E2F49F1247B(objectToMonitor, selector); + return __WhenAny_00002E2F49F124B9(objectToMonitor, selector); } throw new global::System.InvalidOperationException("No generated WhenAny dispatch matched. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IObservable __WhenAny_00002E2F49F1247B(global::SharedScenarios.WhenAny.SinglePropertyINPC.MyViewModel obj, global::System.Func, string> selector) + private static global::System.IObservable __WhenAny_00002E2F49F124B9(global::SharedScenarios.WhenAny.SinglePropertyINPC.MyViewModel obj, global::System.Func, string> selector) { var __propObs0 = new global::ReactiveUI.Binding.Observables.PropertyObservable( obj, @@ -37,7 +37,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAny.SinglePropertyINPC.MyViewModel)__o).Name, true); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__propObs0, + return global::ReactiveUI.Primitives.LinqExtensions.Select(__propObs0, value => selector(new global::ReactiveUI.Binding.ObservedChange(obj, null, value))); } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAG.SP_INPC_CFP#WhenAnyDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAG.SP_INPC_CFP#WhenAnyDispatch.g.verified.cs index 12428763..922bc081 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAG.SP_INPC_CFP#WhenAnyDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAG.SP_INPC_CFP#WhenAnyDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: WhenAnyDispatch.g.cs +//HintName: WhenAnyDispatch.g.cs // #pragma warning disable #nullable enable @@ -20,14 +20,14 @@ internal static partial class __ReactiveUIGeneratedBindings [global::System.Runtime.CompilerServices.CallerFilePath] string callerFilePath = "", [global::System.Runtime.CompilerServices.CallerLineNumber] int callerLineNumber = 0) { - if (callerLineNumber == 45 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) + if (callerLineNumber == 47 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) { - return __WhenAny_00002E2F49F1247B(objectToMonitor, selector); + return __WhenAny_00002E2F49F124B9(objectToMonitor, selector); } throw new global::System.InvalidOperationException("No generated WhenAny dispatch matched. Ensure the expression is an inline lambda for compile-time optimization."); } - private static global::System.IObservable __WhenAny_00002E2F49F1247B(global::SharedScenarios.WhenAny.SinglePropertyINPC.MyViewModel obj, global::System.Func, string> selector) + private static global::System.IObservable __WhenAny_00002E2F49F124B9(global::SharedScenarios.WhenAny.SinglePropertyINPC.MyViewModel obj, global::System.Func, string> selector) { var __propObs0 = new global::ReactiveUI.Binding.Observables.PropertyObservable( obj, @@ -35,7 +35,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAny.SinglePropertyINPC.MyViewModel)__o).Name, true); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__propObs0, + return global::ReactiveUI.Primitives.LinqExtensions.Select(__propObs0, value => selector(new global::ReactiveUI.Binding.ObservedChange(obj, null, value))); } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.2O_DC_CL#WhenAnyObservableDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.2O_DC_CL#WhenAnyObservableDispatch.g.verified.cs index 46799d8c..ac627881 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.2O_DC_CL#WhenAnyObservableDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.2O_DC_CL#WhenAnyObservableDispatch.g.verified.cs @@ -27,12 +27,12 @@ internal static partial class __ReactiveUIGeneratedBindings if (obs1Expression == "x => x.Child.Count" && obs2Expression == "x => x.Child.Message") { - return __WhenAnyObservable_7FFFF799BE87597D(objectToMonitor, selector); + return __WhenAnyObservable_7FFFF799BE8759BB(objectToMonitor, selector); } throw new global::System.InvalidOperationException("No generated WhenAnyObservable dispatch matched. This indicates a source generator caching issue."); } - private static global::System.IObservable __WhenAnyObservable_7FFFF799BE87597D(global::SharedScenarios.WhenAnyObservable.DeepObservableCombineLatest.ParentViewModel obj, global::System.Func selector) + private static global::System.IObservable __WhenAnyObservable_7FFFF799BE8759BB(global::SharedScenarios.WhenAnyObservable.DeepObservableCombineLatest.ParentViewModel obj, global::System.Func selector) { var __obsProperty0_s0 = (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( obj, @@ -40,21 +40,19 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyObservable.DeepObservableCombineLatest.ParentViewModel)__o).Child, false); - var __obsProperty0_s1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obsProperty0_s0, - __obsProperty0_p1 => __obsProperty0_p1 != null - ? (global::System.IObservable>)new global::ReactiveUI.Binding.Observables.PropertyObservable>( - __obsProperty0_p1, - "Count", - (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyObservable.DeepObservableCombineLatest.ChildModel)__o).Count, - false) - : (global::System.IObservable>)global::ReactiveUI.Binding.Observables.EmptyObservable>.Instance)); - var __obsProperty0 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.DistinctUntilChanged(__obsProperty0_s1); + var __obsProperty0_s1 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal>(__obsProperty0_s0, + __obsProperty0_p1 => __obsProperty0_p1 != null + ? (global::System.IObservable>)new global::ReactiveUI.Binding.Observables.PropertyObservable>( + (global::System.ComponentModel.INotifyPropertyChanged)__obsProperty0_p1, + "Count", + (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyObservable.DeepObservableCombineLatest.ChildModel)__o).Count, + false) + : (global::System.IObservable>)global::ReactiveUI.Binding.Observables.EmptyObservable>.Instance); + var __obsProperty0 = global::ReactiveUI.Primitives.LinqExtensions.DistinctUntilChanged(__obsProperty0_s1); - var __switched0 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obsProperty0, - __obs => __obs ?? (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance)); + var __switched0 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal, int>(__obsProperty0, + __obs => __obs ?? (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance); var __obsProperty1_s0 = (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( obj, @@ -62,23 +60,21 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyObservable.DeepObservableCombineLatest.ParentViewModel)__o).Child, false); - var __obsProperty1_s1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obsProperty1_s0, - __obsProperty1_p1 => __obsProperty1_p1 != null - ? (global::System.IObservable>)new global::ReactiveUI.Binding.Observables.PropertyObservable>( - __obsProperty1_p1, - "Message", - (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyObservable.DeepObservableCombineLatest.ChildModel)__o).Message, - false) - : (global::System.IObservable>)global::ReactiveUI.Binding.Observables.EmptyObservable>.Instance)); - var __obsProperty1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.DistinctUntilChanged(__obsProperty1_s1); + var __obsProperty1_s1 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal>(__obsProperty1_s0, + __obsProperty1_p1 => __obsProperty1_p1 != null + ? (global::System.IObservable>)new global::ReactiveUI.Binding.Observables.PropertyObservable>( + (global::System.ComponentModel.INotifyPropertyChanged)__obsProperty1_p1, + "Message", + (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyObservable.DeepObservableCombineLatest.ChildModel)__o).Message, + false) + : (global::System.IObservable>)global::ReactiveUI.Binding.Observables.EmptyObservable>.Instance); + var __obsProperty1 = global::ReactiveUI.Primitives.LinqExtensions.DistinctUntilChanged(__obsProperty1_s1); - var __switched1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obsProperty1, - __obs => __obs ?? (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance)); + var __switched1 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal, string>(__obsProperty1, + __obs => __obs ?? (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance); - return global::ReactiveUI.Binding.Observables.CombineLatestObservable.Create( + return global::ReactiveUI.Primitives.LinqExtensions.CombineLatest( __switched0, __switched1, selector); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.2O_DC_Merge#WhenAnyObservableDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.2O_DC_Merge#WhenAnyObservableDispatch.g.verified.cs index 2f32a360..6e647567 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.2O_DC_Merge#WhenAnyObservableDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.2O_DC_Merge#WhenAnyObservableDispatch.g.verified.cs @@ -26,12 +26,12 @@ internal static partial class __ReactiveUIGeneratedBindings if (obs1Expression == "x => x.Child.Command1" && obs2Expression == "x => x.Child.Command2") { - return __WhenAnyObservable_000031E1E650E356(objectToMonitor); + return __WhenAnyObservable_000031E1E650E394(objectToMonitor); } throw new global::System.InvalidOperationException("No generated WhenAnyObservable dispatch matched. This indicates a source generator caching issue."); } - private static global::System.IObservable __WhenAnyObservable_000031E1E650E356(global::SharedScenarios.WhenAnyObservable.DeepObservableMerge.ParentViewModel obj) + private static global::System.IObservable __WhenAnyObservable_000031E1E650E394(global::SharedScenarios.WhenAnyObservable.DeepObservableMerge.ParentViewModel obj) { var __obsProperty0_s0 = (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( obj, @@ -39,21 +39,19 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyObservable.DeepObservableMerge.ParentViewModel)__o).Child, false); - var __obsProperty0_s1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obsProperty0_s0, - __obsProperty0_p1 => __obsProperty0_p1 != null - ? (global::System.IObservable>)new global::ReactiveUI.Binding.Observables.PropertyObservable>( - __obsProperty0_p1, - "Command1", - (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyObservable.DeepObservableMerge.ChildModel)__o).Command1, - false) - : (global::System.IObservable>)global::ReactiveUI.Binding.Observables.EmptyObservable>.Instance)); - var __obsProperty0 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.DistinctUntilChanged(__obsProperty0_s1); + var __obsProperty0_s1 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal>(__obsProperty0_s0, + __obsProperty0_p1 => __obsProperty0_p1 != null + ? (global::System.IObservable>)new global::ReactiveUI.Binding.Observables.PropertyObservable>( + (global::System.ComponentModel.INotifyPropertyChanged)__obsProperty0_p1, + "Command1", + (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyObservable.DeepObservableMerge.ChildModel)__o).Command1, + false) + : (global::System.IObservable>)global::ReactiveUI.Binding.Observables.EmptyObservable>.Instance); + var __obsProperty0 = global::ReactiveUI.Primitives.LinqExtensions.DistinctUntilChanged(__obsProperty0_s1); - var __switched0 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obsProperty0, - __obs => __obs ?? (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance)); + var __switched0 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal, string>(__obsProperty0, + __obs => __obs ?? (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance); var __obsProperty1_s0 = (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( obj, @@ -61,23 +59,21 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyObservable.DeepObservableMerge.ParentViewModel)__o).Child, false); - var __obsProperty1_s1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obsProperty1_s0, - __obsProperty1_p1 => __obsProperty1_p1 != null - ? (global::System.IObservable>)new global::ReactiveUI.Binding.Observables.PropertyObservable>( - __obsProperty1_p1, - "Command2", - (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyObservable.DeepObservableMerge.ChildModel)__o).Command2, - false) - : (global::System.IObservable>)global::ReactiveUI.Binding.Observables.EmptyObservable>.Instance)); - var __obsProperty1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.DistinctUntilChanged(__obsProperty1_s1); + var __obsProperty1_s1 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal>(__obsProperty1_s0, + __obsProperty1_p1 => __obsProperty1_p1 != null + ? (global::System.IObservable>)new global::ReactiveUI.Binding.Observables.PropertyObservable>( + (global::System.ComponentModel.INotifyPropertyChanged)__obsProperty1_p1, + "Command2", + (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyObservable.DeepObservableMerge.ChildModel)__o).Command2, + false) + : (global::System.IObservable>)global::ReactiveUI.Binding.Observables.EmptyObservable>.Instance); + var __obsProperty1 = global::ReactiveUI.Primitives.LinqExtensions.DistinctUntilChanged(__obsProperty1_s1); - var __switched1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obsProperty1, - __obs => __obs ?? (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance)); + var __switched1 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal, string>(__obsProperty1, + __obs => __obs ?? (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Merge( + return global::ReactiveUI.Primitives.LinqExtensions.Merge( __switched0, __switched1); } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.2O_Merge#WhenAnyObservableDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.2O_Merge#WhenAnyObservableDispatch.g.verified.cs index caf95a47..e1e546f5 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.2O_Merge#WhenAnyObservableDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.2O_Merge#WhenAnyObservableDispatch.g.verified.cs @@ -26,12 +26,12 @@ internal static partial class __ReactiveUIGeneratedBindings if (obs1Expression == "x => x.Command1" && obs2Expression == "x => x.Command2") { - return __WhenAnyObservable_000004E8406EC081(objectToMonitor); + return __WhenAnyObservable_000004E8406EC0BF(objectToMonitor); } throw new global::System.InvalidOperationException("No generated WhenAnyObservable dispatch matched. This indicates a source generator caching issue."); } - private static global::System.IObservable __WhenAnyObservable_000004E8406EC081(global::SharedScenarios.WhenAnyObservable.TwoObservablesMerge.MyViewModel obj) + private static global::System.IObservable __WhenAnyObservable_000004E8406EC0BF(global::SharedScenarios.WhenAnyObservable.TwoObservablesMerge.MyViewModel obj) { var __obsProperty0 = new global::ReactiveUI.Binding.Observables.PropertyObservable>( obj, @@ -39,9 +39,8 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyObservable.TwoObservablesMerge.MyViewModel)__o).Command1, true); - var __switched0 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obsProperty0, - __obs => __obs ?? (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance)); + var __switched0 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal, string>(__obsProperty0, + __obs => __obs ?? (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance); var __obsProperty1 = new global::ReactiveUI.Binding.Observables.PropertyObservable>( obj, @@ -49,11 +48,10 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyObservable.TwoObservablesMerge.MyViewModel)__o).Command2, true); - var __switched1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obsProperty1, - __obs => __obs ?? (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance)); + var __switched1 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal, string>(__obsProperty1, + __obs => __obs ?? (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Merge( + return global::ReactiveUI.Primitives.LinqExtensions.Merge( __switched0, __switched1); } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.2O_WS#WhenAnyObservableDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.2O_WS#WhenAnyObservableDispatch.g.verified.cs index 5954a036..3ca07b84 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.2O_WS#WhenAnyObservableDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.2O_WS#WhenAnyObservableDispatch.g.verified.cs @@ -27,12 +27,12 @@ internal static partial class __ReactiveUIGeneratedBindings if (obs1Expression == "x => x.Count" && obs2Expression == "x => x.Message") { - return __WhenAnyObservable_7FFFE3651E3C40A1(objectToMonitor, selector); + return __WhenAnyObservable_7FFFE3651E3C40DF(objectToMonitor, selector); } throw new global::System.InvalidOperationException("No generated WhenAnyObservable dispatch matched. This indicates a source generator caching issue."); } - private static global::System.IObservable __WhenAnyObservable_7FFFE3651E3C40A1(global::SharedScenarios.WhenAnyObservable.TwoObservablesWithSelector.MyViewModel obj, global::System.Func selector) + private static global::System.IObservable __WhenAnyObservable_7FFFE3651E3C40DF(global::SharedScenarios.WhenAnyObservable.TwoObservablesWithSelector.MyViewModel obj, global::System.Func selector) { var __obsProperty0 = new global::ReactiveUI.Binding.Observables.PropertyObservable>( obj, @@ -40,9 +40,8 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyObservable.TwoObservablesWithSelector.MyViewModel)__o).Count, true); - var __switched0 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obsProperty0, - __obs => __obs ?? (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance)); + var __switched0 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal, int>(__obsProperty0, + __obs => __obs ?? (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance); var __obsProperty1 = new global::ReactiveUI.Binding.Observables.PropertyObservable>( obj, @@ -50,11 +49,10 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyObservable.TwoObservablesWithSelector.MyViewModel)__o).Message, true); - var __switched1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obsProperty1, - __obs => __obs ?? (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance)); + var __switched1 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal, string>(__obsProperty1, + __obs => __obs ?? (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance); - return global::ReactiveUI.Binding.Observables.CombineLatestObservable.Create( + return global::ReactiveUI.Primitives.LinqExtensions.CombineLatest( __switched0, __switched1, selector); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.MI_STS#WhenAnyObservableDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.MI_STS#WhenAnyObservableDispatch.g.verified.cs index 145f3e03..ccbc7c93 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.MI_STS#WhenAnyObservableDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.MI_STS#WhenAnyObservableDispatch.g.verified.cs @@ -40,9 +40,8 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyObservable.MultipleInvocationsSameType.MyViewModel)__o).Command1, true); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obsProperty, - __obs => __obs ?? (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance)); + return new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal, string>(__obsProperty, + __obs => __obs ?? (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance); } private static global::System.IObservable __WhenAnyObservable_7FFFC6DF47F56865(global::SharedScenarios.WhenAnyObservable.MultipleInvocationsSameType.MyViewModel obj) @@ -53,9 +52,8 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyObservable.MultipleInvocationsSameType.MyViewModel)__o).Command2, true); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obsProperty, - __obs => __obs ?? (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance)); + return new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal, string>(__obsProperty, + __obs => __obs ?? (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.SingleObservable#WhenAnyObservableDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.SingleObservable#WhenAnyObservableDispatch.g.verified.cs index 0347bbe9..ed057bab 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.SingleObservable#WhenAnyObservableDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.SingleObservable#WhenAnyObservableDispatch.g.verified.cs @@ -23,12 +23,12 @@ internal static partial class __ReactiveUIGeneratedBindings if (obs1Expression == "x => x.MyCommand") { - return __WhenAnyObservable_7FFFCD9779338708(objectToMonitor); + return __WhenAnyObservable_7FFFCD9779338746(objectToMonitor); } throw new global::System.InvalidOperationException("No generated WhenAnyObservable dispatch matched. This indicates a source generator caching issue."); } - private static global::System.IObservable __WhenAnyObservable_7FFFCD9779338708(global::SharedScenarios.WhenAnyObservable.SingleObservable.MyViewModel obj) + private static global::System.IObservable __WhenAnyObservable_7FFFCD9779338746(global::SharedScenarios.WhenAnyObservable.SingleObservable.MyViewModel obj) { var __obsProperty = new global::ReactiveUI.Binding.Observables.PropertyObservable>( obj, @@ -36,9 +36,8 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyObservable.SingleObservable.MyViewModel)__o).MyCommand, true); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obsProperty, - __obs => __obs ?? (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance)); + return new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal, string>(__obsProperty, + __obs => __obs ?? (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.SingleObservable_CFP#WhenAnyObservableDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.SingleObservable_CFP#WhenAnyObservableDispatch.g.verified.cs index ea00ef3b..026a4aee 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.SingleObservable_CFP#WhenAnyObservableDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.SingleObservable_CFP#WhenAnyObservableDispatch.g.verified.cs @@ -19,14 +19,14 @@ internal static partial class __ReactiveUIGeneratedBindings [global::System.Runtime.CompilerServices.CallerFilePath] string callerFilePath = "", [global::System.Runtime.CompilerServices.CallerLineNumber] int callerLineNumber = 0) { - if (callerLineNumber == 45 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) + if (callerLineNumber == 47 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) { - return __WhenAnyObservable_7FFFCD9779338708(objectToMonitor); + return __WhenAnyObservable_7FFFCD9779338746(objectToMonitor); } throw new global::System.InvalidOperationException("No generated WhenAnyObservable dispatch matched. This indicates a source generator caching issue."); } - private static global::System.IObservable __WhenAnyObservable_7FFFCD9779338708(global::SharedScenarios.WhenAnyObservable.SingleObservable.MyViewModel obj) + private static global::System.IObservable __WhenAnyObservable_7FFFCD9779338746(global::SharedScenarios.WhenAnyObservable.SingleObservable.MyViewModel obj) { var __obsProperty = new global::ReactiveUI.Binding.Observables.PropertyObservable>( obj, @@ -34,9 +34,8 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyObservable.SingleObservable.MyViewModel)__o).MyCommand, true); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obsProperty, - __obs => __obs ?? (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance)); + return new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal, string>(__obsProperty, + __obs => __obs ?? (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.SingleObservable_DC#WhenAnyObservableDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.SingleObservable_DC#WhenAnyObservableDispatch.g.verified.cs index 84c89866..c980a344 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.SingleObservable_DC#WhenAnyObservableDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAOG.SingleObservable_DC#WhenAnyObservableDispatch.g.verified.cs @@ -23,12 +23,12 @@ internal static partial class __ReactiveUIGeneratedBindings if (obs1Expression == "x => x.Child.MyCommand") { - return __WhenAnyObservable_7FFFD9447DB2ED7A(objectToMonitor); + return __WhenAnyObservable_7FFFD9447DB2EDB8(objectToMonitor); } throw new global::System.InvalidOperationException("No generated WhenAnyObservable dispatch matched. This indicates a source generator caching issue."); } - private static global::System.IObservable __WhenAnyObservable_7FFFD9447DB2ED7A(global::SharedScenarios.WhenAnyObservable.DeepObservableSwitch.ParentViewModel obj) + private static global::System.IObservable __WhenAnyObservable_7FFFD9447DB2EDB8(global::SharedScenarios.WhenAnyObservable.DeepObservableSwitch.ParentViewModel obj) { var __obsProperty_s0 = (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( obj, @@ -36,21 +36,19 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyObservable.DeepObservableSwitch.ParentViewModel)__o).Child, false); - var __obsProperty_s1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obsProperty_s0, - __obsProperty_p1 => __obsProperty_p1 != null - ? (global::System.IObservable>)new global::ReactiveUI.Binding.Observables.PropertyObservable>( - __obsProperty_p1, - "MyCommand", - (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyObservable.DeepObservableSwitch.ChildModel)__o).MyCommand, - false) - : (global::System.IObservable>)global::ReactiveUI.Binding.Observables.EmptyObservable>.Instance)); - var __obsProperty = global::ReactiveUI.Binding.Observables.RxBindingExtensions.DistinctUntilChanged(__obsProperty_s1); - - - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obsProperty, - __obs => __obs ?? (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance)); + var __obsProperty_s1 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal>(__obsProperty_s0, + __obsProperty_p1 => __obsProperty_p1 != null + ? (global::System.IObservable>)new global::ReactiveUI.Binding.Observables.PropertyObservable>( + (global::System.ComponentModel.INotifyPropertyChanged)__obsProperty_p1, + "MyCommand", + (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyObservable.DeepObservableSwitch.ChildModel)__o).MyCommand, + false) + : (global::System.IObservable>)global::ReactiveUI.Binding.Observables.EmptyObservable>.Instance); + var __obsProperty = global::ReactiveUI.Primitives.LinqExtensions.DistinctUntilChanged(__obsProperty_s1); + + + return new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal, string>(__obsProperty, + __obs => __obs ?? (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.DPC#WhenAnyValueDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.DPC#WhenAnyValueDispatch.g.verified.cs index 359c2727..6ff8eeb7 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.DPC#WhenAnyValueDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.DPC#WhenAnyValueDispatch.g.verified.cs @@ -42,16 +42,15 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyValue.DeepPropertyChain.ParentViewModel)__o).Child, false); - var __obs1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obs0, - __parent1 => __parent1 != null - ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( - __parent1, - "Name", - (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyValue.DeepPropertyChain.ChildModel)__o).Name, - false) - : (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance)); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.DistinctUntilChanged(__obs1); + var __obs1 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal(__obs0, + __parent1 => __parent1 != null + ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( + (global::System.ComponentModel.INotifyPropertyChanged)__parent1, + "Name", + (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyValue.DeepPropertyChain.ChildModel)__o).Name, + false) + : (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance); + return global::ReactiveUI.Primitives.LinqExtensions.DistinctUntilChanged(__obs1); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.MP_2P#WhenAnyValueDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.MP_2P#WhenAnyValueDispatch.g.verified.cs index f6eebc4f..a1db647b 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.MP_2P#WhenAnyValueDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.MP_2P#WhenAnyValueDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: WhenAnyValueDispatch.g.cs +//HintName: WhenAnyValueDispatch.g.cs // #pragma warning disable #nullable enable @@ -51,10 +51,10 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyValue.MultiPropertyTwoProperties.MyViewModel)__o).Age, true); - return global::ReactiveUI.Binding.Observables.CombineLatestObservable.Create( + return global::ReactiveUI.Primitives.LinqExtensions.CombineLatest( __propObs0, __propObs1, - (p1, p2) => (property1: p1, property2: p2)); + (p1, p2) => (Property1: p1, Property2: p2)); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.MP_3P#WhenAnyValueDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.MP_3P#WhenAnyValueDispatch.g.verified.cs index 69a94fe9..9288f647 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.MP_3P#WhenAnyValueDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.MP_3P#WhenAnyValueDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: WhenAnyValueDispatch.g.cs +//HintName: WhenAnyValueDispatch.g.cs // #pragma warning disable #nullable enable @@ -60,11 +60,11 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyValue.MultiPropertyThreeProperties.MyViewModel)__o).Score, true); - return global::ReactiveUI.Binding.Observables.CombineLatestObservable.Create( + return global::ReactiveUI.Primitives.LinqExtensions.CombineLatest( __propObs0, __propObs1, __propObs2, - (p1, p2, p3) => (property1: p1, property2: p2, property3: p3)); + (p1, p2, p3) => (Property1: p1, Property2: p2, Property3: p3)); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.MP_FiveProperties#WhenAnyValueDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.MP_FiveProperties#WhenAnyValueDispatch.g.verified.cs index 45f450cb..42cd33de 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.MP_FiveProperties#WhenAnyValueDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.MP_FiveProperties#WhenAnyValueDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: WhenAnyValueDispatch.g.cs +//HintName: WhenAnyValueDispatch.g.cs // #pragma warning disable #nullable enable @@ -72,13 +72,13 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyValue.MultiPropertyFiveProperties.MyViewModel)__o).Prop5, true); - return global::ReactiveUI.Binding.Observables.CombineLatestObservable.Create( + return global::ReactiveUI.Primitives.LinqExtensions.CombineLatest( __propObs0, __propObs1, __propObs2, __propObs3, __propObs4, - (p1, p2, p3, p4, p5) => (property1: p1, property2: p2, property3: p3, property4: p4, property5: p5)); + (p1, p2, p3, p4, p5) => (Property1: p1, Property2: p2, Property3: p3, Property4: p4, Property5: p5)); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.MP_TwelveProperties#WhenAnyValueDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.MP_TwelveProperties#WhenAnyValueDispatch.g.verified.cs index 5f8709c6..b08922fd 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.MP_TwelveProperties#WhenAnyValueDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.MP_TwelveProperties#WhenAnyValueDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: WhenAnyValueDispatch.g.cs +//HintName: WhenAnyValueDispatch.g.cs // #pragma warning disable #nullable enable @@ -135,7 +135,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyValue.MultiPropertyTwelveProperties.WhenAnyFixture)__o).Value12, true); - return global::ReactiveUI.Binding.Observables.CombineLatestObservable.Create( + return global::ReactiveUI.Primitives.LinqExtensions.CombineLatest( __propObs0, __propObs1, __propObs2, @@ -148,7 +148,7 @@ internal static partial class __ReactiveUIGeneratedBindings __propObs9, __propObs10, __propObs11, - (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12) => (property1: p1, property2: p2, property3: p3, property4: p4, property5: p5, property6: p6, property7: p7, property8: p8, property9: p9, property10: p10, property11: p11, property12: p12)); + (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12) => (Property1: p1, Property2: p2, Property3: p3, Property4: p4, Property5: p5, Property6: p6, Property7: p7, Property8: p8, Property9: p9, Property10: p10, Property11: p11, Property12: p12)); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.MP_WS#WhenAnyValueDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.MP_WS#WhenAnyValueDispatch.g.verified.cs index 16e2e45e..5568ff64 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.MP_WS#WhenAnyValueDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.MP_WS#WhenAnyValueDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: WhenAnyValueDispatch.g.cs +//HintName: WhenAnyValueDispatch.g.cs // #pragma warning disable #nullable enable @@ -54,7 +54,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenAnyValue.MultiPropertyWithSelector.MyViewModel)__o).LastName, true); - return global::ReactiveUI.Binding.Observables.CombineLatestObservable.Create( + return global::ReactiveUI.Primitives.LinqExtensions.CombineLatest( __propObs0, __propObs1, selector); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.SP_INPC_CFP#WhenAnyValueDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.SP_INPC_CFP#WhenAnyValueDispatch.g.verified.cs index c137cbf3..d3d79a12 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.SP_INPC_CFP#WhenAnyValueDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WAVG.SP_INPC_CFP#WhenAnyValueDispatch.g.verified.cs @@ -25,7 +25,7 @@ internal static partial class __ReactiveUIGeneratedBindings return global::ReactiveUI.Binding.Fallback.RuntimeObservationFallback.WhenAnyValue(objectToMonitor, property1); } - if (callerLineNumber == 45 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) + if (callerLineNumber == 47 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) { return __WhenAnyValue_0000263492582AFF(objectToMonitor); } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.4LDC#WhenChangedDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.4LDC#WhenChangedDispatch.g.verified.cs index 4f9c940f..e8352ade 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.4LDC#WhenChangedDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.4LDC#WhenChangedDispatch.g.verified.cs @@ -42,36 +42,33 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenChanged.FourLevelDeepChain.Level1)__o).Model, false); - var __obs1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obs0, - __parent1 => __parent1 != null - ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( - __parent1, - "Model", - (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenChanged.FourLevelDeepChain.Level2)__o).Model, - false) - : (global::System.IObservable)new global::ReactiveUI.Binding.Observables.ReturnObservable(default(global::SharedScenarios.WhenChanged.FourLevelDeepChain.Level3)))); + var __obs1 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal(__obs0, + __parent1 => __parent1 != null + ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( + (global::System.ComponentModel.INotifyPropertyChanged)__parent1, + "Model", + (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenChanged.FourLevelDeepChain.Level2)__o).Model, + false) + : (global::System.IObservable)new global::ReactiveUI.Binding.Observables.ReturnObservable(default(global::SharedScenarios.WhenChanged.FourLevelDeepChain.Level3))); - var __obs2 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obs1, - __parent2 => __parent2 != null - ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( - __parent2, - "Model", - (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenChanged.FourLevelDeepChain.Level3)__o).Model, - false) - : (global::System.IObservable)new global::ReactiveUI.Binding.Observables.ReturnObservable(default(global::SharedScenarios.WhenChanged.FourLevelDeepChain.Model)))); + var __obs2 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal(__obs1, + __parent2 => __parent2 != null + ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( + (global::System.ComponentModel.INotifyPropertyChanged)__parent2, + "Model", + (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenChanged.FourLevelDeepChain.Level3)__o).Model, + false) + : (global::System.IObservable)new global::ReactiveUI.Binding.Observables.ReturnObservable(default(global::SharedScenarios.WhenChanged.FourLevelDeepChain.Model))); - var __obs3 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obs2, - __parent3 => __parent3 != null - ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( - __parent3, - "Value", - (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenChanged.FourLevelDeepChain.Model)__o).Value, - false) - : (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance)); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.DistinctUntilChanged(__obs3); + var __obs3 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal(__obs2, + __parent3 => __parent3 != null + ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( + (global::System.ComponentModel.INotifyPropertyChanged)__parent3, + "Value", + (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenChanged.FourLevelDeepChain.Model)__o).Value, + false) + : (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance); + return global::ReactiveUI.Primitives.LinqExtensions.DistinctUntilChanged(__obs3); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.DPC#WhenChangedDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.DPC#WhenChangedDispatch.g.verified.cs index be09522f..17631601 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.DPC#WhenChangedDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.DPC#WhenChangedDispatch.g.verified.cs @@ -42,16 +42,15 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenChanged.DeepPropertyChain.ParentViewModel)__o).Child, false); - var __obs1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obs0, - __parent1 => __parent1 != null - ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( - __parent1, - "Name", - (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenChanged.DeepPropertyChain.ChildModel)__o).Name, - false) - : (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance)); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.DistinctUntilChanged(__obs1); + var __obs1 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal(__obs0, + __parent1 => __parent1 != null + ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( + (global::System.ComponentModel.INotifyPropertyChanged)__parent1, + "Name", + (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenChanged.DeepPropertyChain.ChildModel)__o).Name, + false) + : (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance); + return global::ReactiveUI.Primitives.LinqExtensions.DistinctUntilChanged(__obs1); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.MP_2P#WhenChangedDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.MP_2P#WhenChangedDispatch.g.verified.cs index 66d08e5b..56c0b0ad 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.MP_2P#WhenChangedDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.MP_2P#WhenChangedDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: WhenChangedDispatch.g.cs +//HintName: WhenChangedDispatch.g.cs // #pragma warning disable #nullable enable @@ -51,10 +51,10 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenChanged.MultiPropertyTwoProperties.MyViewModel)__o).Age, true); - return global::ReactiveUI.Binding.Observables.CombineLatestObservable.Create( + return global::ReactiveUI.Primitives.LinqExtensions.CombineLatest( __propObs0, __propObs1, - (p1, p2) => (property1: p1, property2: p2)); + (p1, p2) => (Property1: p1, Property2: p2)); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.MP_3P#WhenChangedDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.MP_3P#WhenChangedDispatch.g.verified.cs index e7ff0846..4e5f1071 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.MP_3P#WhenChangedDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.MP_3P#WhenChangedDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: WhenChangedDispatch.g.cs +//HintName: WhenChangedDispatch.g.cs // #pragma warning disable #nullable enable @@ -60,11 +60,11 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenChanged.MultiPropertyThreeProperties.MyViewModel)__o).Score, true); - return global::ReactiveUI.Binding.Observables.CombineLatestObservable.Create( + return global::ReactiveUI.Primitives.LinqExtensions.CombineLatest( __propObs0, __propObs1, __propObs2, - (p1, p2, p3) => (property1: p1, property2: p2, property3: p3)); + (p1, p2, p3) => (Property1: p1, Property2: p2, Property3: p3)); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.MP_WDC#WhenChangedDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.MP_WDC#WhenChangedDispatch.g.verified.cs index c01547d5..c521574d 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.MP_WDC#WhenChangedDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.MP_WDC#WhenChangedDispatch.g.verified.cs @@ -48,16 +48,15 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenChanged.MultiPropertyWithDeepChains.MyViewModel)__o).Address, false); - var __propObs0_s1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__propObs0_s0, - __propObs0_p1 => __propObs0_p1 != null - ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( - __propObs0_p1, - "City", - (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenChanged.MultiPropertyWithDeepChains.AddressModel)__o).City, - false) - : (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance)); - var __propObs0 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.DistinctUntilChanged(__propObs0_s1); + var __propObs0_s1 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal(__propObs0_s0, + __propObs0_p1 => __propObs0_p1 != null + ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( + (global::System.ComponentModel.INotifyPropertyChanged)__propObs0_p1, + "City", + (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenChanged.MultiPropertyWithDeepChains.AddressModel)__o).City, + false) + : (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance); + var __propObs0 = global::ReactiveUI.Primitives.LinqExtensions.DistinctUntilChanged(__propObs0_s1); var __propObs1 = new global::ReactiveUI.Binding.Observables.PropertyObservable( @@ -66,7 +65,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenChanged.MultiPropertyWithDeepChains.MyViewModel)__o).Name, true); - return global::ReactiveUI.Binding.Observables.CombineLatestObservable.Create( + return global::ReactiveUI.Primitives.LinqExtensions.CombineLatest( __propObs0, __propObs1, selector); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.MP_WS#WhenChangedDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.MP_WS#WhenChangedDispatch.g.verified.cs index 66d9cfce..5e9798b9 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.MP_WS#WhenChangedDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.MP_WS#WhenChangedDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: WhenChangedDispatch.g.cs +//HintName: WhenChangedDispatch.g.cs // #pragma warning disable #nullable enable @@ -54,7 +54,7 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenChanged.MultiPropertyWithSelector.MyViewModel)__o).LastName, true); - return global::ReactiveUI.Binding.Observables.CombineLatestObservable.Create( + return global::ReactiveUI.Primitives.LinqExtensions.CombineLatest( __propObs0, __propObs1, selector); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.NullForgivingDC#WhenChangedDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.NullForgivingDC#WhenChangedDispatch.g.verified.cs index a768c7d2..15d682ff 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.NullForgivingDC#WhenChangedDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.NullForgivingDC#WhenChangedDispatch.g.verified.cs @@ -42,16 +42,15 @@ internal static partial class __ReactiveUIGeneratedBindings (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenChanged.NullForgivingDeepChain.ParentViewModel)__o).Child, false); - var __obs1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obs0, - __parent1 => __parent1 != null - ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( - __parent1, - "Name", - (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenChanged.NullForgivingDeepChain.ChildModel)__o).Name, - false) - : (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance)); - return global::ReactiveUI.Binding.Observables.RxBindingExtensions.DistinctUntilChanged(__obs1); + var __obs1 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal(__obs0, + __parent1 => __parent1 != null + ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyObservable( + (global::System.ComponentModel.INotifyPropertyChanged)__parent1, + "Name", + (global::System.ComponentModel.INotifyPropertyChanged __o) => ((global::SharedScenarios.WhenChanged.NullForgivingDeepChain.ChildModel)__o).Name, + false) + : (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance); + return global::ReactiveUI.Primitives.LinqExtensions.DistinctUntilChanged(__obs1); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.SP_INPC_CFP#WhenChangedDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.SP_INPC_CFP#WhenChangedDispatch.g.verified.cs index 690daac1..65fd060e 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.SP_INPC_CFP#WhenChangedDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCG.SP_INPC_CFP#WhenChangedDispatch.g.verified.cs @@ -25,7 +25,7 @@ internal static partial class __ReactiveUIGeneratedBindings return global::ReactiveUI.Binding.Fallback.RuntimeObservationFallback.WhenChanged(objectToMonitor, property1); } - if (callerLineNumber == 45 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) + if (callerLineNumber == 47 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) { return __WhenChanged_7FFFD2E8D6FC818E(objectToMonitor); } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.4LDC#WhenChangingDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.4LDC#WhenChangingDispatch.g.verified.cs index 009c09d3..5a61cb24 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.4LDC#WhenChangingDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.4LDC#WhenChangingDispatch.g.verified.cs @@ -41,32 +41,29 @@ internal static partial class __ReactiveUIGeneratedBindings "Model", (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.FourLevelDeepChain.Level1)__o).Model); - var __obs1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obs0, - __parent1 => __parent1 != null - ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyChangingObservable( - (global::System.ComponentModel.INotifyPropertyChanging)__parent1, - "Model", - (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.FourLevelDeepChain.Level2)__o).Model) - : (global::System.IObservable)new global::ReactiveUI.Binding.Observables.ReturnObservable(default(global::SharedScenarios.WhenChanging.FourLevelDeepChain.Level3)))); + var __obs1 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal(__obs0, + __parent1 => __parent1 != null + ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyChangingObservable( + (global::System.ComponentModel.INotifyPropertyChanging)__parent1, + "Model", + (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.FourLevelDeepChain.Level2)__o).Model) + : (global::System.IObservable)new global::ReactiveUI.Binding.Observables.ReturnObservable(default(global::SharedScenarios.WhenChanging.FourLevelDeepChain.Level3))); - var __obs2 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obs1, - __parent2 => __parent2 != null - ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyChangingObservable( - (global::System.ComponentModel.INotifyPropertyChanging)__parent2, - "Model", - (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.FourLevelDeepChain.Level3)__o).Model) - : (global::System.IObservable)new global::ReactiveUI.Binding.Observables.ReturnObservable(default(global::SharedScenarios.WhenChanging.FourLevelDeepChain.Model)))); + var __obs2 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal(__obs1, + __parent2 => __parent2 != null + ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyChangingObservable( + (global::System.ComponentModel.INotifyPropertyChanging)__parent2, + "Model", + (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.FourLevelDeepChain.Level3)__o).Model) + : (global::System.IObservable)new global::ReactiveUI.Binding.Observables.ReturnObservable(default(global::SharedScenarios.WhenChanging.FourLevelDeepChain.Model))); - var __obs3 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obs2, - __parent3 => __parent3 != null - ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyChangingObservable( - (global::System.ComponentModel.INotifyPropertyChanging)__parent3, - "Value", - (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.FourLevelDeepChain.Model)__o).Value) - : (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance)); + var __obs3 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal(__obs2, + __parent3 => __parent3 != null + ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyChangingObservable( + (global::System.ComponentModel.INotifyPropertyChanging)__parent3, + "Value", + (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.FourLevelDeepChain.Model)__o).Value) + : (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance); return __obs3; } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.4LDC_CFP#WhenChangingDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.4LDC_CFP#WhenChangingDispatch.g.verified.cs index 81681049..3213ce9f 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.4LDC_CFP#WhenChangingDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.4LDC_CFP#WhenChangingDispatch.g.verified.cs @@ -25,7 +25,7 @@ internal static partial class __ReactiveUIGeneratedBindings return global::ReactiveUI.Binding.Fallback.RuntimeObservationFallback.WhenChanging(objectToMonitor, property1); } - if (callerLineNumber == 139 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) + if (callerLineNumber == 141 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) { return __WhenChanging_00001C315F48E7DF(objectToMonitor); } @@ -39,32 +39,29 @@ internal static partial class __ReactiveUIGeneratedBindings "Model", (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.FourLevelDeepChain.Level1)__o).Model); - var __obs1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obs0, - __parent1 => __parent1 != null - ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyChangingObservable( - (global::System.ComponentModel.INotifyPropertyChanging)__parent1, - "Model", - (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.FourLevelDeepChain.Level2)__o).Model) - : (global::System.IObservable)new global::ReactiveUI.Binding.Observables.ReturnObservable(default(global::SharedScenarios.WhenChanging.FourLevelDeepChain.Level3)))); + var __obs1 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal(__obs0, + __parent1 => __parent1 != null + ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyChangingObservable( + (global::System.ComponentModel.INotifyPropertyChanging)__parent1, + "Model", + (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.FourLevelDeepChain.Level2)__o).Model) + : (global::System.IObservable)new global::ReactiveUI.Binding.Observables.ReturnObservable(default(global::SharedScenarios.WhenChanging.FourLevelDeepChain.Level3))); - var __obs2 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obs1, - __parent2 => __parent2 != null - ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyChangingObservable( - (global::System.ComponentModel.INotifyPropertyChanging)__parent2, - "Model", - (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.FourLevelDeepChain.Level3)__o).Model) - : (global::System.IObservable)new global::ReactiveUI.Binding.Observables.ReturnObservable(default(global::SharedScenarios.WhenChanging.FourLevelDeepChain.Model)))); + var __obs2 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal(__obs1, + __parent2 => __parent2 != null + ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyChangingObservable( + (global::System.ComponentModel.INotifyPropertyChanging)__parent2, + "Model", + (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.FourLevelDeepChain.Level3)__o).Model) + : (global::System.IObservable)new global::ReactiveUI.Binding.Observables.ReturnObservable(default(global::SharedScenarios.WhenChanging.FourLevelDeepChain.Model))); - var __obs3 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obs2, - __parent3 => __parent3 != null - ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyChangingObservable( - (global::System.ComponentModel.INotifyPropertyChanging)__parent3, - "Value", - (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.FourLevelDeepChain.Model)__o).Value) - : (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance)); + var __obs3 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal(__obs2, + __parent3 => __parent3 != null + ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyChangingObservable( + (global::System.ComponentModel.INotifyPropertyChanging)__parent3, + "Value", + (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.FourLevelDeepChain.Model)__o).Value) + : (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance); return __obs3; } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.DPC#WhenChangingDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.DPC#WhenChangingDispatch.g.verified.cs index e7c105f1..9b73d8df 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.DPC#WhenChangingDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.DPC#WhenChangingDispatch.g.verified.cs @@ -41,14 +41,13 @@ internal static partial class __ReactiveUIGeneratedBindings "Child", (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.DeepPropertyChain.ParentViewModel)__o).Child); - var __obs1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obs0, - __parent1 => __parent1 != null - ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyChangingObservable( - (global::System.ComponentModel.INotifyPropertyChanging)__parent1, - "Name", - (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.DeepPropertyChain.ChildModel)__o).Name) - : (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance)); + var __obs1 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal(__obs0, + __parent1 => __parent1 != null + ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyChangingObservable( + (global::System.ComponentModel.INotifyPropertyChanging)__parent1, + "Name", + (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.DeepPropertyChain.ChildModel)__o).Name) + : (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance); return __obs1; } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.DPC_CFP#WhenChangingDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.DPC_CFP#WhenChangingDispatch.g.verified.cs index c85826cb..bda8246c 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.DPC_CFP#WhenChangingDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.DPC_CFP#WhenChangingDispatch.g.verified.cs @@ -25,7 +25,7 @@ internal static partial class __ReactiveUIGeneratedBindings return global::ReactiveUI.Binding.Fallback.RuntimeObservationFallback.WhenChanging(objectToMonitor, property1); } - if (callerLineNumber == 79 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) + if (callerLineNumber == 81 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) { return __WhenChanging_7FFFF85E7720B498(objectToMonitor); } @@ -39,14 +39,13 @@ internal static partial class __ReactiveUIGeneratedBindings "Child", (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.DeepPropertyChain.ParentViewModel)__o).Child); - var __obs1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__obs0, - __parent1 => __parent1 != null - ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyChangingObservable( - (global::System.ComponentModel.INotifyPropertyChanging)__parent1, - "Name", - (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.DeepPropertyChain.ChildModel)__o).Name) - : (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance)); + var __obs1 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal(__obs0, + __parent1 => __parent1 != null + ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyChangingObservable( + (global::System.ComponentModel.INotifyPropertyChanging)__parent1, + "Name", + (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.DeepPropertyChain.ChildModel)__o).Name) + : (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance); return __obs1; } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.MP_2P#WhenChangingDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.MP_2P#WhenChangingDispatch.g.verified.cs index d4d25b54..a3cdccd5 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.MP_2P#WhenChangingDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.MP_2P#WhenChangingDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: WhenChangingDispatch.g.cs +//HintName: WhenChangingDispatch.g.cs // #pragma warning disable #nullable enable @@ -49,10 +49,10 @@ internal static partial class __ReactiveUIGeneratedBindings "Age", (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.MultiPropertyTwoProperties.MyViewModel)__o).Age); - return global::ReactiveUI.Binding.Observables.CombineLatestObservable.Create( + return global::ReactiveUI.Primitives.LinqExtensions.CombineLatest( __propObs0, __propObs1, - (p1, p2) => (property1: p1, property2: p2)); + (p1, p2) => (Property1: p1, Property2: p2)); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.MP_2P_CFP#WhenChangingDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.MP_2P_CFP#WhenChangingDispatch.g.verified.cs index 12e62344..f53e7c0c 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.MP_2P_CFP#WhenChangingDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.MP_2P_CFP#WhenChangingDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: WhenChangingDispatch.g.cs +//HintName: WhenChangingDispatch.g.cs // #pragma warning disable #nullable enable @@ -27,7 +27,7 @@ internal static partial class __ReactiveUIGeneratedBindings return global::ReactiveUI.Binding.Fallback.RuntimeObservationFallback.WhenChanging(objectToMonitor, property1, property2); } - if (callerLineNumber == 69 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) + if (callerLineNumber == 71 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) { return __WhenChanging_000011A95039C09F(objectToMonitor); } @@ -46,10 +46,10 @@ internal static partial class __ReactiveUIGeneratedBindings "Age", (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.MultiPropertyTwoProperties.MyViewModel)__o).Age); - return global::ReactiveUI.Binding.Observables.CombineLatestObservable.Create( + return global::ReactiveUI.Primitives.LinqExtensions.CombineLatest( __propObs0, __propObs1, - (p1, p2) => (property1: p1, property2: p2)); + (p1, p2) => (Property1: p1, Property2: p2)); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.MP_3P#WhenChangingDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.MP_3P#WhenChangingDispatch.g.verified.cs index 65fbe6c0..40eefd2b 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.MP_3P#WhenChangingDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.MP_3P#WhenChangingDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: WhenChangingDispatch.g.cs +//HintName: WhenChangingDispatch.g.cs // #pragma warning disable #nullable enable @@ -57,11 +57,11 @@ internal static partial class __ReactiveUIGeneratedBindings "Score", (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.MultiPropertyThreeProperties.MyViewModel)__o).Score); - return global::ReactiveUI.Binding.Observables.CombineLatestObservable.Create( + return global::ReactiveUI.Primitives.LinqExtensions.CombineLatest( __propObs0, __propObs1, __propObs2, - (p1, p2, p3) => (property1: p1, property2: p2, property3: p3)); + (p1, p2, p3) => (Property1: p1, Property2: p2, Property3: p3)); } } diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.MP_WDC#WhenChangingDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.MP_WDC#WhenChangingDispatch.g.verified.cs index fe6b206c..bfbb7f29 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.MP_WDC#WhenChangingDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.MP_WDC#WhenChangingDispatch.g.verified.cs @@ -47,14 +47,13 @@ internal static partial class __ReactiveUIGeneratedBindings "Address", (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.MultiPropertyWithDeepChains.MyViewModel)__o).Address); - var __propObs0_s1 = global::ReactiveUI.Binding.Observables.RxBindingExtensions.Switch( - global::ReactiveUI.Binding.Observables.RxBindingExtensions.Select(__propObs0_s0, - __propObs0_p1 => __propObs0_p1 != null - ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyChangingObservable( - (global::System.ComponentModel.INotifyPropertyChanging)__propObs0_p1, - "City", - (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.MultiPropertyWithDeepChains.AddressModel)__o).City) - : (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance)); + var __propObs0_s1 = new global::ReactiveUI.Primitives.Advanced.SwitchMapSignal(__propObs0_s0, + __propObs0_p1 => __propObs0_p1 != null + ? (global::System.IObservable)new global::ReactiveUI.Binding.Observables.PropertyChangingObservable( + (global::System.ComponentModel.INotifyPropertyChanging)__propObs0_p1, + "City", + (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.MultiPropertyWithDeepChains.AddressModel)__o).City) + : (global::System.IObservable)global::ReactiveUI.Binding.Observables.EmptyObservable.Instance); var __propObs0 = __propObs0_s1; @@ -63,7 +62,7 @@ internal static partial class __ReactiveUIGeneratedBindings "Name", (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.MultiPropertyWithDeepChains.MyViewModel)__o).Name); - return global::ReactiveUI.Binding.Observables.CombineLatestObservable.Create( + return global::ReactiveUI.Primitives.LinqExtensions.CombineLatest( __propObs0, __propObs1, selector); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.MP_WS#WhenChangingDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.MP_WS#WhenChangingDispatch.g.verified.cs index ef293bed..b8556e13 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.MP_WS#WhenChangingDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.MP_WS#WhenChangingDispatch.g.verified.cs @@ -1,4 +1,4 @@ -//HintName: WhenChangingDispatch.g.cs +//HintName: WhenChangingDispatch.g.cs // #pragma warning disable #nullable enable @@ -52,7 +52,7 @@ internal static partial class __ReactiveUIGeneratedBindings "LastName", (global::System.ComponentModel.INotifyPropertyChanging __o) => ((global::SharedScenarios.WhenChanging.MultiPropertyWithSelector.MyViewModel)__o).LastName); - return global::ReactiveUI.Binding.Observables.CombineLatestObservable.Create( + return global::ReactiveUI.Primitives.LinqExtensions.CombineLatest( __propObs0, __propObs1, selector); diff --git a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.SP_INPC_CFP#WhenChangingDispatch.g.verified.cs b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.SP_INPC_CFP#WhenChangingDispatch.g.verified.cs index 1744cfb3..79ae0c52 100644 --- a/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.SP_INPC_CFP#WhenChangingDispatch.g.verified.cs +++ b/src/tests/ReactiveUI.Binding.SourceGenerators.Tests/WCnG.SP_INPC_CFP#WhenChangingDispatch.g.verified.cs @@ -25,7 +25,7 @@ internal static partial class __ReactiveUIGeneratedBindings return global::ReactiveUI.Binding.Fallback.RuntimeObservationFallback.WhenChanging(objectToMonitor, property1); } - if (callerLineNumber == 49 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) + if (callerLineNumber == 51 && callerFilePath.EndsWith("", global::System.StringComparison.OrdinalIgnoreCase)) { return __WhenChanging_7FFFD2B6A9CCF5C7(objectToMonitor); } diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/BindingTypeConverterTryConvertTypedTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/BindingTypeConverterTryConvertTypedTests.cs index 82983e3f..74588317 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/BindingTypeConverterTryConvertTypedTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/BindingTypeConverterTryConvertTypedTests.cs @@ -2,6 +2,8 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; + namespace ReactiveUI.Binding.Tests.Bindings; /// Unit tests for to ensure coverage of the base class dispatch path. @@ -49,120 +51,140 @@ public class BindingTypeConverterTryConvertTypedTests /// Verifies ByteToStringTypeConverter converts a byte value to its string representation. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task ByteToString_Success() => AssertConverterSuccess(new ByteToStringTypeConverter(), ByteValue, "42"); /// Verifies ByteToStringTypeConverter fails when given a wrong type. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task ByteToString_Failure_WrongType() => AssertConverterFailure(new ByteToStringTypeConverter(), WrongTypeInput); /// Verifies ByteToStringTypeConverter fails when given null. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task ByteToString_Failure_Null() => AssertConverterFailure(new ByteToStringTypeConverter(), null); /// Verifies IntegerToStringTypeConverter converts an int value to its string representation. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task IntegerToString_Success() => AssertConverterSuccess(new IntegerToStringTypeConverter(), IntValue, "123"); /// Verifies IntegerToStringTypeConverter fails when given a wrong type. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task IntegerToString_Failure_WrongType() => AssertConverterFailure(new IntegerToStringTypeConverter(), WrongTypeInput); /// Verifies IntegerToStringTypeConverter fails when given null. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task IntegerToString_Failure_Null() => AssertConverterFailure(new IntegerToStringTypeConverter(), null); /// Verifies StringToIntegerTypeConverter converts a string to an int. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToInteger_Success() => AssertConverterSuccess(new StringToIntegerTypeConverter(), "456", ParsedIntValue); /// Verifies BooleanToStringTypeConverter converts true to "True". /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task BooleanToString_Success() => AssertConverterSuccess(new BooleanToStringTypeConverter(), true, "True"); /// Verifies DoubleToStringTypeConverter converts a double to its string representation. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task DoubleToString_Success() => AssertConverterSuccess(new DoubleToStringTypeConverter(), DoubleValue, DoubleValue.ToString(System.Globalization.CultureInfo.CurrentCulture)); /// Verifies DoubleToStringTypeConverter fails when given a wrong type. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task DoubleToString_Failure_WrongType() => AssertConverterFailure(new DoubleToStringTypeConverter(), WrongTypeInput); /// Verifies DoubleToStringTypeConverter fails when given null. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task DoubleToString_Failure_Null() => AssertConverterFailure(new DoubleToStringTypeConverter(), null); /// Verifies LongToStringTypeConverter converts a long to its string representation. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task LongToString_Success() => AssertConverterSuccess(new LongToStringTypeConverter(), LongValue, "9876543210"); /// Verifies LongToStringTypeConverter fails when given a wrong type. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task LongToString_Failure_WrongType() => AssertConverterFailure(new LongToStringTypeConverter(), WrongTypeInput); /// Verifies LongToStringTypeConverter fails when given null. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task LongToString_Failure_Null() => AssertConverterFailure(new LongToStringTypeConverter(), null); /// Verifies ShortToStringTypeConverter converts a short to its string representation. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task ShortToString_Success() => AssertConverterSuccess(new ShortToStringTypeConverter(), ShortValue, "321"); /// Verifies ShortToStringTypeConverter fails when given a wrong type. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task ShortToString_Failure_WrongType() => AssertConverterFailure(new ShortToStringTypeConverter(), WrongTypeInput); /// Verifies ShortToStringTypeConverter fails when given null. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task ShortToString_Failure_Null() => AssertConverterFailure(new ShortToStringTypeConverter(), null); /// Verifies SingleToStringTypeConverter converts a float to its string representation. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task SingleToString_Success() => AssertConverterSuccess(new SingleToStringTypeConverter(), SingleValue, SingleValue.ToString(System.Globalization.CultureInfo.CurrentCulture)); /// Verifies SingleToStringTypeConverter fails when given a wrong type. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task SingleToString_Failure_WrongType() => AssertConverterFailure(new SingleToStringTypeConverter(), WrongTypeInput); /// Verifies SingleToStringTypeConverter fails when given null. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task SingleToString_Failure_Null() => AssertConverterFailure(new SingleToStringTypeConverter(), null); @@ -172,126 +194,147 @@ public Task SingleToString_Failure_Null() => /// Verifies NullableByteToStringTypeConverter converts a byte to its string representation. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableByteToString_Success() => AssertConverterSuccess(new NullableByteToStringTypeConverter(), ByteValue, "42"); /// Verifies NullableByteToStringTypeConverter fails when given a wrong type. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableByteToString_Failure_WrongType() => AssertConverterFailure(new NullableByteToStringTypeConverter(), WrongTypeInput); /// Verifies NullableByteToStringTypeConverter succeeds when given null. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableByteToString_Success_Null() => AssertConverterSuccess(new NullableByteToStringTypeConverter(), null, null); /// Verifies NullableDecimalToStringTypeConverter converts a decimal to its string representation. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableDecimalToString_Success() => AssertConverterSuccess(new NullableDecimalToStringTypeConverter(), DecimalValue, DecimalValue.ToString(System.Globalization.CultureInfo.CurrentCulture)); /// Verifies NullableDecimalToStringTypeConverter fails when given a wrong type. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableDecimalToString_Failure_WrongType() => AssertConverterFailure(new NullableDecimalToStringTypeConverter(), WrongTypeInput); /// Verifies NullableDecimalToStringTypeConverter succeeds when given null. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableDecimalToString_Success_Null() => AssertConverterSuccess(new NullableDecimalToStringTypeConverter(), null, null); /// Verifies NullableDoubleToStringTypeConverter converts a double to its string representation. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableDoubleToString_Success() => AssertConverterSuccess(new NullableDoubleToStringTypeConverter(), EulerDoubleValue, EulerDoubleValue.ToString(System.Globalization.CultureInfo.CurrentCulture)); /// Verifies NullableDoubleToStringTypeConverter fails when given a wrong type. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableDoubleToString_Failure_WrongType() => AssertConverterFailure(new NullableDoubleToStringTypeConverter(), WrongTypeInput); /// Verifies NullableDoubleToStringTypeConverter succeeds when given null. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableDoubleToString_Success_Null() => AssertConverterSuccess(new NullableDoubleToStringTypeConverter(), null, null); /// Verifies NullableIntegerToStringTypeConverter converts an int to its string representation. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableIntegerToString_Success() => AssertConverterSuccess(new NullableIntegerToStringTypeConverter(), IntValue, "123"); /// Verifies NullableIntegerToStringTypeConverter fails when given a wrong type. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableIntegerToString_Failure_WrongType() => AssertConverterFailure(new NullableIntegerToStringTypeConverter(), WrongTypeInput); /// Verifies NullableIntegerToStringTypeConverter succeeds when given null. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableIntegerToString_Success_Null() => AssertConverterSuccess(new NullableIntegerToStringTypeConverter(), null, null); /// Verifies NullableLongToStringTypeConverter converts a long to its string representation. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableLongToString_Success() => AssertConverterSuccess(new NullableLongToStringTypeConverter(), LongValue, "9876543210"); /// Verifies NullableLongToStringTypeConverter fails when given a wrong type. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableLongToString_Failure_WrongType() => AssertConverterFailure(new NullableLongToStringTypeConverter(), WrongTypeInput); /// Verifies NullableLongToStringTypeConverter succeeds when given null. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableLongToString_Success_Null() => AssertConverterSuccess(new NullableLongToStringTypeConverter(), null, null); /// Verifies NullableShortToStringTypeConverter converts a short to its string representation. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableShortToString_Success() => AssertConverterSuccess(new NullableShortToStringTypeConverter(), ShortValue, "321"); /// Verifies NullableShortToStringTypeConverter fails when given a wrong type. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableShortToString_Failure_WrongType() => AssertConverterFailure(new NullableShortToStringTypeConverter(), WrongTypeInput); /// Verifies NullableShortToStringTypeConverter succeeds when given null. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableShortToString_Success_Null() => AssertConverterSuccess(new NullableShortToStringTypeConverter(), null, null); /// Verifies NullableSingleToStringTypeConverter converts a float to its string representation. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableSingleToString_Success() => AssertConverterSuccess(new NullableSingleToStringTypeConverter(), SingleValue, SingleValue.ToString(System.Globalization.CultureInfo.CurrentCulture)); /// Verifies NullableSingleToStringTypeConverter fails when given a wrong type. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableSingleToString_Failure_WrongType() => AssertConverterFailure(new NullableSingleToStringTypeConverter(), WrongTypeInput); /// Verifies NullableSingleToStringTypeConverter succeeds when given null. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableSingleToString_Success_Null() => AssertConverterSuccess(new NullableSingleToStringTypeConverter(), null, null); @@ -301,126 +344,147 @@ public Task NullableSingleToString_Success_Null() => /// Verifies DoubleToNullableDoubleTypeConverter converts a double to nullable double. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task DoubleToNullableDouble_Success() => AssertConverterSuccess(new DoubleToNullableDoubleTypeConverter(), DoubleValue, (double?)DoubleValue); /// Verifies DoubleToNullableDoubleTypeConverter fails when given a wrong type. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task DoubleToNullableDouble_Failure_WrongType() => AssertConverterFailure(new DoubleToNullableDoubleTypeConverter(), WrongTypeInput); /// Verifies DoubleToNullableDoubleTypeConverter fails when given null. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task DoubleToNullableDouble_Failure_Null() => AssertConverterFailure(new DoubleToNullableDoubleTypeConverter(), null); /// Verifies IntegerToNullableIntegerTypeConverter converts an int to nullable int. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task IntegerToNullableInteger_Success() => AssertConverterSuccess(new IntegerToNullableIntegerTypeConverter(), SmallIntValue, (int?)SmallIntValue); /// Verifies IntegerToNullableIntegerTypeConverter fails when given a wrong type. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task IntegerToNullableInteger_Failure_WrongType() => AssertConverterFailure(new IntegerToNullableIntegerTypeConverter(), WrongTypeInput); /// Verifies IntegerToNullableIntegerTypeConverter fails when given null. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task IntegerToNullableInteger_Failure_Null() => AssertConverterFailure(new IntegerToNullableIntegerTypeConverter(), null); /// Verifies ByteToNullableByteTypeConverter converts a byte to nullable byte. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task ByteToNullableByte_Success() => AssertConverterSuccess(new ByteToNullableByteTypeConverter(), SmallByteValue, (byte?)SmallByteValue); /// Verifies ByteToNullableByteTypeConverter fails when given a wrong type. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task ByteToNullableByte_Failure_WrongType() => AssertConverterFailure(new ByteToNullableByteTypeConverter(), WrongTypeInput); /// Verifies ByteToNullableByteTypeConverter fails when given null. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task ByteToNullableByte_Failure_Null() => AssertConverterFailure(new ByteToNullableByteTypeConverter(), null); /// Verifies LongToNullableLongTypeConverter converts a long to nullable long. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task LongToNullableLong_Success() => AssertConverterSuccess(new LongToNullableLongTypeConverter(), LongValue, (long?)LongValue); /// Verifies LongToNullableLongTypeConverter fails when given a wrong type. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task LongToNullableLong_Failure_WrongType() => AssertConverterFailure(new LongToNullableLongTypeConverter(), WrongTypeInput); /// Verifies LongToNullableLongTypeConverter fails when given null. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task LongToNullableLong_Failure_Null() => AssertConverterFailure(new LongToNullableLongTypeConverter(), null); /// Verifies ShortToNullableShortTypeConverter converts a short to nullable short. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task ShortToNullableShort_Success() => AssertConverterSuccess(new ShortToNullableShortTypeConverter(), ShortValue, (short?)ShortValue); /// Verifies ShortToNullableShortTypeConverter fails when given a wrong type. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task ShortToNullableShort_Failure_WrongType() => AssertConverterFailure(new ShortToNullableShortTypeConverter(), WrongTypeInput); /// Verifies ShortToNullableShortTypeConverter fails when given null. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task ShortToNullableShort_Failure_Null() => AssertConverterFailure(new ShortToNullableShortTypeConverter(), null); /// Verifies SingleToNullableSingleTypeConverter converts a float to nullable float. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task SingleToNullableSingle_Success() => AssertConverterSuccess(new SingleToNullableSingleTypeConverter(), SingleValue, (float?)SingleValue); /// Verifies SingleToNullableSingleTypeConverter fails when given a wrong type. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task SingleToNullableSingle_Failure_WrongType() => AssertConverterFailure(new SingleToNullableSingleTypeConverter(), WrongTypeInput); /// Verifies SingleToNullableSingleTypeConverter fails when given null. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task SingleToNullableSingle_Failure_Null() => AssertConverterFailure(new SingleToNullableSingleTypeConverter(), null); /// Verifies DecimalToNullableDecimalTypeConverter converts a decimal to nullable decimal. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task DecimalToNullableDecimal_Success() => AssertConverterSuccess(new DecimalToNullableDecimalTypeConverter(), DecimalValue, (decimal?)DecimalValue); /// Verifies DecimalToNullableDecimalTypeConverter fails when given a wrong type. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task DecimalToNullableDecimal_Failure_WrongType() => AssertConverterFailure(new DecimalToNullableDecimalTypeConverter(), WrongTypeInput); /// Verifies DecimalToNullableDecimalTypeConverter fails when given null. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task DecimalToNullableDecimal_Failure_Null() => AssertConverterFailure(new DecimalToNullableDecimalTypeConverter(), null); @@ -430,126 +494,147 @@ public Task DecimalToNullableDecimal_Failure_Null() => /// Verifies NullableDoubleToDoubleTypeConverter converts a double value successfully. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableDoubleToDouble_Success() => AssertConverterSuccess(new NullableDoubleToDoubleTypeConverter(), DoubleValue, DoubleValue); /// Verifies NullableDoubleToDoubleTypeConverter fails when given a wrong type. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableDoubleToDouble_Failure_WrongType() => AssertConverterFailure(new NullableDoubleToDoubleTypeConverter(), WrongTypeInput); /// Verifies NullableDoubleToDoubleTypeConverter fails when given null. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableDoubleToDouble_Failure_Null() => AssertConverterFailure(new NullableDoubleToDoubleTypeConverter(), null); /// Verifies NullableIntegerToIntegerTypeConverter converts an int value successfully. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableIntegerToInteger_Success() => AssertConverterSuccess(new NullableIntegerToIntegerTypeConverter(), SmallIntValue, SmallIntValue); /// Verifies NullableIntegerToIntegerTypeConverter fails when given a wrong type. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableIntegerToInteger_Failure_WrongType() => AssertConverterFailure(new NullableIntegerToIntegerTypeConverter(), WrongTypeInput); /// Verifies NullableIntegerToIntegerTypeConverter fails when given null. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableIntegerToInteger_Failure_Null() => AssertConverterFailure(new NullableIntegerToIntegerTypeConverter(), null); /// Verifies NullableByteToByteTypeConverter converts a byte value successfully. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableByteToByte_Success() => AssertConverterSuccess(new NullableByteToByteTypeConverter(), SmallByteValue, SmallByteValue); /// Verifies NullableByteToByteTypeConverter fails when given a wrong type. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableByteToByte_Failure_WrongType() => AssertConverterFailure(new NullableByteToByteTypeConverter(), WrongTypeInput); /// Verifies NullableByteToByteTypeConverter fails when given null. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableByteToByte_Failure_Null() => AssertConverterFailure(new NullableByteToByteTypeConverter(), null); /// Verifies NullableLongToLongTypeConverter converts a long value successfully. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableLongToLong_Success() => AssertConverterSuccess(new NullableLongToLongTypeConverter(), LongValue, LongValue); /// Verifies NullableLongToLongTypeConverter fails when given a wrong type. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableLongToLong_Failure_WrongType() => AssertConverterFailure(new NullableLongToLongTypeConverter(), WrongTypeInput); /// Verifies NullableLongToLongTypeConverter fails when given null. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableLongToLong_Failure_Null() => AssertConverterFailure(new NullableLongToLongTypeConverter(), null); /// Verifies NullableShortToShortTypeConverter converts a short value successfully. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableShortToShort_Success() => AssertConverterSuccess(new NullableShortToShortTypeConverter(), ShortValue, ShortValue); /// Verifies NullableShortToShortTypeConverter fails when given a wrong type. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableShortToShort_Failure_WrongType() => AssertConverterFailure(new NullableShortToShortTypeConverter(), WrongTypeInput); /// Verifies NullableShortToShortTypeConverter fails when given null. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableShortToShort_Failure_Null() => AssertConverterFailure(new NullableShortToShortTypeConverter(), null); /// Verifies NullableSingleToSingleTypeConverter converts a float value successfully. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableSingleToSingle_Success() => AssertConverterSuccess(new NullableSingleToSingleTypeConverter(), SingleValue, SingleValue); /// Verifies NullableSingleToSingleTypeConverter fails when given a wrong type. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableSingleToSingle_Failure_WrongType() => AssertConverterFailure(new NullableSingleToSingleTypeConverter(), WrongTypeInput); /// Verifies NullableSingleToSingleTypeConverter fails when given null. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableSingleToSingle_Failure_Null() => AssertConverterFailure(new NullableSingleToSingleTypeConverter(), null); /// Verifies NullableDecimalToDecimalTypeConverter converts a decimal value successfully. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableDecimalToDecimal_Success() => AssertConverterSuccess(new NullableDecimalToDecimalTypeConverter(), DecimalValue, DecimalValue); /// Verifies NullableDecimalToDecimalTypeConverter fails when given a wrong type. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableDecimalToDecimal_Failure_WrongType() => AssertConverterFailure(new NullableDecimalToDecimalTypeConverter(), WrongTypeInput); /// Verifies NullableDecimalToDecimalTypeConverter fails when given null. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableDecimalToDecimal_Failure_Null() => AssertConverterFailure(new NullableDecimalToDecimalTypeConverter(), null); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/BindingTypeConvertersUnitTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/BindingTypeConvertersUnitTests.cs index ef14764b..a8c9b9ea 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/BindingTypeConvertersUnitTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/BindingTypeConvertersUnitTests.cs @@ -79,7 +79,7 @@ public async Task LongToStringTypeConverter_Converts_Correctly() public async Task NullableByteToStringTypeConverter_Converts_Correctly() { var converter = new NullableByteToStringTypeConverter(); - byte? val = 123; + const byte val = 123; // Byte? to String var result = converter.TryConvert(val, null, out var output); @@ -119,7 +119,7 @@ public async Task NullableDoubleToStringTypeConverter_Converts_Correctly() public async Task NullableIntegerToStringTypeConverter_Converts_Correctly() { var converter = new NullableIntegerToStringTypeConverter(); - int? val = 123_456_789; + const int val = 123_456_789; var result = converter.TryConvert(val, null, out var output); await Assert.That(result).IsTrue(); @@ -132,7 +132,7 @@ public async Task NullableIntegerToStringTypeConverter_Converts_Correctly() public async Task NullableLongToStringTypeConverter_Converts_Correctly() { var converter = new NullableLongToStringTypeConverter(); - long? val = 1_234_567_890_123_456_789; + const long val = 1_234_567_890_123_456_789; var result = converter.TryConvert(val, null, out var output); await Assert.That(result).IsTrue(); @@ -145,7 +145,7 @@ public async Task NullableLongToStringTypeConverter_Converts_Correctly() public async Task NullableShortToStringTypeConverter_Converts_Correctly() { var converter = new NullableShortToStringTypeConverter(); - short? val = 12_345; + const short val = 12_345; var result = converter.TryConvert(val, null, out var output); await Assert.That(result).IsTrue(); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/Converters/BindingTypeConverterRegistryTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/Converters/BindingTypeConverterRegistryTests.cs index 3ba80c2f..eb00f743 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/Converters/BindingTypeConverterRegistryTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/Converters/BindingTypeConverterRegistryTests.cs @@ -2,6 +2,8 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; + namespace ReactiveUI.Binding.Tests.Bindings.Converters; /// Tests for the internal method. @@ -12,7 +14,7 @@ public class BindingTypeConverterRegistryTests [Test] public async Task CloneRegistryShallow_EmptyDictionary_ReturnsEmpty() { - var source = new Dictionary<(Type fromType, Type toType), List>(); + var source = new Dictionary<(Type FromType, Type ToType), List>(); var clone = BindingTypeConverterRegistry.CloneRegistryShallow(source); @@ -26,7 +28,7 @@ public async Task CloneRegistryShallow_WithEntries_ReturnsShallowCopy() { var converter = new TestConverter(typeof(string), typeof(int)); var list = new List { converter }; - var source = new Dictionary<(Type fromType, Type toType), List> { [(typeof(string), typeof(int))] = list }; + var source = new Dictionary<(Type FromType, Type ToType), List> { [(typeof(string), typeof(int))] = list }; var clone = BindingTypeConverterRegistry.CloneRegistryShallow(source); @@ -45,7 +47,7 @@ public async Task CloneRegistryShallow_ModifyingClone_DoesNotAffectOriginal() { var converter = new TestConverter(typeof(string), typeof(int)); var list = new List { converter }; - var source = new Dictionary<(Type fromType, Type toType), List> { [(typeof(string), typeof(int))] = list }; + var source = new Dictionary<(Type FromType, Type ToType), List> { [(typeof(string), typeof(int))] = list }; var clone = BindingTypeConverterRegistry.CloneRegistryShallow(source); @@ -79,6 +81,7 @@ private sealed class TestConverter(Type fromType, Type toType) : IBindingTypeCon public Type ToType { get; } = toType; /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public int GetAffinityForObjects() => StubAffinity; /// diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/Converters/ConverterAffinityTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/Converters/ConverterAffinityTests.cs index 0b1d9bf2..0c9f1a17 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/Converters/ConverterAffinityTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/Converters/ConverterAffinityTests.cs @@ -2,6 +2,8 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; + namespace ReactiveUI.Binding.Tests.Bindings.Converters; /// Tests for verifying converter affinity values are correctly set. @@ -16,6 +18,7 @@ public class ConverterAffinityTests /// Verifies that the EqualityTypeConverter has affinity 1 (last resort). /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task EqualityConverter_ShouldHaveAffinity1() => AssertAffinity(new EqualityTypeConverter(), LastResortAffinity); @@ -25,6 +28,7 @@ public Task EqualityConverter_ShouldHaveAffinity1() => /// Verifies that StringConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringConverter_ShouldHaveAffinity2() => AssertAffinity(new StringConverter(), StringConverterAffinity); @@ -34,84 +38,98 @@ public Task StringConverter_ShouldHaveAffinity2() => /// Verifies that ByteToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task ByteToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new ByteToStringTypeConverter(), StringConverterAffinity); /// Verifies that NullableByteToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableByteToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new NullableByteToStringTypeConverter(), StringConverterAffinity); /// Verifies that ShortToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task ShortToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new ShortToStringTypeConverter(), StringConverterAffinity); /// Verifies that NullableShortToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableShortToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new NullableShortToStringTypeConverter(), StringConverterAffinity); /// Verifies that IntegerToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task IntegerToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new IntegerToStringTypeConverter(), StringConverterAffinity); /// Verifies that NullableIntegerToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableIntegerToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new NullableIntegerToStringTypeConverter(), StringConverterAffinity); /// Verifies that LongToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task LongToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new LongToStringTypeConverter(), StringConverterAffinity); /// Verifies that NullableLongToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableLongToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new NullableLongToStringTypeConverter(), StringConverterAffinity); /// Verifies that SingleToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task SingleToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new SingleToStringTypeConverter(), StringConverterAffinity); /// Verifies that NullableSingleToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableSingleToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new NullableSingleToStringTypeConverter(), StringConverterAffinity); /// Verifies that DoubleToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task DoubleToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new DoubleToStringTypeConverter(), StringConverterAffinity); /// Verifies that NullableDoubleToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableDoubleToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new NullableDoubleToStringTypeConverter(), StringConverterAffinity); /// Verifies that DecimalToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task DecimalToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new DecimalToStringTypeConverter(), StringConverterAffinity); /// Verifies that NullableDecimalToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableDecimalToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new NullableDecimalToStringTypeConverter(), StringConverterAffinity); @@ -121,84 +139,98 @@ public Task NullableDecimalToStringTypeConverter_ShouldHaveAffinity2() => /// Verifies that StringToByteTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToByteTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToByteTypeConverter(), StringConverterAffinity); /// Verifies that StringToNullableByteTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToNullableByteTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToNullableByteTypeConverter(), StringConverterAffinity); /// Verifies that StringToShortTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToShortTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToShortTypeConverter(), StringConverterAffinity); /// Verifies that StringToNullableShortTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToNullableShortTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToNullableShortTypeConverter(), StringConverterAffinity); /// Verifies that StringToIntegerTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToIntegerTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToIntegerTypeConverter(), StringConverterAffinity); /// Verifies that StringToNullableIntegerTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToNullableIntegerTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToNullableIntegerTypeConverter(), StringConverterAffinity); /// Verifies that StringToLongTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToLongTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToLongTypeConverter(), StringConverterAffinity); /// Verifies that StringToNullableLongTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToNullableLongTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToNullableLongTypeConverter(), StringConverterAffinity); /// Verifies that StringToSingleTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToSingleTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToSingleTypeConverter(), StringConverterAffinity); /// Verifies that StringToNullableSingleTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToNullableSingleTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToNullableSingleTypeConverter(), StringConverterAffinity); /// Verifies that StringToDoubleTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToDoubleTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToDoubleTypeConverter(), StringConverterAffinity); /// Verifies that StringToNullableDoubleTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToNullableDoubleTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToNullableDoubleTypeConverter(), StringConverterAffinity); /// Verifies that StringToDecimalTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToDecimalTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToDecimalTypeConverter(), StringConverterAffinity); /// Verifies that StringToNullableDecimalTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToNullableDecimalTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToNullableDecimalTypeConverter(), StringConverterAffinity); @@ -208,24 +240,28 @@ public Task StringToNullableDecimalTypeConverter_ShouldHaveAffinity2() => /// Verifies that BooleanToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task BooleanToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new BooleanToStringTypeConverter(), StringConverterAffinity); /// Verifies that NullableBooleanToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableBooleanToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new NullableBooleanToStringTypeConverter(), StringConverterAffinity); /// Verifies that StringToBooleanTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToBooleanTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToBooleanTypeConverter(), StringConverterAffinity); /// Verifies that StringToNullableBooleanTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToNullableBooleanTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToNullableBooleanTypeConverter(), StringConverterAffinity); @@ -235,24 +271,28 @@ public Task StringToNullableBooleanTypeConverter_ShouldHaveAffinity2() => /// Verifies that GuidToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task GuidToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new GuidToStringTypeConverter(), StringConverterAffinity); /// Verifies that NullableGuidToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableGuidToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new NullableGuidToStringTypeConverter(), StringConverterAffinity); /// Verifies that StringToGuidTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToGuidTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToGuidTypeConverter(), StringConverterAffinity); /// Verifies that StringToNullableGuidTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToNullableGuidTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToNullableGuidTypeConverter(), StringConverterAffinity); @@ -262,24 +302,28 @@ public Task StringToNullableGuidTypeConverter_ShouldHaveAffinity2() => /// Verifies that DateTimeToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task DateTimeToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new DateTimeToStringTypeConverter(), StringConverterAffinity); /// Verifies that NullableDateTimeToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableDateTimeToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new NullableDateTimeToStringTypeConverter(), StringConverterAffinity); /// Verifies that StringToDateTimeTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToDateTimeTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToDateTimeTypeConverter(), StringConverterAffinity); /// Verifies that StringToNullableDateTimeTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToNullableDateTimeTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToNullableDateTimeTypeConverter(), StringConverterAffinity); @@ -289,24 +333,28 @@ public Task StringToNullableDateTimeTypeConverter_ShouldHaveAffinity2() => /// Verifies that DateTimeOffsetToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task DateTimeOffsetToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new DateTimeOffsetToStringTypeConverter(), StringConverterAffinity); /// Verifies that NullableDateTimeOffsetToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableDateTimeOffsetToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new NullableDateTimeOffsetToStringTypeConverter(), StringConverterAffinity); /// Verifies that StringToDateTimeOffsetTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToDateTimeOffsetTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToDateTimeOffsetTypeConverter(), StringConverterAffinity); /// Verifies that StringToNullableDateTimeOffsetTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToNullableDateTimeOffsetTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToNullableDateTimeOffsetTypeConverter(), StringConverterAffinity); @@ -316,24 +364,28 @@ public Task StringToNullableDateTimeOffsetTypeConverter_ShouldHaveAffinity2() => /// Verifies that TimeSpanToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task TimeSpanToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new TimeSpanToStringTypeConverter(), StringConverterAffinity); /// Verifies that NullableTimeSpanToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableTimeSpanToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new NullableTimeSpanToStringTypeConverter(), StringConverterAffinity); /// Verifies that StringToTimeSpanTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToTimeSpanTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToTimeSpanTypeConverter(), StringConverterAffinity); /// Verifies that StringToNullableTimeSpanTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToNullableTimeSpanTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToNullableTimeSpanTypeConverter(), StringConverterAffinity); @@ -343,24 +395,28 @@ public Task StringToNullableTimeSpanTypeConverter_ShouldHaveAffinity2() => /// Verifies that DateOnlyToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task DateOnlyToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new DateOnlyToStringTypeConverter(), StringConverterAffinity); /// Verifies that NullableDateOnlyToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableDateOnlyToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new NullableDateOnlyToStringTypeConverter(), StringConverterAffinity); /// Verifies that StringToDateOnlyTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToDateOnlyTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToDateOnlyTypeConverter(), StringConverterAffinity); /// Verifies that StringToNullableDateOnlyTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToNullableDateOnlyTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToNullableDateOnlyTypeConverter(), StringConverterAffinity); @@ -370,24 +426,28 @@ public Task StringToNullableDateOnlyTypeConverter_ShouldHaveAffinity2() => /// Verifies that TimeOnlyToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task TimeOnlyToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new TimeOnlyToStringTypeConverter(), StringConverterAffinity); /// Verifies that NullableTimeOnlyToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task NullableTimeOnlyToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new NullableTimeOnlyToStringTypeConverter(), StringConverterAffinity); /// Verifies that StringToTimeOnlyTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToTimeOnlyTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToTimeOnlyTypeConverter(), StringConverterAffinity); /// Verifies that StringToNullableTimeOnlyTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToNullableTimeOnlyTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToNullableTimeOnlyTypeConverter(), StringConverterAffinity); @@ -397,12 +457,14 @@ public Task StringToNullableTimeOnlyTypeConverter_ShouldHaveAffinity2() => /// Verifies that UriToStringTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task UriToStringTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new UriToStringTypeConverter(), StringConverterAffinity); /// Verifies that StringToUriTypeConverter has affinity 2. /// A task representing the asynchronous test operation. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Task StringToUriTypeConverter_ShouldHaveAffinity2() => AssertAffinity(new StringToUriTypeConverter(), StringConverterAffinity); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/Converters/ConverterMigrationHelperTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/Converters/ConverterMigrationHelperTests.cs index 97c2fcab..6f552dee 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/Converters/ConverterMigrationHelperTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/Converters/ConverterMigrationHelperTests.cs @@ -2,6 +2,8 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; + namespace ReactiveUI.Binding.Tests.Bindings.Converters; /// @@ -299,18 +301,23 @@ private sealed class TestDependencyResolver : IReadonlyDependencyResolver /// Registers a service instance for later resolution. /// The service type to register. /// The service instance to register. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void RegisterService(T? service) => _services.Add(service!); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public object? GetService(Type? serviceType) => _services.FirstOrDefault(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public object? GetService(Type? serviceType, string? contract) => _services.FirstOrDefault(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public T? GetService() => _services.OfType().FirstOrDefault(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public T? GetService(string? contract) => _services.OfType().FirstOrDefault(); /// @@ -321,9 +328,11 @@ public IEnumerable GetServices(Type? serviceType, string? contract) => _services.Where(static s => s is not null)!; /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public IEnumerable GetServices() => _services.OfType(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public IEnumerable GetServices(string? contract) => _services.OfType(); } @@ -349,6 +358,7 @@ public override bool TryConvert(TFrom? from, object? conversionHint, [NotNullWhe private sealed class TestFallbackConverter(int affinity) : IBindingFallbackConverter { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public int GetAffinityForObjects(Type fromType, Type toType) => affinity; /// @@ -376,9 +386,11 @@ private sealed class TestSetMethodConverter(int affinity) : ISetMethodBindingCon private readonly int _affinity = affinity; /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public int GetAffinityForObjects(Type? fromType, Type? toType) => _affinity; /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public object? PerformSet(object? toTarget, object? newValue, object?[]? arguments) => null; } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/Converters/ConverterRegistryTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/Converters/ConverterRegistryTests.cs index ed234c10..72562d3a 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/Converters/ConverterRegistryTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/Converters/ConverterRegistryTests.cs @@ -2,6 +2,8 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; + namespace ReactiveUI.Binding.Tests.Bindings.Converters; /// @@ -376,6 +378,7 @@ public override bool TryConvert(TFrom? from, object? conversionHint, [NotNullWhe private sealed class TestFallbackConverter(int baseAffinity) : IBindingFallbackConverter { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public int GetAffinityForObjects( [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type fromType, @@ -402,9 +405,11 @@ public bool TryConvert( private sealed class TestSetMethodConverter(int baseAffinity) : ISetMethodBindingConverter { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public int GetAffinityForObjects(Type? fromType, Type? toType) => baseAffinity; /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public object? PerformSet(object? toTarget, object? newValue, object?[]? arguments) => newValue; } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/Converters/ConverterServiceIntegrationTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/Converters/ConverterServiceIntegrationTests.cs index 6003ab6e..b23e950f 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/Converters/ConverterServiceIntegrationTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/Converters/ConverterServiceIntegrationTests.cs @@ -2,6 +2,8 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; + namespace ReactiveUI.Binding.Tests.Bindings.Converters; /// @@ -229,6 +231,7 @@ public async Task ZeroAffinityConverter_ShouldBeIgnoredInResolution() private sealed class TestFallbackConverter(int baseAffinity) : IBindingFallbackConverter { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public int GetAffinityForObjects( [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type fromType, @@ -255,9 +258,11 @@ public bool TryConvert( private sealed class TestSetMethodConverter(int baseAffinity) : ISetMethodBindingConverter { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public int GetAffinityForObjects(Type? fromType, Type? toType) => baseAffinity; /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public object? PerformSet(object? toTarget, object? newValue, object?[]? arguments) => newValue; } diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/ReactiveBindingTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/ReactiveBindingTests.cs index d479ff14..8e64ef8c 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/ReactiveBindingTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/ReactiveBindingTests.cs @@ -59,13 +59,12 @@ public async Task Properties_ReturnConstructorValues() { var view = new FakeView(); var changed = Observable.Empty(); - var subscription = Disposable.Empty; var binding = new ReactiveBinding( view, changed, BindingDirection.TwoWay, - subscription); + Disposable.Empty); await Assert.That(binding.View).IsEqualTo(view); await Assert.That(binding.Direction).IsEqualTo(BindingDirection.TwoWay); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/DateOnlyToStringTypeConverterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/DateOnlyToStringTypeConverterTests.cs index 93f5f893..e8a3ce61 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/DateOnlyToStringTypeConverterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/DateOnlyToStringTypeConverterTests.cs @@ -47,9 +47,7 @@ public async Task TryConvert_DateOnly_Succeeds() public async Task TryConvert_MinValue_Succeeds() { var converter = new DateOnlyToStringTypeConverter(); - var value = DateOnly.MinValue; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(DateOnly.MinValue, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo(DateOnly.MinValue.ToString()); @@ -61,9 +59,7 @@ public async Task TryConvert_MinValue_Succeeds() public async Task TryConvert_MaxValue_Succeeds() { var converter = new DateOnlyToStringTypeConverter(); - var value = DateOnly.MaxValue; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(DateOnly.MaxValue, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo(DateOnly.MaxValue.ToString()); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/DateTimeOffsetToStringTypeConverterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/DateTimeOffsetToStringTypeConverterTests.cs index 823ee5b6..d8bcfd1c 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/DateTimeOffsetToStringTypeConverterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/DateTimeOffsetToStringTypeConverterTests.cs @@ -43,9 +43,7 @@ public async Task TryConvert_DateTimeOffset_Succeeds() public async Task TryConvert_MinValue_Succeeds() { var converter = new DateTimeOffsetToStringTypeConverter(); - var value = DateTimeOffset.MinValue; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(DateTimeOffset.MinValue, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo(DateTimeOffset.MinValue.ToString()); @@ -57,9 +55,7 @@ public async Task TryConvert_MinValue_Succeeds() public async Task TryConvert_MaxValue_Succeeds() { var converter = new DateTimeOffsetToStringTypeConverter(); - var value = DateTimeOffset.MaxValue; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(DateTimeOffset.MaxValue, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo(DateTimeOffset.MaxValue.ToString()); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/DateTimeToStringTypeConverterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/DateTimeToStringTypeConverterTests.cs index 07d2bc37..a0b1680e 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/DateTimeToStringTypeConverterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/DateTimeToStringTypeConverterTests.cs @@ -42,9 +42,7 @@ public async Task TryConvert_DateTime_Succeeds() public async Task TryConvert_MinValue_Succeeds() { var converter = new DateTimeToStringTypeConverter(); - var value = DateTime.MinValue; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(DateTime.MinValue, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo(DateTime.MinValue.ToString(CultureInfo.CurrentCulture)); @@ -56,9 +54,7 @@ public async Task TryConvert_MinValue_Succeeds() public async Task TryConvert_MaxValue_Succeeds() { var converter = new DateTimeToStringTypeConverter(); - var value = DateTime.MaxValue; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(DateTime.MaxValue, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo(DateTime.MaxValue.ToString(CultureInfo.CurrentCulture)); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/GuidToStringTypeConverterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/GuidToStringTypeConverterTests.cs index 78777f62..f8a7ba09 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/GuidToStringTypeConverterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/GuidToStringTypeConverterTests.cs @@ -40,9 +40,7 @@ public async Task TryConvert_Guid_Succeeds() public async Task TryConvert_EmptyGuid_Succeeds() { var converter = new GuidToStringTypeConverter(); - var value = Guid.Empty; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(Guid.Empty, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo("00000000-0000-0000-0000-000000000000"); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableBooleanToStringTypeConverterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableBooleanToStringTypeConverterTests.cs index f4d3e9fe..2b23393f 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableBooleanToStringTypeConverterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableBooleanToStringTypeConverterTests.cs @@ -26,9 +26,7 @@ public async Task GetAffinityForObjects_Returns2() public async Task TryConvert_True_ReturnsTrue() { var converter = new NullableBooleanToStringTypeConverter(); - bool? value = true; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(true, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo("True"); @@ -40,9 +38,7 @@ public async Task TryConvert_True_ReturnsTrue() public async Task TryConvert_False_ReturnsFalse() { var converter = new NullableBooleanToStringTypeConverter(); - bool? value = false; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(false, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo("False"); @@ -54,9 +50,7 @@ public async Task TryConvert_False_ReturnsFalse() public async Task TryConvert_Null_ReturnsNullString() { var converter = new NullableBooleanToStringTypeConverter(); - bool? value = null; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(null, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsNull(); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableByteToByteTypeConverterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableByteToByteTypeConverterTests.cs index f264af91..f7a8693d 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableByteToByteTypeConverterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableByteToByteTypeConverterTests.cs @@ -29,9 +29,7 @@ public async Task GetAffinityForObjects_Returns2() public async Task TryConvert_WithValue_Succeeds() { var converter = new NullableByteToByteTypeConverter(); - byte? value = 42; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(SampleByte, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo(SampleByte); @@ -43,8 +41,7 @@ public async Task TryConvert_WithValue_Succeeds() public async Task TryConvert_Null_ReturnsFalse() { var converter = new NullableByteToByteTypeConverter(); - byte? value = null; - var result = converter.TryConvert(value, null, out _); + var result = converter.TryConvert(null, null, out _); await Assert.That(result).IsFalse(); } @@ -73,9 +70,7 @@ public async Task ToType_ReturnsByte() public async Task TryConvertTyped_WithValidValue_ReturnsTrueAndOutput() { var converter = new NullableByteToByteTypeConverter(); - byte? value = 42; - - var success = converter.TryConvertTyped(value, null, out var result); + var success = converter.TryConvertTyped(SampleByte, null, out var result); await Assert.That(success).IsTrue(); await Assert.That(result).IsEqualTo(SampleByte); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableByteToStringTypeConverterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableByteToStringTypeConverterTests.cs index 9d98e0b4..d69698b7 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableByteToStringTypeConverterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableByteToStringTypeConverterTests.cs @@ -13,6 +13,15 @@ public class NullableByteToStringTypeConverterTests /// Expected affinity returned for matched converter type pairs. private const int ExpectedAffinity = 2; + /// Byte value converted with the hexadecimal format hint. + private const byte HexByte = 255; + + /// Byte value narrow enough for the width hint to show its zero padding. + private const byte PaddedByte = 5; + + /// Sample byte value used for conversion round-trips. + private const byte SampleByte = 123; + /// Verifies GetAffinityForObjects Returns2. /// A task representing the asynchronous operation. [Test] @@ -29,9 +38,7 @@ public async Task GetAffinityForObjects_Returns2() public async Task TryConvert_ByteNullableToString_Succeeds() { var converter = new NullableByteToStringTypeConverter(); - byte? value = 123; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(SampleByte, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo("123"); @@ -84,9 +91,7 @@ public async Task TryConvert_NullValue_ReturnsTrue() public async Task TryConvert_WithConversionHint_FormatsCorrectly() { var converter = new NullableByteToStringTypeConverter(); - byte? value = 5; - - var result = converter.TryConvert(value, ConversionHint, out var output); + var result = converter.TryConvert(PaddedByte, ConversionHint, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo("005"); @@ -98,9 +103,7 @@ public async Task TryConvert_WithConversionHint_FormatsCorrectly() public async Task TryConvert_WithStringFormatHint_FormatsCorrectly() { var converter = new NullableByteToStringTypeConverter(); - byte? value = 255; - - var result = converter.TryConvert(value, "X", out var output); + var result = converter.TryConvert(HexByte, "X", out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo("FF"); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDateOnlyToStringTypeConverterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDateOnlyToStringTypeConverterTests.cs index 5e249e45..49e4674f 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDateOnlyToStringTypeConverterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDateOnlyToStringTypeConverterTests.cs @@ -47,9 +47,7 @@ public async Task TryConvert_DateOnly_Succeeds() public async Task TryConvert_Null_ReturnsNullString() { var converter = new NullableDateOnlyToStringTypeConverter(); - DateOnly? value = null; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(null, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsNull(); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDateTimeOffsetToStringTypeConverterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDateTimeOffsetToStringTypeConverterTests.cs index 70b3d274..c4b9a33b 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDateTimeOffsetToStringTypeConverterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDateTimeOffsetToStringTypeConverterTests.cs @@ -43,9 +43,7 @@ public async Task TryConvert_DateTimeOffset_Succeeds() public async Task TryConvert_Null_ReturnsNullString() { var converter = new NullableDateTimeOffsetToStringTypeConverter(); - DateTimeOffset? value = null; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(null, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsNull(); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDateTimeToStringTypeConverterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDateTimeToStringTypeConverterTests.cs index ead7dbf9..202d7a27 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDateTimeToStringTypeConverterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDateTimeToStringTypeConverterTests.cs @@ -40,9 +40,7 @@ public async Task TryConvert_DateTime_Succeeds() public async Task TryConvert_Null_ReturnsNullString() { var converter = new NullableDateTimeToStringTypeConverter(); - DateTime? value = null; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(null, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsNull(); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDecimalToDecimalTypeConverterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDecimalToDecimalTypeConverterTests.cs index 4f623594..ed078edc 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDecimalToDecimalTypeConverterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDecimalToDecimalTypeConverterTests.cs @@ -32,9 +32,7 @@ public async Task GetAffinityForObjects_Returns2() public async Task TryConvert_WithValue_Succeeds() { var converter = new NullableDecimalToDecimalTypeConverter(); - decimal? value = 123.456789M; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(SampleDecimal, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo(SampleDecimal); @@ -46,8 +44,7 @@ public async Task TryConvert_WithValue_Succeeds() public async Task TryConvert_Null_ReturnsFalse() { var converter = new NullableDecimalToDecimalTypeConverter(); - decimal? value = null; - var result = converter.TryConvert(value, null, out _); + var result = converter.TryConvert(null, null, out _); await Assert.That(result).IsFalse(); } @@ -76,9 +73,7 @@ public async Task ToType_ReturnsDecimal() public async Task TryConvertTyped_WithValidValue_ReturnsTrueAndOutput() { var converter = new NullableDecimalToDecimalTypeConverter(); - decimal? value = 42.5M; - - var success = converter.TryConvertTyped(value, null, out var result); + var success = converter.TryConvertTyped(RoundedDecimal, null, out var result); await Assert.That(success).IsTrue(); await Assert.That(result).IsEqualTo(RoundedDecimal); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDecimalToStringTypeConverterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDecimalToStringTypeConverterTests.cs index a2aa0902..adb3b414 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDecimalToStringTypeConverterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDecimalToStringTypeConverterTests.cs @@ -10,6 +10,15 @@ public class NullableDecimalToStringTypeConverterTests /// Expected affinity returned for matched converter type pairs. private const int ExpectedAffinity = 2; + /// Decimal value converted with a width hint that pads it to two decimal places. + private const decimal FormattedDecimal = 42.5M; + + /// Negative decimal value used to check the sign survives conversion. + private const decimal NegativeDecimal = -123.456M; + + /// Sample decimal value used for conversion round-trips. + private const decimal SampleDecimal = 123.456M; + /// Verifies GetAffinityForObjects Returns2. /// A task representing the asynchronous operation. [Test] @@ -26,9 +35,7 @@ public async Task GetAffinityForObjects_Returns2() public async Task TryConvert_DecimalNullableToString_Succeeds() { var converter = new NullableDecimalToStringTypeConverter(); - decimal? value = 123.456M; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(SampleDecimal, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo("123.456"); @@ -68,9 +75,7 @@ public async Task TryConvert_MinValue_Succeeds() public async Task TryConvert_NegativeValue_Succeeds() { var converter = new NullableDecimalToStringTypeConverter(); - decimal? value = -123.456M; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(NegativeDecimal, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo("-123.456"); @@ -93,9 +98,7 @@ public async Task TryConvert_NullValue_ReturnsTrue() public async Task TryConvert_WithConversionHint_FormatsCorrectly() { var converter = new NullableDecimalToStringTypeConverter(); - decimal? value = 42.5M; - - var result = converter.TryConvert(value, ExpectedAffinity, out var output); + var result = converter.TryConvert(FormattedDecimal, ExpectedAffinity, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo("42.50"); @@ -107,9 +110,7 @@ public async Task TryConvert_WithConversionHint_FormatsCorrectly() public async Task TryConvert_Zero_Succeeds() { var converter = new NullableDecimalToStringTypeConverter(); - decimal? value = 0M; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(0M, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo("0"); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDoubleToDoubleTypeConverterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDoubleToDoubleTypeConverterTests.cs index fe0e1d7f..0ee63e0e 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDoubleToDoubleTypeConverterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDoubleToDoubleTypeConverterTests.cs @@ -29,9 +29,7 @@ public async Task GetAffinityForObjects_Returns2() public async Task TryConvert_WithValue_Succeeds() { var converter = new NullableDoubleToDoubleTypeConverter(); - double? value = 123.456789; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(SampleDouble, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo(SampleDouble); @@ -43,8 +41,7 @@ public async Task TryConvert_WithValue_Succeeds() public async Task TryConvert_Null_ReturnsFalse() { var converter = new NullableDoubleToDoubleTypeConverter(); - double? value = null; - var result = converter.TryConvert(value, null, out _); + var result = converter.TryConvert(null, null, out _); await Assert.That(result).IsFalse(); } diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDoubleToStringTypeConverterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDoubleToStringTypeConverterTests.cs index 23a6a24e..89121044 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDoubleToStringTypeConverterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableDoubleToStringTypeConverterTests.cs @@ -10,6 +10,9 @@ public class NullableDoubleToStringTypeConverterTests /// Expected affinity returned for matched converter type pairs. private const int ExpectedAffinity = 2; + /// Double value converted with a width hint that pads it to two decimal places. + private const double FormattedDouble = 42.5; + /// Verifies GetAffinityForObjects Returns2. /// A task representing the asynchronous operation. [Test] @@ -93,9 +96,7 @@ public async Task TryConvert_NullValue_ReturnsTrue() public async Task TryConvert_WithConversionHint_FormatsCorrectly() { var converter = new NullableDoubleToStringTypeConverter(); - double? value = 42.5; - - var result = converter.TryConvert(value, ExpectedAffinity, out var output); + var result = converter.TryConvert(FormattedDouble, ExpectedAffinity, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo("42.50"); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableGuidToStringTypeConverterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableGuidToStringTypeConverterTests.cs index 3955cce4..dd4801e3 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableGuidToStringTypeConverterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableGuidToStringTypeConverterTests.cs @@ -40,9 +40,7 @@ public async Task TryConvert_Guid_Succeeds() public async Task TryConvert_Null_ReturnsNullString() { var converter = new NullableGuidToStringTypeConverter(); - Guid? value = null; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(null, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsNull(); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableIntegerToIntegerTypeConverterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableIntegerToIntegerTypeConverterTests.cs index 9844fa67..cc0e865c 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableIntegerToIntegerTypeConverterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableIntegerToIntegerTypeConverterTests.cs @@ -32,9 +32,7 @@ public async Task GetAffinityForObjects_Returns2() public async Task TryConvert_WithValue_Succeeds() { var converter = new NullableIntegerToIntegerTypeConverter(); - int? value = 123_456; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(SampleInteger, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo(SampleInteger); @@ -46,8 +44,7 @@ public async Task TryConvert_WithValue_Succeeds() public async Task TryConvert_Null_ReturnsFalse() { var converter = new NullableIntegerToIntegerTypeConverter(); - int? value = null; - var result = converter.TryConvert(value, null, out _); + var result = converter.TryConvert(null, null, out _); await Assert.That(result).IsFalse(); } @@ -76,9 +73,7 @@ public async Task ToType_ReturnsInt() public async Task TryConvertTyped_WithValidValue_ReturnsTrueAndOutput() { var converter = new NullableIntegerToIntegerTypeConverter(); - int? value = 42; - - var success = converter.TryConvertTyped(value, null, out var result); + var success = converter.TryConvertTyped(SmallInteger, null, out var result); await Assert.That(success).IsTrue(); await Assert.That(result).IsEqualTo(SmallInteger); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableIntegerToStringTypeConverterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableIntegerToStringTypeConverterTests.cs index ff24c1d4..96fc6074 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableIntegerToStringTypeConverterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableIntegerToStringTypeConverterTests.cs @@ -13,6 +13,15 @@ public class NullableIntegerToStringTypeConverterTests /// Expected affinity returned for matched converter type pairs. private const int ExpectedAffinity = 2; + /// Integer value converted with the hexadecimal format hint. + private const int HexInteger = 255; + + /// Integer value narrow enough for the width hint to show its zero padding. + private const int PaddedInteger = 42; + + /// Sample integer value used for conversion round-trips. + private const int SampleInteger = 123_456; + /// Verifies GetAffinityForObjects Returns2. /// A task representing the asynchronous operation. [Test] @@ -29,9 +38,7 @@ public async Task GetAffinityForObjects_Returns2() public async Task TryConvert_IntNullableToString_Succeeds() { var converter = new NullableIntegerToStringTypeConverter(); - int? value = 123_456; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(SampleInteger, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo("123456"); @@ -82,9 +89,7 @@ public async Task TryConvert_NullValue_ReturnsTrue() public async Task TryConvert_WithConversionHint_FormatsCorrectly() { var converter = new NullableIntegerToStringTypeConverter(); - int? value = 42; - - var result = converter.TryConvert(value, ConversionHint, out var output); + var result = converter.TryConvert(PaddedInteger, ConversionHint, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo("00000042"); @@ -96,9 +101,7 @@ public async Task TryConvert_WithConversionHint_FormatsCorrectly() public async Task TryConvert_WithStringFormatHint_FormatsCorrectly() { var converter = new NullableIntegerToStringTypeConverter(); - int? value = 255; - - var result = converter.TryConvert(value, "X", out var output); + var result = converter.TryConvert(HexInteger, "X", out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo("FF"); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableLongToLongTypeConverterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableLongToLongTypeConverterTests.cs index 525b5a38..962e2b77 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableLongToLongTypeConverterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableLongToLongTypeConverterTests.cs @@ -32,9 +32,7 @@ public async Task GetAffinityForObjects_Returns2() public async Task TryConvert_WithValue_Succeeds() { var converter = new NullableLongToLongTypeConverter(); - long? value = 1_234_567_890_123_456L; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(SampleLong, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo(SampleLong); @@ -46,8 +44,7 @@ public async Task TryConvert_WithValue_Succeeds() public async Task TryConvert_Null_ReturnsFalse() { var converter = new NullableLongToLongTypeConverter(); - long? value = null; - var result = converter.TryConvert(value, null, out _); + var result = converter.TryConvert(null, null, out _); await Assert.That(result).IsFalse(); } @@ -76,9 +73,7 @@ public async Task ToType_ReturnsLong() public async Task TryConvertTyped_WithValidValue_ReturnsTrueAndOutput() { var converter = new NullableLongToLongTypeConverter(); - long? value = 42L; - - var success = converter.TryConvertTyped(value, null, out var result); + var success = converter.TryConvertTyped(SmallLong, null, out var result); await Assert.That(success).IsTrue(); await Assert.That(result).IsEqualTo(SmallLong); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableLongToStringTypeConverterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableLongToStringTypeConverterTests.cs index d128fbba..544cbadf 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableLongToStringTypeConverterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableLongToStringTypeConverterTests.cs @@ -13,6 +13,15 @@ public class NullableLongToStringTypeConverterTests /// Expected affinity returned for matched converter type pairs. private const int ExpectedAffinity = 2; + /// Long value converted with the hexadecimal format hint. + private const long HexLong = 255L; + + /// Long value narrow enough for the width hint to show its zero padding. + private const long PaddedLong = 42L; + + /// Sample long value used for conversion round-trips. + private const long SampleLong = 123_456_789_012L; + /// Verifies GetAffinityForObjects Returns2. /// A task representing the asynchronous operation. [Test] @@ -29,9 +38,7 @@ public async Task GetAffinityForObjects_Returns2() public async Task TryConvert_LongNullableToString_Succeeds() { var converter = new NullableLongToStringTypeConverter(); - long? value = 123_456_789_012; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(SampleLong, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo("123456789012"); @@ -82,9 +89,7 @@ public async Task TryConvert_NullValue_ReturnsTrue() public async Task TryConvert_WithConversionHint_FormatsCorrectly() { var converter = new NullableLongToStringTypeConverter(); - long? value = 42; - - var result = converter.TryConvert(value, ConversionHint, out var output); + var result = converter.TryConvert(PaddedLong, ConversionHint, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo("0000000042"); @@ -96,9 +101,7 @@ public async Task TryConvert_WithConversionHint_FormatsCorrectly() public async Task TryConvert_WithStringFormatHint_FormatsCorrectly() { var converter = new NullableLongToStringTypeConverter(); - long? value = 255; - - var result = converter.TryConvert(value, "X", out var output); + var result = converter.TryConvert(HexLong, "X", out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo("FF"); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableShortToShortTypeConverterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableShortToShortTypeConverterTests.cs index d0f458f5..0fc450eb 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableShortToShortTypeConverterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableShortToShortTypeConverterTests.cs @@ -32,9 +32,7 @@ public async Task GetAffinityForObjects_Returns2() public async Task TryConvert_WithValue_Succeeds() { var converter = new NullableShortToShortTypeConverter(); - short? value = 1_234; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(SampleShort, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo(SampleShort); @@ -46,8 +44,7 @@ public async Task TryConvert_WithValue_Succeeds() public async Task TryConvert_Null_ReturnsFalse() { var converter = new NullableShortToShortTypeConverter(); - short? value = null; - var result = converter.TryConvert(value, null, out _); + var result = converter.TryConvert(null, null, out _); await Assert.That(result).IsFalse(); } @@ -76,9 +73,7 @@ public async Task ToType_ReturnsShort() public async Task TryConvertTyped_WithValidValue_ReturnsTrueAndOutput() { var converter = new NullableShortToShortTypeConverter(); - short? value = 42; - - var success = converter.TryConvertTyped(value, null, out var result); + var success = converter.TryConvertTyped(SmallShort, null, out var result); await Assert.That(success).IsTrue(); await Assert.That(result).IsEqualTo(SmallShort); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableShortToStringTypeConverterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableShortToStringTypeConverterTests.cs index a8ffc81c..66afc305 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableShortToStringTypeConverterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableShortToStringTypeConverterTests.cs @@ -13,6 +13,15 @@ public class NullableShortToStringTypeConverterTests /// Expected affinity returned for matched converter type pairs. private const int ExpectedAffinity = 2; + /// Short value converted with the hexadecimal format hint. + private const short HexShort = 255; + + /// Short value narrow enough for the width hint to show its zero padding. + private const short PaddedShort = 42; + + /// Sample short value used for conversion round-trips. + private const short SampleShort = 12_345; + /// Verifies GetAffinityForObjects Returns2. /// A task representing the asynchronous operation. [Test] @@ -68,9 +77,7 @@ public async Task TryConvert_NullValue_ReturnsTrue() public async Task TryConvert_ShortNullableToString_Succeeds() { var converter = new NullableShortToStringTypeConverter(); - short? value = 12_345; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(SampleShort, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo("12345"); @@ -82,9 +89,7 @@ public async Task TryConvert_ShortNullableToString_Succeeds() public async Task TryConvert_WithConversionHint_FormatsCorrectly() { var converter = new NullableShortToStringTypeConverter(); - short? value = 42; - - var result = converter.TryConvert(value, ConversionHint, out var output); + var result = converter.TryConvert(PaddedShort, ConversionHint, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo("00042"); @@ -96,9 +101,7 @@ public async Task TryConvert_WithConversionHint_FormatsCorrectly() public async Task TryConvert_WithStringFormatHint_FormatsCorrectly() { var converter = new NullableShortToStringTypeConverter(); - short? value = 255; - - var result = converter.TryConvert(value, "X", out var output); + var result = converter.TryConvert(HexShort, "X", out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo("FF"); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableSingleToSingleTypeConverterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableSingleToSingleTypeConverterTests.cs index e4673ea8..5a5292bb 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableSingleToSingleTypeConverterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableSingleToSingleTypeConverterTests.cs @@ -32,9 +32,7 @@ public async Task GetAffinityForObjects_Returns2() public async Task TryConvert_WithValue_Succeeds() { var converter = new NullableSingleToSingleTypeConverter(); - float? value = 123.45F; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(SampleSingle, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo(SampleSingle); @@ -46,8 +44,7 @@ public async Task TryConvert_WithValue_Succeeds() public async Task TryConvert_Null_ReturnsFalse() { var converter = new NullableSingleToSingleTypeConverter(); - float? value = null; - var result = converter.TryConvert(value, null, out _); + var result = converter.TryConvert(null, null, out _); await Assert.That(result).IsFalse(); } @@ -76,9 +73,7 @@ public async Task ToType_ReturnsSingle() public async Task TryConvertTyped_WithValidValue_ReturnsTrueAndOutput() { var converter = new NullableSingleToSingleTypeConverter(); - float? value = 42.5F; - - var success = converter.TryConvertTyped(value, null, out var result); + var success = converter.TryConvertTyped(RoundedSingle, null, out var result); await Assert.That(success).IsTrue(); await Assert.That(result).IsEqualTo(RoundedSingle); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableSingleToStringTypeConverterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableSingleToStringTypeConverterTests.cs index 810ac5f0..464c0817 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableSingleToStringTypeConverterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableSingleToStringTypeConverterTests.cs @@ -10,6 +10,9 @@ public class NullableSingleToStringTypeConverterTests /// Expected affinity returned for matched converter type pairs. private const int ExpectedAffinity = 2; + /// Single-precision value converted with a width hint that pads it to two decimal places. + private const float FormattedSingle = 42.5F; + /// Verifies GetAffinityForObjects Returns2. /// A task representing the asynchronous operation. [Test] @@ -93,9 +96,7 @@ public async Task TryConvert_SingleNullableToString_Succeeds() public async Task TryConvert_WithConversionHint_FormatsCorrectly() { var converter = new NullableSingleToStringTypeConverter(); - float? value = 42.5F; - - var result = converter.TryConvert(value, ExpectedAffinity, out var output); + var result = converter.TryConvert(FormattedSingle, ExpectedAffinity, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo("42.50"); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableTimeOnlyToStringTypeConverterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableTimeOnlyToStringTypeConverterTests.cs index 4517e5ed..806bbfa7 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableTimeOnlyToStringTypeConverterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableTimeOnlyToStringTypeConverterTests.cs @@ -50,9 +50,7 @@ public async Task TryConvert_TimeOnly_Succeeds() public async Task TryConvert_Null_ReturnsNullString() { var converter = new NullableTimeOnlyToStringTypeConverter(); - TimeOnly? value = null; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(null, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsNull(); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableTimeSpanToStringTypeConverterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableTimeSpanToStringTypeConverterTests.cs index 669ef44c..78fa2aac 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableTimeSpanToStringTypeConverterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/NullableTimeSpanToStringTypeConverterTests.cs @@ -43,9 +43,7 @@ public async Task TryConvert_TimeSpan_Succeeds() public async Task TryConvert_Null_ReturnsNullString() { var converter = new NullableTimeSpanToStringTypeConverter(); - TimeSpan? value = null; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(null, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsNull(); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/TimeOnlyToStringTypeConverterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/TimeOnlyToStringTypeConverterTests.cs index a0a48f24..a5d02c40 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/TimeOnlyToStringTypeConverterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/TimeOnlyToStringTypeConverterTests.cs @@ -50,9 +50,7 @@ public async Task TryConvert_TimeOnly_Succeeds() public async Task TryConvert_MinValue_Succeeds() { var converter = new TimeOnlyToStringTypeConverter(); - var value = TimeOnly.MinValue; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(TimeOnly.MinValue, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo(TimeOnly.MinValue.ToString()); @@ -64,9 +62,7 @@ public async Task TryConvert_MinValue_Succeeds() public async Task TryConvert_MaxValue_Succeeds() { var converter = new TimeOnlyToStringTypeConverter(); - var value = TimeOnly.MaxValue; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(TimeOnly.MaxValue, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo(TimeOnly.MaxValue.ToString()); diff --git a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/TimeSpanToStringTypeConverterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/TimeSpanToStringTypeConverterTests.cs index b23d13bd..ced671be 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/TimeSpanToStringTypeConverterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Bindings/TypeConverters/TimeSpanToStringTypeConverterTests.cs @@ -46,9 +46,7 @@ public async Task TryConvert_TimeSpan_Succeeds() public async Task TryConvert_ZeroTimeSpan_Succeeds() { var converter = new TimeSpanToStringTypeConverter(); - var value = TimeSpan.Zero; - - var result = converter.TryConvert(value, null, out var output); + var result = converter.TryConvert(TimeSpan.Zero, null, out var output); await Assert.That(result).IsTrue(); await Assert.That(output).IsEqualTo("00:00:00"); diff --git a/src/tests/ReactiveUI.Binding.Tests/Builder/BuilderMixinsTests.cs b/src/tests/ReactiveUI.Binding.Tests/Builder/BuilderMixinsTests.cs index 143c11c1..250f9105 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Builder/BuilderMixinsTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Builder/BuilderMixinsTests.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Builder; using ReactiveUI.Binding.Mixins; using ReactiveUI.Binding.Tests.TestModels; @@ -24,8 +25,7 @@ public async Task BuildApp_WithValidBuilder_Succeeds() var builder = RxBindingBuilder.CreateReactiveUIBindingBuilder(); _ = builder.WithCoreServices(); - IAppBuilder appBuilder = builder; - var instance = appBuilder.BuildApp(); + var instance = ((IAppBuilder)builder).BuildApp(); await Assert.That(instance).IsNotNull(); } @@ -51,8 +51,7 @@ public async Task WithPlatformModule_DelegatesToBuilder() var builder = RxBindingBuilder.CreateReactiveUIBindingBuilder(); var registered = false; - IAppBuilder appBuilder = builder; - var result = appBuilder.WithPlatformModule(new TestModule(() => registered = true)); + var result = ((IAppBuilder)builder).WithPlatformModule(new TestModule(() => registered = true)); _ = builder.BuildApp(); @@ -81,8 +80,7 @@ public async Task WithRegistration_DelegatesToBuilder() var builder = RxBindingBuilder.CreateReactiveUIBindingBuilder(); var executed = false; - IAppBuilder appBuilder = builder; - var result = appBuilder.WithRegistration(_ => executed = true); + var result = ((IAppBuilder)builder).WithRegistration(_ => executed = true); await Assert.That(executed).IsTrue(); await Assert.That(result).IsNotNull(); @@ -112,8 +110,7 @@ public async Task WithConverter_RegistersConverterViaAppBuilder() typeof(bool), static (_, _) => (true, true)); - IAppBuilder appBuilder = builder; - var result = appBuilder.WithConverter(converter); + var result = ((IAppBuilder)builder).WithConverter(converter); var resolved = builder.ConverterService.TypedConverters.TryGetConverter(typeof(int), typeof(bool)); @@ -147,8 +144,7 @@ public async Task WithFallbackConverter_RegistersConverterViaAppBuilder() var builder = RxBindingBuilder.CreateReactiveUIBindingBuilder(); var converter = new StubFallbackConverter(static (_, _, _, _) => (true, "converted")); - IAppBuilder appBuilder = builder; - var result = appBuilder.WithFallbackConverter(converter); + var result = ((IAppBuilder)builder).WithFallbackConverter(converter); var allConverters = builder.ConverterService.FallbackConverters.GetAllConverters().ToList(); @@ -178,8 +174,7 @@ public async Task WithSetMethodConverter_RegistersConverterViaAppBuilder() var builder = RxBindingBuilder.CreateReactiveUIBindingBuilder(); var converter = new StubSetMethodBindingConverter(); - IAppBuilder appBuilder = builder; - var result = appBuilder.WithSetMethodConverter(converter); + var result = ((IAppBuilder)builder).WithSetMethodConverter(converter); var allConverters = builder.ConverterService.SetMethodConverters.GetAllConverters().ToList(); @@ -214,8 +209,7 @@ public async Task FluentChaining_ThroughIAppBuilder_Works() var fallbackConverter = new StubFallbackConverter(static (_, _, _, _) => (true, "fallback")); var setConverter = new StubSetMethodBindingConverter(); - IAppBuilder appBuilder = builder; - var result = appBuilder + var result = ((IAppBuilder)builder) .WithConverter(converter) .WithFallbackConverter(fallbackConverter) .WithSetMethodConverter(setConverter); @@ -288,6 +282,7 @@ private sealed class FakeAppBuilder : IAppBuilder /// Uses the current Splat locator. /// The builder instance. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public IAppBuilder UseCurrentSplatLocator() => WithCoreServices(); /// Registers a module. @@ -304,6 +299,7 @@ public IAppBuilder UsingModule(T registrationModule) /// Builds the application instance. /// The application instance. + /// Always; the fake exists only to fail the builder type check. public IAppInstance Build() => throw new NotSupportedException(); } @@ -318,6 +314,7 @@ private sealed class TestModule : IModule public TestModule(Action onConfigure) => _onConfigure = onConfigure; /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Configure(IMutableDependencyResolver resolver) => _onConfigure(); } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Builder/ReactiveUIBindingBuilderTests.cs b/src/tests/ReactiveUI.Binding.Tests/Builder/ReactiveUIBindingBuilderTests.cs index 42b6a42c..832cabe2 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Builder/ReactiveUIBindingBuilderTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Builder/ReactiveUIBindingBuilderTests.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Builder; using ReactiveUI.Binding.Tests.TestModels; @@ -275,8 +276,7 @@ public async Task BuildApp_MarksAsInitialized() _ = builder.BuildApp(); - var action = RxBindingBuilder.EnsureInitialized; - await Assert.That(action).ThrowsNothing(); + await Assert.That(RxBindingBuilder.EnsureInitialized).ThrowsNothing(); } /// Verifies that multiple converters of different types can be registered and all appear in their respective registries. @@ -370,6 +370,7 @@ public async Task ConfigureViewLocator_RegistersConfiguredLocator() private sealed class TestModule(Action onConfigure) : Splat.Builder.IModule { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Configure(IMutableDependencyResolver resolver) => onConfigure(); } @@ -378,10 +379,12 @@ private sealed class StubCommandBinder : ICreatesCommandBinding { /// [SuppressMessage("Design", "SST1452:Unused type parameter", Justification = "Dictated by the interface this test stub implements.")] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public int GetAffinityForObject(bool hasEventTarget) => 0; /// [RequiresUnreferencedCode("Test stub")] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public IDisposable? BindCommandToObject( System.Windows.Input.ICommand? command, T? target, @@ -391,6 +394,7 @@ private sealed class StubCommandBinder : ICreatesCommandBinding /// [SuppressMessage("Design", "SST1452:Unused type parameter", Justification = "Dictated by the interface this test stub implements.")] [RequiresUnreferencedCode("Test stub")] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public IDisposable? BindCommandToObject( System.Windows.Input.ICommand? command, T? target, @@ -399,6 +403,7 @@ private sealed class StubCommandBinder : ICreatesCommandBinding where T : class => null; /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public IDisposable? BindCommandToObject( System.Windows.Input.ICommand? command, T? target, diff --git a/src/tests/ReactiveUI.Binding.Tests/Builder/RxBindingBuilderTests.cs b/src/tests/ReactiveUI.Binding.Tests/Builder/RxBindingBuilderTests.cs index 911e7192..c4af384e 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Builder/RxBindingBuilderTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Builder/RxBindingBuilderTests.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Builder; namespace ReactiveUI.Binding.Tests.Builder; @@ -137,17 +138,21 @@ public async Task CreateReactiveUIBindingBuilder_ResolverNotReadonly_FallsBackTo private sealed class MutableOnlyResolver : IMutableDependencyResolver { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool HasRegistration(Type? serviceType) => false; /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool HasRegistration(Type? serviceType, string? contract) => false; /// [SuppressMessage("Design", "SST1452:Unused type parameter", Justification = "Dictated by the interface this test stub implements.")] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool HasRegistration() => false; /// [SuppressMessage("Design", "SST1452:Unused type parameter", Justification = "Dictated by the interface this test stub implements.")] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool HasRegistration(string? contract) => false; /// @@ -231,21 +236,25 @@ public void UnregisterAll(string? contract) } /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public IDisposable ServiceRegistrationCallback(Type serviceType, Action callback) => Disposable.Empty; /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public IDisposable ServiceRegistrationCallback(Type serviceType, string? contract, Action callback) => Disposable.Empty; /// [SuppressMessage("Design", "SST1452:Unused type parameter", Justification = "Dictated by the interface this test stub implements.")] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public IDisposable ServiceRegistrationCallback(Action callback) => Disposable.Empty; /// [SuppressMessage("Design", "SST1452:Unused type parameter", Justification = "Dictated by the interface this test stub implements.")] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public IDisposable ServiceRegistrationCallback(string? contract, Action callback) => Disposable.Empty; diff --git a/src/tests/ReactiveUI.Binding.Tests/CommandBinding/CommandBinderServiceTests.cs b/src/tests/ReactiveUI.Binding.Tests/CommandBinding/CommandBinderServiceTests.cs index 4bcf0962..eea1f4c1 100644 --- a/src/tests/ReactiveUI.Binding.Tests/CommandBinding/CommandBinderServiceTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/CommandBinding/CommandBinderServiceTests.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using System.Windows.Input; using ReactiveUI.Binding.Builder; using ReactiveUI.Binding.CommandBinding; @@ -89,16 +90,19 @@ private sealed class HighAffinityBinder : ICreatesCommandBinding /// [SuppressMessage("Design", "SST1452:Unused type parameter", Justification = "Dictated by the interface this test stub implements.")] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public int GetAffinityForObject(bool hasEventTarget) => HighAffinity; /// [RequiresUnreferencedCode("Test stub")] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public IDisposable? BindCommandToObject(ICommand? command, T? target, IObservable commandParameter) where T : class => null; /// [SuppressMessage("Design", "SST1452:Unused type parameter", Justification = "Dictated by the interface this test stub implements.")] [RequiresUnreferencedCode("Test stub")] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public IDisposable? BindCommandToObject( ICommand? command, T? target, @@ -107,6 +111,7 @@ private sealed class HighAffinityBinder : ICreatesCommandBinding where T : class => null; /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public IDisposable? BindCommandToObject( ICommand? command, T? target, diff --git a/src/tests/ReactiveUI.Binding.Tests/Expression/ExpressionMixinsTests.cs b/src/tests/ReactiveUI.Binding.Tests/Expression/ExpressionMixinsTests.cs index 8ead64b8..38980995 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Expression/ExpressionMixinsTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Expression/ExpressionMixinsTests.cs @@ -147,8 +147,7 @@ public async Task GetParent_NestedMemberExpression_ReturnsIntermediateExpression await Assert.That(parent).IsNotNull(); await Assert.That(parent!.NodeType).IsEqualTo(ExpressionType.MemberAccess); - var parentMember = (MemberExpression)parent; - await Assert.That(parentMember.Member.Name).IsEqualTo("Address"); + await Assert.That(((MemberExpression)parent).Member.Name).IsEqualTo("Address"); } /// Verifies that GetExpressionChain throws NotSupportedException for a ConstantExpression with a helpful message. diff --git a/src/tests/ReactiveUI.Binding.Tests/Expression/ExpressionRewriterTests.cs b/src/tests/ReactiveUI.Binding.Tests/Expression/ExpressionRewriterTests.cs index 1f14a5c9..20c5a3f5 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Expression/ExpressionRewriterTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Expression/ExpressionRewriterTests.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Expressions; namespace ReactiveUI.Binding.Tests.Expression; @@ -71,8 +72,7 @@ public async Task Rewrite_WithArrayLength_ReturnsMemberAccess() // ArrayLength should be rewritten to MemberAccess of Length property await Assert.That(result.NodeType).IsEqualTo(ExpressionType.MemberAccess); - var memberExpr = (MemberExpression)result; - await Assert.That(memberExpr.Member.Name).IsEqualTo(LengthPropertyName); + await Assert.That(((MemberExpression)result).Member.Name).IsEqualTo(LengthPropertyName); } /// Verifies that constant expressions pass through unchanged. @@ -185,6 +185,7 @@ public async Task Rewrite_WithNestedMemberAccess_ReturnsMemberExpression() /// Verifies that null expression throws. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Rewrite_WithNullExpression_Throws() => Assert.Throws(static () => Reflection.Rewrite(null)); @@ -247,8 +248,7 @@ public async Task Rewrite_WithConvertWrappingMemberAccess_UnwrapsToMemberAccess( var result = Reflection.Rewrite(convert); await Assert.That(result.NodeType).IsEqualTo(ExpressionType.MemberAccess); - var memberExpr = (MemberExpression)result; - await Assert.That(memberExpr.Member.Name).IsEqualTo(PropertyName); + await Assert.That(((MemberExpression)result).Member.Name).IsEqualTo(PropertyName); } /// Verifies that a static method call (non-special-name) throws NotSupportedException. @@ -306,10 +306,9 @@ public async Task Rewrite_ArrayIndexWithArrayType_ProducesArrayAccess() // After rewrite, it should be an IndexExpression with NodeType == Index await Assert.That(result.NodeType).IsEqualTo(ExpressionType.Index); - var indexExpr = (IndexExpression)result; // The object type should be int[] (array type) - await Assert.That(indexExpr.Object!.Type.IsArray).IsTrue(); + await Assert.That(((IndexExpression)result).Object!.Type.IsArray).IsTrue(); } /// @@ -510,8 +509,7 @@ public async Task Rewrite_DoubleConvert_UnwrapsCompletely() var result = Reflection.Rewrite(outerConvert); await Assert.That(result.NodeType).IsEqualTo(ExpressionType.MemberAccess); - var memberExpr = (MemberExpression)result; - await Assert.That(memberExpr.Member.Name).IsEqualTo(PropertyName); + await Assert.That(((MemberExpression)result).Member.Name).IsEqualTo(PropertyName); } /// @@ -621,6 +619,7 @@ private sealed class TestClass /// Gets the value of . Used to test non-special-name method call rewriting. /// The current value of the . + [MethodImpl(MethodImplOptions.AggressiveInlining)] public string? GetValue() => Property; } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Expression/ReflectionTests.cs b/src/tests/ReactiveUI.Binding.Tests/Expression/ReflectionTests.cs index c9729c5e..00bd2a18 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Expression/ReflectionTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Expression/ReflectionTests.cs @@ -245,8 +245,7 @@ public async Task Rewrite_ConvertExpression_StripsConvertAndReturnsMemberAccess( // After rewriting, the Convert should be stripped, leaving MemberAccess await Assert.That(rewritten.NodeType).IsEqualTo(ExpressionType.MemberAccess); - var member = (MemberExpression)rewritten; - await Assert.That(member.Member.Name).IsEqualTo("Age"); + await Assert.That(((MemberExpression)rewritten).Member.Name).IsEqualTo("Age"); } /// diff --git a/src/tests/ReactiveUI.Binding.Tests/Fallback/CommandBindingAffinityCheckerTests.cs b/src/tests/ReactiveUI.Binding.Tests/Fallback/CommandBindingAffinityCheckerTests.cs index 82a2b3c5..21c1d310 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Fallback/CommandBindingAffinityCheckerTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Fallback/CommandBindingAffinityCheckerTests.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using System.Windows.Input; using ReactiveUI.Binding.Fallback; @@ -175,6 +176,7 @@ public async Task HasHigherAffinityPlugin_MultiplePlugins_NoneHigher_ReturnsFals } /// Restores default plugins by re-initializing the binding infrastructure. + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void RestoreDefaultPlugins() => RuntimeObservationFallbackTests.EnsureInitialized(); diff --git a/src/tests/ReactiveUI.Binding.Tests/Fallback/ObservationAffinityCheckerTests.cs b/src/tests/ReactiveUI.Binding.Tests/Fallback/ObservationAffinityCheckerTests.cs index 0bc9e28c..f1f38576 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Fallback/ObservationAffinityCheckerTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Fallback/ObservationAffinityCheckerTests.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Fallback; using Splat; @@ -184,6 +185,7 @@ public async Task HasHigherAffinityPlugin_MultiplePlugins_NoneHigher_ReturnsFals } /// Restores default plugins by re-initializing the binding infrastructure. + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void RestoreDefaultPlugins() => RuntimeObservationFallbackTests.EnsureInitialized(); diff --git a/src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs b/src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs index 57b8fb55..9e07f961 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Interactions/InteractionTests.cs @@ -187,7 +187,7 @@ private sealed class ErrorObservable(Exception error) : IObservable public IDisposable Subscribe(IObserver observer) { observer.OnError(error); - return Binding.Observables.EmptyDisposable.Instance; + return EmptyDisposable.Instance; } } } diff --git a/src/tests/ReactiveUI.Binding.Tests/ObservableForProperty/ChainLinkReaderTests.cs b/src/tests/ReactiveUI.Binding.Tests/ObservableForProperty/ChainLinkReaderTests.cs index 65355263..6f1765af 100644 --- a/src/tests/ReactiveUI.Binding.Tests/ObservableForProperty/ChainLinkReaderTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/ObservableForProperty/ChainLinkReaderTests.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using ReactiveUI.Binding.ObservableForProperty; using ReactiveUI.Binding.Tests.TestModels; using LinqExpression = System.Linq.Expressions.Expression; @@ -86,6 +87,7 @@ await Assert.That(() => ChainLinkReader.ReadValue(fixture, null, null, link)) /// Builds an array index link, whose expression carries no indexer. /// The link expression. + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static IndexExpression ArrayIndexLink() => LinqExpression.ArrayAccess(LinqExpression.Constant(IndexedValues), LinqExpression.Constant(0)); } diff --git a/src/tests/ReactiveUI.Binding.Tests/ObservableForProperty/INPCObservableForPropertyTests.cs b/src/tests/ReactiveUI.Binding.Tests/ObservableForProperty/INPCObservableForPropertyTests.cs index f86da4c9..9ccf2fee 100644 --- a/src/tests/ReactiveUI.Binding.Tests/ObservableForProperty/INPCObservableForPropertyTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/ObservableForProperty/INPCObservableForPropertyTests.cs @@ -4,6 +4,7 @@ using System.ComponentModel; using System.Reflection; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Expressions; using ReactiveUI.Binding.ObservableForProperty; using ReactiveUI.Binding.Tests.TestModels; @@ -592,20 +593,24 @@ public string this[string key] } /// Raises PropertyChanged with null property name (all properties changed). + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void RaiseAllPropertiesChanged() => PropertyChanged?.Invoke(this, new(null)); /// Raises PropertyChanged with a specific property name. /// The property name to raise. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void RaisePropertyChangedWithName(string? propertyName) => PropertyChanged?.Invoke(this, new(propertyName)); /// Raises PropertyChanging with null property name (all properties changing). + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void RaiseAllPropertyChanging() => PropertyChanging?.Invoke(this, new(null)); /// Raises PropertyChanging with a specific property name. /// The property name to raise. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void RaisePropertyChangingWithName(string? propertyName) => PropertyChanging?.Invoke(this, new(propertyName)); } @@ -651,6 +656,7 @@ private sealed class NullPropertyNameViewModel : INotifyPropertyChanged public string Name { get; set; } = string.Empty; /// Raises PropertyChanged with null property name (all properties changed). + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void RaiseAllPropertiesChanged() => PropertyChanged?.Invoke(this, new(null)); } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/ActionDisposableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/ActionDisposableTests.cs deleted file mode 100644 index d70d9724..00000000 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/ActionDisposableTests.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved. -// ReactiveUI Association Incorporated licenses this file to you under the MIT license. -// See the LICENSE file in the project root for full license information. - -using ReactiveUI.Binding.Observables; - -namespace ReactiveUI.Binding.Tests.Observables; - -/// Tests for the class which invokes an action on disposal. -public class ActionDisposableTests -{ - /// Verifies that the action is invoked when Dispose is called. - /// A task representing the asynchronous operation. - [Test] - public async Task Dispose_InvokesAction() - { - var invoked = false; - var disposable = new ActionDisposable(() => invoked = true); - - disposable.Dispose(); - - await Assert.That(invoked).IsTrue(); - } - - /// Verifies that the action is invoked only once even if Dispose is called multiple times. - /// A task representing the asynchronous operation. - [Test] - public async Task Dispose_CalledTwice_InvokesActionOnlyOnce() - { - var invokeCount = 0; - var disposable = new ActionDisposable(() => Interlocked.Increment(ref invokeCount)); - - disposable.Dispose(); - disposable.Dispose(); - - await Assert.That(invokeCount).IsEqualTo(1); - } - - /// Verifies that constructor throws ArgumentNullException when action is null. - [Test] - public void Constructor_NullAction_ThrowsArgumentNullException() => - Assert.Throws(static () => _ = new ActionDisposable(null!)); -} diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest10ObservableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest10ObservableTests.cs index 50628c97..be8b7d3d 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest10ObservableTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest10ObservableTests.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System.Reactive.Subjects; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Observables; using ReactiveUI.Binding.Tests.TestModels; @@ -1034,12 +1035,15 @@ public async Task CompletedInSource_DoesNotPropagateCompletion() private sealed class AnonymousObserver(Action onNext, Action onError, Action onCompleted) : IObserver { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnCompleted() => onCompleted(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnError(Exception error) => onError(error); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnNext(T value) => onNext(value); } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest11ObservableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest11ObservableTests.cs index 3e57c0b2..9d3346e1 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest11ObservableTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest11ObservableTests.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System.Reactive.Subjects; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Observables; namespace ReactiveUI.Binding.Tests.Observables; @@ -372,12 +373,15 @@ public async Task Subscribe_NullObserver_Throws() private sealed class AnonymousObserver(Action onNext, Action onError, Action onCompleted) : IObserver { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnCompleted() => onCompleted(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnError(Exception error) => onError(error); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnNext(T value) => onNext(value); } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest12ObservableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest12ObservableTests.cs index d53818ac..f1a57073 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest12ObservableTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest12ObservableTests.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System.Reactive.Subjects; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Observables; namespace ReactiveUI.Binding.Tests.Observables; @@ -414,12 +415,15 @@ public async Task Subscribe_NullObserver_Throws() private sealed class AnonymousObserver(Action onNext, Action onError, Action onCompleted) : IObserver { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnCompleted() => onCompleted(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnError(Exception error) => onError(error); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnNext(T value) => onNext(value); } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest13ObservableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest13ObservableTests.cs index 51ad0203..b74a7507 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest13ObservableTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest13ObservableTests.cs @@ -3,7 +3,7 @@ // See the LICENSE file in the project root for full license information. using System.Reactive.Subjects; - +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Observables; namespace ReactiveUI.Binding.Tests.Observables; @@ -459,12 +459,15 @@ public async Task Subscribe_NullObserver_Throws() private sealed class AnonymousObserver(Action onNext, Action onError, Action onCompleted) : IObserver { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnCompleted() => onCompleted(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnError(Exception error) => onError(error); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnNext(T value) => onNext(value); } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest14ObservableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest14ObservableTests.cs index eb5163b5..d7bc3261 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest14ObservableTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest14ObservableTests.cs @@ -3,7 +3,7 @@ // See the LICENSE file in the project root for full license information. using System.Reactive.Subjects; - +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Observables; namespace ReactiveUI.Binding.Tests.Observables; @@ -505,12 +505,15 @@ public async Task Subscribe_NullObserver_Throws() private sealed class AnonymousObserver(Action onNext, Action onError, Action onCompleted) : IObserver { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnCompleted() => onCompleted(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnError(Exception error) => onError(error); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnNext(T value) => onNext(value); } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest15ObservableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest15ObservableTests.cs index 2aafc65f..cf65fb46 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest15ObservableTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest15ObservableTests.cs @@ -3,7 +3,7 @@ // See the LICENSE file in the project root for full license information. using System.Reactive.Subjects; - +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Observables; namespace ReactiveUI.Binding.Tests.Observables; @@ -553,12 +553,15 @@ public async Task Subscribe_NullObserver_Throws() private sealed class AnonymousObserver(Action onNext, Action onError, Action onCompleted) : IObserver { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnCompleted() => onCompleted(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnError(Exception error) => onError(error); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnNext(T value) => onNext(value); } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest16ObservableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest16ObservableTests.cs index 315f6a1c..47ff339d 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest16ObservableTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest16ObservableTests.cs @@ -3,7 +3,7 @@ // See the LICENSE file in the project root for full license information. using System.Reactive.Subjects; - +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Observables; namespace ReactiveUI.Binding.Tests.Observables; @@ -603,12 +603,15 @@ public async Task Subscribe_NullObserver_Throws() private sealed class AnonymousObserver(Action onNext, Action onError, Action onCompleted) : IObserver { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnCompleted() => onCompleted(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnError(Exception error) => onError(error); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnNext(T value) => onNext(value); } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest2ObservableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest2ObservableTests.cs index 09fa2584..a1477da8 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest2ObservableTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest2ObservableTests.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System.Reactive.Subjects; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Observables; using ReactiveUI.Binding.Tests.TestModels; @@ -284,12 +285,15 @@ public async Task CompletedInSource_DoesNotPropagateCompletion() private sealed class AnonymousObserver(Action onNext, Action onError, Action onCompleted) : IObserver { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnCompleted() => onCompleted(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnError(Exception error) => onError(error); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnNext(T value) => onNext(value); } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest3ObservableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest3ObservableTests.cs index 5a82bb73..5d88f93a 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest3ObservableTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest3ObservableTests.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System.Reactive.Subjects; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Observables; using ReactiveUI.Binding.Tests.TestModels; @@ -359,12 +360,15 @@ public async Task CompletedInSource_DoesNotPropagateCompletion() private sealed class AnonymousObserver(Action onNext, Action onError, Action onCompleted) : IObserver { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnCompleted() => onCompleted(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnError(Exception error) => onError(error); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnNext(T value) => onNext(value); } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest4ObservableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest4ObservableTests.cs index 3ec6ef65..53578d2b 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest4ObservableTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest4ObservableTests.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System.Reactive.Subjects; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Observables; using ReactiveUI.Binding.Tests.TestModels; @@ -440,12 +441,15 @@ public async Task CompletedInSource_DoesNotPropagateCompletion() private sealed class AnonymousObserver(Action onNext, Action onError, Action onCompleted) : IObserver { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnCompleted() => onCompleted(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnError(Exception error) => onError(error); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnNext(T value) => onNext(value); } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest5ObservableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest5ObservableTests.cs index b2eba8bc..e98412b3 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest5ObservableTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest5ObservableTests.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System.Reactive.Subjects; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Observables; using ReactiveUI.Binding.Tests.TestModels; @@ -527,12 +528,15 @@ public async Task CompletedInSource_DoesNotPropagateCompletion() private sealed class AnonymousObserver(Action onNext, Action onError, Action onCompleted) : IObserver { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnCompleted() => onCompleted(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnError(Exception error) => onError(error); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnNext(T value) => onNext(value); } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest6ObservableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest6ObservableTests.cs index 26adcb6f..5f659888 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest6ObservableTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest6ObservableTests.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System.Reactive.Subjects; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Observables; using ReactiveUI.Binding.Tests.TestModels; @@ -609,12 +610,15 @@ public async Task CompletedInSource_DoesNotPropagateCompletion() private sealed class AnonymousObserver(Action onNext, Action onError, Action onCompleted) : IObserver { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnCompleted() => onCompleted(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnError(Exception error) => onError(error); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnNext(T value) => onNext(value); } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest7ObservableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest7ObservableTests.cs index 2a49c58a..b7b80f66 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest7ObservableTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest7ObservableTests.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System.Reactive.Subjects; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Observables; using ReactiveUI.Binding.Tests.TestModels; @@ -708,12 +709,15 @@ public async Task CompletedInSource_DoesNotPropagateCompletion() private sealed class AnonymousObserver(Action onNext, Action onError, Action onCompleted) : IObserver { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnCompleted() => onCompleted(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnError(Exception error) => onError(error); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnNext(T value) => onNext(value); } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest8ObservableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest8ObservableTests.cs index 48574831..5294877e 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest8ObservableTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest8ObservableTests.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System.Reactive.Subjects; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Observables; using ReactiveUI.Binding.Tests.TestModels; @@ -835,12 +836,15 @@ public async Task CompletedInSource_DoesNotPropagateCompletion() private sealed class AnonymousObserver(Action onNext, Action onError, Action onCompleted) : IObserver { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnCompleted() => onCompleted(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnError(Exception error) => onError(error); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnNext(T value) => onNext(value); } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest9ObservableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest9ObservableTests.cs index e0952e0d..99b25726 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest9ObservableTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Observables/CombineLatest9ObservableTests.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System.Reactive.Subjects; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Observables; using ReactiveUI.Binding.Tests.TestModels; @@ -917,12 +918,15 @@ public async Task CompletedInSource_DoesNotPropagateCompletion() private sealed class AnonymousObserver(Action onNext, Action onError, Action onCompleted) : IObserver { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnCompleted() => onCompleted(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnError(Exception error) => onError(error); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnNext(T value) => onNext(value); } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/CompositeDisposable2Tests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/CompositeDisposable2Tests.cs deleted file mode 100644 index 3f744ca3..00000000 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/CompositeDisposable2Tests.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved. -// ReactiveUI Association Incorporated licenses this file to you under the MIT license. -// See the LICENSE file in the project root for full license information. - -using ReactiveUI.Binding.Observables; - -namespace ReactiveUI.Binding.Tests.Observables; - -/// Unit tests for . -public class CompositeDisposable2Tests -{ - /// Verifies that Dispose() disposes both inner disposables. - /// A representing the asynchronous unit test. - [Test] - public async Task Dispose_DisposesBothInners() - { - var d1Disposed = 0; - var d2Disposed = 0; - var d1 = new ActionDisposable(() => d1Disposed++); - var d2 = new ActionDisposable(() => d2Disposed++); - var composite = new CompositeDisposable2(d1, d2); - - composite.Dispose(); - - await Assert.That(d1Disposed).IsEqualTo(1); - await Assert.That(d2Disposed).IsEqualTo(1); - } - - /// Verifies that multiple calls to Dispose() only dispose the inner disposables once. - /// A representing the asynchronous unit test. - [Test] - public async Task Dispose_MultipleTimes_DisposesInnersOnlyOnce() - { - var d1Disposed = 0; - var d2Disposed = 0; - var d1 = new ActionDisposable(() => d1Disposed++); - var d2 = new ActionDisposable(() => d2Disposed++); - var composite = new CompositeDisposable2(d1, d2); - - composite.Dispose(); - composite.Dispose(); - - await Assert.That(d1Disposed).IsEqualTo(1); - await Assert.That(d2Disposed).IsEqualTo(1); - } - - /// Verifies that the constructor throws when d1 is null. - /// A representing the asynchronous unit test. - [Test] - public async Task Constructor_NullD1_ThrowsArgumentNullException() - { - var action = static () => new CompositeDisposable2(null!, EmptyDisposable.Instance); - - await Assert.That(action).Throws().WithParameterName("d1"); - } - - /// Verifies that the constructor throws when d2 is null. - /// A representing the asynchronous unit test. - [Test] - public async Task Constructor_NullD2_ThrowsArgumentNullException() - { - var action = static () => new CompositeDisposable2(EmptyDisposable.Instance, null!); - - await Assert.That(action).Throws().WithParameterName("d2"); - } -} diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/DistinctUntilChangedObservableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/DistinctUntilChangedObservableTests.cs index 54e46352..d4eba9d1 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/DistinctUntilChangedObservableTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Observables/DistinctUntilChangedObservableTests.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Observables; namespace ReactiveUI.Binding.Tests.Observables; @@ -139,6 +140,7 @@ public async Task Subscribe_NullObserver_ThrowsArgumentNullException() private sealed class AnonymousObservable(Func, IDisposable> subscribe) : IObservable { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public IDisposable Subscribe(IObserver observer) => subscribe(observer); } @@ -150,12 +152,15 @@ private sealed class AnonymousObservable(Func, IDisposable> subs private sealed class AnonymousObserver(Action onNext, Action onError, Action onCompleted) : IObserver { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnCompleted() => onCompleted(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnError(Exception error) => onError(error); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnNext(T value) => onNext(value); } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/EmptyObservableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/EmptyObservableTests.cs index 7bb95004..f86dca48 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/EmptyObservableTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Observables/EmptyObservableTests.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Observables; namespace ReactiveUI.Binding.Tests.Observables; @@ -28,6 +29,7 @@ public async Task Subscribe_CompletesImmediately() /// Verifies that EmptyObservable throws ArgumentNullException for null observer. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Subscribe_NullObserver_ThrowsArgumentNullException() => Assert.Throws(static () => EmptyObservable.Instance.Subscribe(null!)); @@ -50,12 +52,15 @@ public async Task Instance_IsSingleton() private sealed class AnonymousObserver(Action onNext, Action onError, Action onCompleted) : IObserver { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnCompleted() => onCompleted(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnError(Exception error) => onError(error); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnNext(T value) => onNext(value); } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/EventObservableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/EventObservableTests.cs index 778756f9..bb5140a7 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/EventObservableTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Observables/EventObservableTests.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Observables; namespace ReactiveUI.Binding.Tests.Observables; @@ -255,12 +256,15 @@ public async Task Dispose_CalledTwice_IsSafe() private sealed class AnonymousObserver(Action onNext, Action onError, Action onCompleted) : IObserver { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnCompleted() => onCompleted(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnError(Exception error) => onError(error); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnNext(T value) => onNext(value); } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/GrowableCompositeDisposableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/GrowableCompositeDisposableTests.cs deleted file mode 100644 index 7b8b9cba..00000000 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/GrowableCompositeDisposableTests.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved. -// ReactiveUI Association Incorporated licenses this file to you under the MIT license. -// See the LICENSE file in the project root for full license information. - -using ReactiveUI.Binding.Observables; - -namespace ReactiveUI.Binding.Tests.Observables; - -/// Tests for . -public class GrowableCompositeDisposableTests -{ - /// The number of resources added in the multiple-resource test. - private const int ResourceCount = 3; - - /// One disposal apiece, the expected outcome for resources. - private static readonly int[] OneDisposalEach = [1, 1, 1]; - - /// Verifies that every retained resource is disposed exactly once. - /// A task representing the asynchronous operation. - [Test] - public async Task Dispose_DisposesEveryAddedResource() - { - var composite = new GrowableCompositeDisposable(); - var disposeCounts = new int[ResourceCount]; - - for (var i = 0; i < ResourceCount; i++) - { - var index = i; - composite.Add(new ActionDisposable(() => disposeCounts[index]++)); - } - - composite.Dispose(); - composite.Dispose(); - - await Assert.That(disposeCounts).IsEquivalentTo(OneDisposalEach); - } - - /// Verifies that a resource handed over after disposal is disposed rather than retained. - /// A task representing the asynchronous operation. - [Test] - public async Task Add_AfterDispose_DisposesImmediately() - { - var composite = new GrowableCompositeDisposable(); - var disposed = false; - - composite.Dispose(); - composite.Add(new ActionDisposable(() => disposed = true)); - - await Assert.That(disposed).IsTrue(); - } - - /// Verifies that a composite with nothing in it disposes cleanly. - [Test] - public void Dispose_WithNothingAdded_DoesNotThrow() - { - var composite = new GrowableCompositeDisposable(); - - composite.Dispose(); - } - - /// Verifies that Add rejects a null resource. - [Test] - public void Add_Null_ThrowsArgumentNullException() - { - var composite = new GrowableCompositeDisposable(); - - _ = Assert.Throws(() => composite.Add(null!)); - } -} diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/MergeObservableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/MergeObservableTests.cs index 9c0163d1..6ee17f81 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/MergeObservableTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Observables/MergeObservableTests.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System.Reactive.Subjects; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Observables; namespace ReactiveUI.Binding.Tests.Observables; @@ -152,12 +153,15 @@ public async Task ErrorInSecondSource_AfterFirstEmitted_PropagatedToSubscriber() private sealed class AnonymousObserver(Action onNext, Action onError, Action onCompleted) : IObserver { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnCompleted() => onCompleted(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnError(Exception error) => onError(error); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnNext(T value) => onNext(value); } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/ObserveOnObservableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/ObserveOnObservableTests.cs index 84e1110c..4d72551d 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/ObserveOnObservableTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Observables/ObserveOnObservableTests.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System.Reactive.Subjects; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Observables; using ReactiveUI.Primitives.Concurrency; @@ -106,11 +107,13 @@ public void Subscribe_NullObserver_ThrowsArgumentNullException() /// Verifies that the constructor rejects a null source. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Constructor_NullSource_ThrowsArgumentNullException() => Assert.Throws(static () => _ = new ObserveOnObservable(null!, ImmediateSequencer.Instance)); /// Verifies that the constructor rejects a null sequencer. [Test] + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Constructor_NullSequencer_ThrowsArgumentNullException() => Assert.Throws(static () => _ = new ObserveOnObservable(new Subject(), null!)); } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/PropertyChangingObservableInitialEmitSerializationTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/PropertyChangingObservableInitialEmitSerializationTests.cs index e5ffd2e2..54857dd9 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/PropertyChangingObservableInitialEmitSerializationTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Observables/PropertyChangingObservableInitialEmitSerializationTests.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System.ComponentModel; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Observables; using ReactiveUI.Binding.Tests.TestModels; @@ -97,10 +98,12 @@ public async Task Subscribe_NoConcurrentNotification_EmitsTheInitialValueToEvery var second = new EmissionRecorder(); using (observable.Subscribe(first)) - using (observable.Subscribe(second)) { - await AssertSequence(first.Snapshot(), 0); - await AssertSequence(second.Snapshot(), 0); + using (observable.Subscribe(second)) + { + await AssertSequence(first.Snapshot(), 0); + await AssertSequence(second.Snapshot(), 0); + } } } @@ -137,20 +140,22 @@ private sealed class InitialEmitCompetitor : IDisposable /// The thread performing the competing writes. private readonly Thread _thread; - /// Whether the contention has been driven already, so later reads run plainly. - private bool _contended; + /// + /// The latch claiming the right to drive the contention: zero until a caller claims it, one + /// afterwards, so later reads run plainly. It is an interlocked integer rather than a boolean + /// because the read it guards is the very code a subscription that stopped serializing would let + /// two threads into at once, where a check-then-set would start the thread twice. + /// + private int _contended; /// Initializes a new instance of the class. /// Writes the observed property. - public InitialEmitCompetitor(Action write) + public InitialEmitCompetitor(Action write) => _thread = new(() => { - _thread = new(() => - { - _started.Set(); - write(1); - write(SecondWrite); - }) { IsBackground = true }; - } + _started.Set(); + write(1); + write(SecondWrite); + }) { IsBackground = true }; /// /// Builds a property read that, the first time it runs, releases the competing thread and holds @@ -162,12 +167,11 @@ public Func CreateContendedRead(Func read) => { var valueOnEntry = read(); - if (_contended) + if (Interlocked.Exchange(ref _contended, 1) != 0) { return valueOnEntry; } - _contended = true; _thread.Start(); _started.Wait(); _ = _thread.Join(InterleaveWindowMilliseconds); @@ -176,9 +180,11 @@ public Func CreateContendedRead(Func read) => }; /// Waits for the competing writes to finish. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void WaitForCompletion() => _thread.Join(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Dispose() => _started.Dispose(); } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/PropertyChangingObservableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/PropertyChangingObservableTests.cs index 62e04a12..5beb13a8 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/PropertyChangingObservableTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Observables/PropertyChangingObservableTests.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System.ComponentModel; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Observables; using ReactiveUI.Binding.Tests.TestModels; @@ -273,6 +274,7 @@ private sealed class ConcurrentChangingTestViewModel : INotifyPropertyChanging /// Raises the event for the specified property. /// The name of the property that is changing. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void RaisePropertyChanging(string? propertyName) => PropertyChanging?.Invoke(this, new(propertyName)); } @@ -288,6 +290,7 @@ private sealed class ManualTestViewModel : INotifyPropertyChanging /// Raises the event for the specified property. /// The name of the property that is changing. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void RaisePropertyChanging(string? propertyName) => PropertyChanging?.Invoke(this, new(propertyName)); } @@ -300,12 +303,15 @@ public void RaisePropertyChanging(string? propertyName) => private sealed class AnonymousObserver(Action onNext, Action onError, Action onCompleted) : IObserver { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnCompleted() => onCompleted(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnError(Exception error) => onError(error); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnNext(T value) => onNext(value); } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/PropertyObservableInitialEmitSerializationTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/PropertyObservableInitialEmitSerializationTests.cs index eb187986..ff3b7f38 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/PropertyObservableInitialEmitSerializationTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Observables/PropertyObservableInitialEmitSerializationTests.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System.ComponentModel; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Observables; using ReactiveUI.Binding.Tests.TestModels; @@ -185,11 +186,13 @@ public async Task Subscribe_ValueIsTheTypeDefault_StillEmitsTheInitialValue(bool distinctUntilChanged); using (nameObservable.Subscribe(nameRecorder)) - using (countObservable.Subscribe(countRecorder)) { - await Assert.That(nameRecorder.Snapshot()).Count().IsEqualTo(1); - await Assert.That(nameRecorder.Snapshot()[0]).IsNull(); - await AssertSequence(countRecorder.Snapshot(), 0); + using (countObservable.Subscribe(countRecorder)) + { + await Assert.That(nameRecorder.Snapshot()).Count().IsEqualTo(1); + await Assert.That(nameRecorder.Snapshot()[0]).IsNull(); + await AssertSequence(countRecorder.Snapshot(), 0); + } } } @@ -217,10 +220,12 @@ public async Task Subscribe_ValueAlreadyDeliveredToAnotherSubscriber_StillEmitsT var afterDisposal = new EmissionRecorder(); using (observable.Subscribe(first)) - using (observable.Subscribe(second)) { - await AssertSequence(first.Snapshot(), InitialName); - await AssertSequence(second.Snapshot(), InitialName); + using (observable.Subscribe(second)) + { + await AssertSequence(first.Snapshot(), InitialName); + await AssertSequence(second.Snapshot(), InitialName); + } } using (observable.Subscribe(afterDisposal)) @@ -307,7 +312,7 @@ public async Task Subscribe_HandlerAttachesAfterTheRaiserSnapshotsItsDelegate_St { var source = new ConventionalRaiseOrderViewModel { Name = InitialName }; var recorder = new EmissionRecorder(); - using var subscriptions = new GrowableCompositeDisposable(); + using var subscriptions = new DisposableBag(); source.BeforeRaise = () => subscriptions.Add(new PropertyObservable( source, @@ -332,7 +337,7 @@ public async Task Subscribe_SourceRaisesPropertyChangedBeforeWritingTheField_Obs { var source = new RaiseBeforeWriteViewModel { Name = InitialName }; var recorder = new EmissionRecorder(); - using var subscriptions = new GrowableCompositeDisposable(); + using var subscriptions = new DisposableBag(); source.BeforeRaise = () => subscriptions.Add(new PropertyObservable( source, @@ -441,6 +446,7 @@ public int Count /// Raises without writing anything. /// The property to report. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void RaisePropertyChanged(string propertyName) => _handlers?.Invoke(this, new(propertyName)); } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/PropertyObservableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/PropertyObservableTests.cs index 42d65f17..74b8342f 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/PropertyObservableTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Observables/PropertyObservableTests.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System.ComponentModel; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Observables; using ReactiveUI.Binding.Tests.TestModels; @@ -305,6 +306,7 @@ private sealed class ConcurrentTestViewModel : INotifyPropertyChanged /// Raises the event for the specified property. /// The name of the property that changed. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void RaisePropertyChanged(string? propertyName) => PropertyChanged?.Invoke(this, new(propertyName)); } @@ -320,6 +322,7 @@ private sealed class ManualTestViewModel : INotifyPropertyChanged /// Raises the event for the specified property. /// The name of the property that changed. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void RaisePropertyChanged(string? propertyName) => PropertyChanged?.Invoke(this, new(propertyName)); } @@ -332,12 +335,15 @@ public void RaisePropertyChanged(string? propertyName) => private sealed class AnonymousObserver(Action onNext, Action onError, Action onCompleted) : IObserver { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnCompleted() => onCompleted(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnError(Exception error) => onError(error); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnNext(T value) => onNext(value); } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/ReturnObservableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/ReturnObservableTests.cs index d8152de8..431d8e4e 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/ReturnObservableTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Observables/ReturnObservableTests.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Observables; namespace ReactiveUI.Binding.Tests.Observables; @@ -70,12 +71,15 @@ public async Task Subscribe_NullObserver_ThrowsArgumentNullException() private sealed class AnonymousObserver(Action onNext, Action onError, Action onCompleted) : IObserver { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnCompleted() => onCompleted(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnError(Exception error) => onError(error); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnNext(T value) => onNext(value); } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/RxBindingExtensionsTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/RxBindingExtensionsTests.cs deleted file mode 100644 index 92a38dfa..00000000 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/RxBindingExtensionsTests.cs +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved. -// ReactiveUI Association Incorporated licenses this file to you under the MIT license. -// See the LICENSE file in the project root for full license information. - -using ReactiveUI.Binding.Observables; -using RxBinding = ReactiveUI.Binding.Observables.RxBindingExtensions; - -namespace ReactiveUI.Binding.Tests.Observables; - -/// Unit tests for . -public class RxBindingExtensionsTests -{ - /// The value produced by the return observable used across tests. - private const int ReturnedValue = 42; - - /// The expected number of emitted values when two notifications are produced. - private const int ExpectedTwoEmissions = 2; - - /// The second integer value emitted by a source observable. - private const int SecondValue = 2; - - /// Verifies that Subscribe invokes the action for each value. - /// A representing the asynchronous unit test. - [Test] - public async Task Subscribe_InvokesAction() - { - var results = new List(); - var source = new ReturnObservable(ReturnedValue); - - _ = RxBinding.Subscribe(source, results.Add); - - await Assert.That(results).Count().IsEqualTo(1); - await Assert.That(results[0]).IsEqualTo(ReturnedValue); - } - - /// Verifies that Select applies the projection correctly. - /// A representing the asynchronous unit test. - [Test] - public async Task Select_AppliesProjection() - { - var results = new List(); - var source = new ReturnObservable(ReturnedValue); - - var select = RxBinding.Select(source, static x => x.ToString()); - _ = select.Subscribe(new AnonymousObserver(results.Add, static _ => { }, static () => { })); - - await Assert.That(results).Count().IsEqualTo(1); - await Assert.That(results[0]).IsEqualTo("42"); - } - - /// Verifies that Skip delegates to SkipObservable. - /// A representing the asynchronous unit test. - [Test] - public async Task Skip_DelegatesToSkipObservable() - { - var results = new List(); - var source = new AnonymousObservable(static observer => - { - observer.OnNext(1); - observer.OnNext(SecondValue); - return EmptyDisposable.Instance; - }); - - var skip = RxBinding.Skip(source, 1); - _ = skip.Subscribe(new AnonymousObserver(results.Add, static _ => { }, static () => { })); - - await Assert.That(results).Count().IsEqualTo(1); - await Assert.That(results[0]).IsEqualTo(SecondValue); - } - - /// Verifies that DistinctUntilChanged delegates to DistinctUntilChangedObservable. - /// A representing the asynchronous unit test. - [Test] - public async Task DistinctUntilChanged_DelegatesToDistinctUntilChangedObservable() - { - var results = new List(); - var source = new AnonymousObservable(static observer => - { - observer.OnNext(1); - observer.OnNext(1); - observer.OnNext(SecondValue); - return EmptyDisposable.Instance; - }); - - var distinct = RxBinding.DistinctUntilChanged(source); - _ = distinct.Subscribe(new AnonymousObserver(results.Add, static _ => { }, static () => { })); - - await Assert.That(results).Count().IsEqualTo(ExpectedTwoEmissions); - await Assert.That(results[0]).IsEqualTo(1); - await Assert.That(results[1]).IsEqualTo(SecondValue); - } - - /// Verifies that Merge merges multiple observables. - /// A representing the asynchronous unit test. - [Test] - public async Task Merge_MergesMultipleObservables() - { - var results = new List(); - var s1 = new ReturnObservable(1); - var s2 = new ReturnObservable(SecondValue); - - var merged = RxBinding.Merge(s1, s2); - _ = merged.Subscribe(new AnonymousObserver(results.Add, static _ => { }, static () => { })); - - await Assert.That(results).Count().IsEqualTo(ExpectedTwoEmissions); - await Assert.That(results).Contains(1); - await Assert.That(results).Contains(SecondValue); - } - - /// Verifies that Switch switches to the newest inner observable. - /// A representing the asynchronous unit test. - [Test] - public async Task Switch_SwitchesToNewestObservable() - { - var results = new List(); - var inner1 = new AnonymousObservable(static observer => - { - observer.OnNext(1); - return EmptyDisposable.Instance; - }); - var inner2 = new AnonymousObservable(static observer => - { - observer.OnNext(SecondValue); - return EmptyDisposable.Instance; - }); - - var source = new AnonymousObservable>(observer => - { - observer.OnNext(inner1); - observer.OnNext(inner2); - return EmptyDisposable.Instance; - }); - - var switched = RxBinding.Switch(source); - _ = switched.Subscribe(new AnonymousObserver(results.Add, static _ => { }, static () => { })); - - await Assert.That(results).Count().IsEqualTo(ExpectedTwoEmissions); - await Assert.That(results[0]).IsEqualTo(1); - await Assert.That(results[1]).IsEqualTo(SecondValue); - } - - /// Verifies that Subscribe throws ArgumentNullException when source is null. - /// A representing the asynchronous unit test. - [Test] - public async Task Subscribe_NullSource_ThrowsArgumentNullException() - { - var action = static () => RxBinding.Subscribe(null!, static _ => { }); - - await Assert.That(action).Throws().WithParameterName("source"); - } - - /// Verifies that Subscribe throws ArgumentNullException when onNext is null. - /// A representing the asynchronous unit test. - [Test] - public async Task Subscribe_NullOnNext_ThrowsArgumentNullException() - { - var action = static () => RxBinding.Subscribe(EmptyObservable.Instance, null!); - - await Assert.That(action).Throws().WithParameterName("onNext"); - } - - /// A simple observable that delegates subscription to a provided function. - /// The type of elements produced. - /// The function to invoke when an observer subscribes. - private sealed class AnonymousObservable(Func, IDisposable> subscribe) : IObservable - { - /// - public IDisposable Subscribe(IObserver observer) => subscribe(observer); - } - - /// A simple observer that delegates to provided actions. - /// The type of elements observed. - /// The action to invoke for each element. - /// The action to invoke on error. - /// The action to invoke on completion. - private sealed class AnonymousObserver(Action onNext, Action onError, Action onCompleted) : IObserver - { - /// - public void OnCompleted() => onCompleted(); - - /// - public void OnError(Exception error) => onError(error); - - /// - public void OnNext(T value) => onNext(value); - } -} diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/SelectObservableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/SelectObservableTests.cs index 8980ba14..9eb9a6cb 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/SelectObservableTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Observables/SelectObservableTests.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System.Reactive.Subjects; +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Observables; namespace ReactiveUI.Binding.Tests.Observables; @@ -138,12 +139,15 @@ public async Task Selector_TransformsValues() private sealed class AnonymousObserver(Action onNext, Action onError, Action onCompleted) : IObserver { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnCompleted() => onCompleted(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnError(Exception error) => onError(error); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnNext(T value) => onNext(value); } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/SerialDisposableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/SerialDisposableTests.cs deleted file mode 100644 index adcb9ce0..00000000 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/SerialDisposableTests.cs +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved. -// ReactiveUI Association Incorporated licenses this file to you under the MIT license. -// See the LICENSE file in the project root for full license information. - -using ReactiveUI.Binding.Observables; -using SerialDisposable = ReactiveUI.Binding.Observables.SerialDisposable; - -namespace ReactiveUI.Binding.Tests.Observables; - -/// Tests for . -public class SerialDisposableTests -{ - /// Verifies that setting a new disposable disposes the previous one. - /// A representing the asynchronous unit test. - [Test] - public async Task SetDisposable_DisposesPrevious() - { - var serial = new SerialDisposable(); - var disposed1 = 0; - var disposed2 = 0; - - serial.Disposable = new ActionDisposable(() => disposed1++); - serial.Disposable = new ActionDisposable(() => disposed2++); - - await Assert.That(disposed1).IsEqualTo(1); - await Assert.That(disposed2).IsEqualTo(0); - } - - /// Verifies that disposing the serial disposable disposes the current inner. - /// A representing the asynchronous unit test. - [Test] - public async Task Dispose_DisposesInner() - { - var serial = new SerialDisposable(); - var disposed = 0; - serial.Disposable = new ActionDisposable(() => disposed++); - - serial.Dispose(); - await Assert.That(disposed).IsEqualTo(1); - } - - /// Verifies that setting a disposable after the serial is disposed, disposes it immediately. - /// A representing the asynchronous unit test. - [Test] - public async Task SetAfterDispose_DisposesImmediately() - { - var serial = new SerialDisposable(); - serial.Dispose(); - - var disposed = 0; - serial.Disposable = new ActionDisposable(() => disposed++); - await Assert.That(disposed).IsEqualTo(1); - } - - /// Verifies that disposing twice does not double-dispose the inner. - /// A representing the asynchronous unit test. - [Test] - public async Task Dispose_Twice_NoDoubleFree() - { - var serial = new SerialDisposable(); - var disposed = 0; - serial.Disposable = new ActionDisposable(() => disposed++); - - serial.Dispose(); - serial.Dispose(); - await Assert.That(disposed).IsEqualTo(1); - } - - /// Verifies that the Disposable getter returns the currently set disposable. - /// A representing the asynchronous unit test. - [Test] - public async Task Disposable_Getter_ReturnsCurrentValue() - { - var serial = new SerialDisposable(); - await Assert.That(serial.Disposable).IsNull(); - - var inner = new ActionDisposable(static () => { }); - serial.Disposable = inner; - await Assert.That(serial.Disposable).IsSameReferenceAs(inner); - } - - /// Verifies that setting Disposable to null disposes the old value. - /// A representing the asynchronous unit test. - [Test] - public async Task SetToNull_DisposesOldValue() - { - var serial = new SerialDisposable(); - var disposed = 0; - serial.Disposable = new ActionDisposable(() => disposed++); - - serial.Disposable = null; - await Assert.That(disposed).IsEqualTo(1); - } -} diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/SkipObservableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/SkipObservableTests.cs index b25ac2f0..77328444 100644 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/SkipObservableTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/Observables/SkipObservableTests.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Observables; namespace ReactiveUI.Binding.Tests.Observables; @@ -134,6 +135,7 @@ public async Task Subscribe_NullObserver_ThrowsArgumentNullException() private sealed class AnonymousObservable(Func, IDisposable> subscribe) : IObservable { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public IDisposable Subscribe(IObserver observer) => subscribe(observer); } @@ -145,12 +147,15 @@ private sealed class AnonymousObservable(Func, IDisposable> subs private sealed class AnonymousObserver(Action onNext, Action onError, Action onCompleted) : IObserver { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnCompleted() => onCompleted(); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnError(Exception error) => onError(error); /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnNext(T value) => onNext(value); } } diff --git a/src/tests/ReactiveUI.Binding.Tests/Observables/SwitchObservableTests.cs b/src/tests/ReactiveUI.Binding.Tests/Observables/SwitchObservableTests.cs deleted file mode 100644 index b6ea2a3b..00000000 --- a/src/tests/ReactiveUI.Binding.Tests/Observables/SwitchObservableTests.cs +++ /dev/null @@ -1,375 +0,0 @@ -// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved. -// ReactiveUI Association Incorporated licenses this file to you under the MIT license. -// See the LICENSE file in the project root for full license information. - -using System.Reactive.Subjects; -using ReactiveUI.Binding.Observables; - -namespace ReactiveUI.Binding.Tests.Observables; - -/// Unit tests for edge cases. -public class SwitchObservableTests -{ - /// A generic value emitted by an inner observable in tests. - private const int SampleValue = 42; - - /// A value emitted from a disposed inner observable that must be ignored. - private const int IgnoredValue = 99; - - /// The value emitted by the second inner observable. - private const int SecondInnerValue = 2; - - /// The expected number of emitted values when two inner emissions are received. - private const int ExpectedTwoEmissions = 2; - - /// Verifies that Subscribe throws ArgumentNullException when observer is null. - /// A representing the asynchronous unit test. - [Test] - public async Task Subscribe_NullObserver_ThrowsArgumentNullException() - { - var outerSubject = new Subject>(); - var switchObs = new SwitchObservable(outerSubject); - - var action = () => switchObs.Subscribe(null!); - - await Assert.That(action).ThrowsExactly(); - } - - /// Verifies that constructor throws ArgumentNullException when source is null. - /// A representing the asynchronous unit test. - [Test] - public async Task Constructor_NullSource_ThrowsArgumentNullException() - { - var action = static () => new SwitchObservable(null!); - - await Assert.That(action).ThrowsExactly(); - } - - /// Verifies that an error in the outer observable is propagated to the subscriber. - /// A representing the asynchronous unit test. - [Test] - public async Task OuterError_PropagatedToSubscriber() - { - var outerSubject = new Subject>(); - var switchObs = new SwitchObservable(outerSubject); - - Exception? receivedError = null; - var results = new List(); - - _ = switchObs.Subscribe(new AnonymousObserver( - results.Add, - ex => receivedError = ex, - static () => { })); - - var expectedError = new InvalidOperationException("outer error"); - outerSubject.OnError(expectedError); - - await Assert.That(receivedError).IsNotNull(); - await Assert.That(receivedError).IsEqualTo(expectedError); - await Assert.That(results).IsEmpty(); - } - - /// Verifies that an error in the inner observable is propagated to the subscriber. - /// A representing the asynchronous unit test. - [Test] - public async Task InnerError_PropagatedToSubscriber() - { - var outerSubject = new Subject>(); - var innerSubject = new Subject(); - var switchObs = new SwitchObservable(outerSubject); - - Exception? receivedError = null; - var results = new List(); - - _ = switchObs.Subscribe(new AnonymousObserver( - results.Add, - ex => receivedError = ex, - static () => { })); - - outerSubject.OnNext(innerSubject); - innerSubject.OnNext(SampleValue); - - var expectedError = new InvalidOperationException("inner error"); - innerSubject.OnError(expectedError); - - await Assert.That(results).Count().IsEqualTo(1); - await Assert.That(results[0]).IsEqualTo(SampleValue); - await Assert.That(receivedError).IsNotNull(); - await Assert.That(receivedError).IsEqualTo(expectedError); - } - - /// Verifies that rapid switching (new inner before old completes) causes only the latest inner to emit. - /// A representing the asynchronous unit test. - [Test] - public async Task RapidSwitching_OnlyLatestInnerEmits() - { - var outerSubject = new Subject>(); - var inner1 = new Subject(); - var inner2 = new Subject(); - var switchObs = new SwitchObservable(outerSubject); - - var results = new List(); - - _ = switchObs.Subscribe(new AnonymousObserver( - results.Add, - static _ => { }, - static () => { })); - - // Subscribe to first inner - outerSubject.OnNext(inner1); - inner1.OnNext(1); - - // Switch to second inner before first completes - outerSubject.OnNext(inner2); - - // Emit from old inner - should be ignored because it was disposed - inner1.OnNext(IgnoredValue); - - // Emit from new inner - should be received - inner2.OnNext(SecondInnerValue); - - await Assert.That(results).Count().IsEqualTo(ExpectedTwoEmissions); - await Assert.That(results[0]).IsEqualTo(1); - await Assert.That(results[1]).IsEqualTo(SecondInnerValue); - } - - /// Verifies that disposal during an active inner subscription stops all emissions. - /// A representing the asynchronous unit test. - [Test] - public async Task Disposal_DuringActiveInner_NoMoreEmissions() - { - var outerSubject = new Subject>(); - var innerSubject = new Subject(); - var switchObs = new SwitchObservable(outerSubject); - - var results = new List(); - - var subscription = switchObs.Subscribe(new AnonymousObserver( - results.Add, - static _ => { }, - static () => { })); - - outerSubject.OnNext(innerSubject); - innerSubject.OnNext(1); - - // Dispose the subscription - subscription.Dispose(); - - // Emit after disposal - should not be received - innerSubject.OnNext(SecondInnerValue); - outerSubject.OnNext(new Subject()); - - await Assert.That(results).Count().IsEqualTo(1); - await Assert.That(results[0]).IsEqualTo(1); - } - - /// Verifies that null inner observable is handled gracefully (no subscription). - /// A representing the asynchronous unit test. - [Test] - public async Task NullInnerObservable_IsIgnored() - { - var outerSubject = new Subject>(); - var switchObs = new SwitchObservable(outerSubject); - - var results = new List(); - - _ = switchObs.Subscribe(new AnonymousObserver( - results.Add, - static _ => { }, - static () => { })); - - outerSubject.OnNext(null!); - - await Assert.That(results).IsEmpty(); - } - - /// Verifies that double disposal does not throw. - /// A representing the asynchronous unit test. - [Test] - public async Task DoubleDisposal_DoesNotThrow() - { - var outerSubject = new Subject>(); - var switchObs = new SwitchObservable(outerSubject); - - var results = new List(); - - var subscription = switchObs.Subscribe(new AnonymousObserver( - results.Add, - static _ => { }, - static () => { })); - - subscription.Dispose(); - subscription.Dispose(); - - await Assert.That(results).IsEmpty(); - } - - /// Verifies that outer OnCompleted does not terminate the subscription. - /// A representing the asynchronous unit test. - [Test] - public async Task OuterCompleted_InnerStillEmits() - { - var outerSubject = new Subject>(); - var innerSubject = new Subject(); - var switchObs = new SwitchObservable(outerSubject); - - var results = new List(); - - _ = switchObs.Subscribe(new AnonymousObserver( - results.Add, - static _ => { }, - static () => { })); - - outerSubject.OnNext(innerSubject); - outerSubject.OnCompleted(); - - // Inner should still emit after outer completes - innerSubject.OnNext(SampleValue); - - await Assert.That(results).Count().IsEqualTo(1); - await Assert.That(results[0]).IsEqualTo(SampleValue); - } - - /// Verifies that outer OnNext after dispose is ignored. - /// A representing the asynchronous unit test. - [Test] - public async Task OuterOnNextAfterDispose_IsIgnored() - { - var outerSubject = new Subject>(); - var switchObs = new SwitchObservable(outerSubject); - - var results = new List(); - - var subscription = switchObs.Subscribe(new AnonymousObserver( - results.Add, - static _ => { }, - static () => { })); - - subscription.Dispose(); - - // Emit on outer after disposal - should be ignored - outerSubject.OnNext(new Subject()); - - await Assert.That(results).IsEmpty(); - } - - /// Verifies that outer error after dispose is ignored. - /// A representing the asynchronous unit test. - [Test] - public async Task OuterErrorAfterDispose_IsIgnored() - { - var outerSubject = new Subject>(); - var switchObs = new SwitchObservable(outerSubject); - - Exception? receivedError = null; - - var subscription = switchObs.Subscribe(new AnonymousObserver( - static _ => { }, - ex => receivedError = ex, - static () => { })); - - subscription.Dispose(); - - // Error on outer after disposal - should be ignored - outerSubject.OnError(new InvalidOperationException("should be ignored")); - - await Assert.That(receivedError).IsNull(); - } - - /// Verifies that inner error after parent dispose is ignored. - /// A representing the asynchronous unit test. - [Test] - public async Task InnerErrorAfterDispose_IsIgnored() - { - var outerSubject = new Subject>(); - var innerSubject = new Subject(); - var switchObs = new SwitchObservable(outerSubject); - - Exception? receivedError = null; - - var subscription = switchObs.Subscribe(new AnonymousObserver( - static _ => { }, - ex => receivedError = ex, - static () => { })); - - outerSubject.OnNext(innerSubject); - subscription.Dispose(); - - // Error on inner after parent disposal - should be ignored - innerSubject.OnError(new InvalidOperationException("should be ignored")); - - await Assert.That(receivedError).IsNull(); - } - - /// Verifies that inner OnCompleted does not propagate to the subscriber. - /// A representing the asynchronous unit test. - [Test] - public async Task InnerCompleted_DoesNotPropagateToSubscriber() - { - var outerSubject = new Subject>(); - var innerSubject = new Subject(); - var switchObs = new SwitchObservable(outerSubject); - - var completed = false; - var results = new List(); - - _ = switchObs.Subscribe(new AnonymousObserver( - results.Add, - static _ => { }, - () => completed = true)); - - outerSubject.OnNext(innerSubject); - innerSubject.OnNext(1); - innerSubject.OnCompleted(); - - await Assert.That(completed).IsFalse(); - await Assert.That(results).Count().IsEqualTo(1); - } - - /// - /// Verifies that OnNext on the outer observable after dispose is ignored when the outer - /// observable does not respect disposal (ManualObservable pattern). This covers - /// SwitchObservable line 59 (_disposed != 0 TRUE branch). - /// - /// A representing the asynchronous unit test. - [Test] - public async Task OnNext_AfterDispose_ViaManualObservable_IsIgnored() - { - var manualOuter = new TestModels.ManualObservable>(); - var switchObs = new SwitchObservable(manualOuter); - - var results = new List(); - - var subscription = switchObs.Subscribe(new AnonymousObserver( - results.Add, - static _ => { }, - static () => { })); - - // Dispose the subscription - subscription.Dispose(); - - // Now call OnNext on the outer observer even after dispose - // ManualObservable retains the observer reference regardless of disposal - manualOuter.Observer?.OnNext(Observable.Return(SampleValue)); - - // The OnNext should have been ignored due to _disposed != 0 - await Assert.That(results).IsEmpty(); - } - - /// A simple observer that delegates to provided actions. - /// The type of elements observed. - /// The action to invoke for each element. - /// The action to invoke on error. - /// The action to invoke on completion. - private sealed class AnonymousObserver(Action onNext, Action onError, Action onCompleted) : IObserver - { - /// - public void OnCompleted() => onCompleted(); - - /// - public void OnError(Exception error) => onError(error); - - /// - public void OnNext(T value) => onNext(value); - } -} diff --git a/src/tests/ReactiveUI.Binding.Tests/ReactiveUI.Binding.Tests.csproj b/src/tests/ReactiveUI.Binding.Tests/ReactiveUI.Binding.Tests.csproj index 0965b53f..64ae57be 100644 --- a/src/tests/ReactiveUI.Binding.Tests/ReactiveUI.Binding.Tests.csproj +++ b/src/tests/ReactiveUI.Binding.Tests/ReactiveUI.Binding.Tests.csproj @@ -7,6 +7,7 @@ + diff --git a/src/tests/ReactiveUI.Binding.Tests/TestModels/HostTestFixture.cs b/src/tests/ReactiveUI.Binding.Tests/TestModels/HostTestFixture.cs index 644c8cd7..db253d68 100644 --- a/src/tests/ReactiveUI.Binding.Tests/TestModels/HostTestFixture.cs +++ b/src/tests/ReactiveUI.Binding.Tests/TestModels/HostTestFixture.cs @@ -72,11 +72,13 @@ public NonObservableTestFixture? PocoChild /// Raises the PropertyChanging event. /// The property name. + [MethodImpl(MethodImplOptions.AggressiveInlining)] protected void OnPropertyChanging([CallerMemberName] string? propertyName = null) => PropertyChanging?.Invoke(this, new(propertyName)); /// Raises the PropertyChanged event. /// The property name. + [MethodImpl(MethodImplOptions.AggressiveInlining)] protected void OnPropertyChanged([CallerMemberName] string? propertyName = null) => PropertyChanged?.Invoke(this, new(propertyName)); } diff --git a/src/tests/ReactiveUI.Binding.Tests/TestModels/LateRegistrationFixture.cs b/src/tests/ReactiveUI.Binding.Tests/TestModels/LateRegistrationFixture.cs index 58231f86..b5936979 100644 --- a/src/tests/ReactiveUI.Binding.Tests/TestModels/LateRegistrationFixture.cs +++ b/src/tests/ReactiveUI.Binding.Tests/TestModels/LateRegistrationFixture.cs @@ -56,6 +56,7 @@ public string Title /// Raises the PropertyChanged event. /// The property name. + [MethodImpl(MethodImplOptions.AggressiveInlining)] protected void OnPropertyChanged([CallerMemberName] string? propertyName = null) => PropertyChanged?.Invoke(this, new(propertyName)); } diff --git a/src/tests/ReactiveUI.Binding.Tests/TestModels/NonReactiveINotifyPropertyChangedObject.cs b/src/tests/ReactiveUI.Binding.Tests/TestModels/NonReactiveINotifyPropertyChangedObject.cs index dab2190f..c766d922 100644 --- a/src/tests/ReactiveUI.Binding.Tests/TestModels/NonReactiveINotifyPropertyChangedObject.cs +++ b/src/tests/ReactiveUI.Binding.Tests/TestModels/NonReactiveINotifyPropertyChangedObject.cs @@ -34,6 +34,7 @@ public string InpcProperty /// Raises the PropertyChanged event. /// The property name. + [MethodImpl(MethodImplOptions.AggressiveInlining)] protected void OnPropertyChanged([CallerMemberName] string? propertyName = null) => PropertyChanged?.Invoke(this, new(propertyName)); } diff --git a/src/tests/ReactiveUI.Binding.Tests/TestModels/ObjChain1.cs b/src/tests/ReactiveUI.Binding.Tests/TestModels/ObjChain1.cs index b27648b5..42ba8545 100644 --- a/src/tests/ReactiveUI.Binding.Tests/TestModels/ObjChain1.cs +++ b/src/tests/ReactiveUI.Binding.Tests/TestModels/ObjChain1.cs @@ -31,6 +31,7 @@ public ObjChain2? Chain2 /// Raises the PropertyChanged event. /// The property name. + [MethodImpl(MethodImplOptions.AggressiveInlining)] protected void OnPropertyChanged([CallerMemberName] string? propertyName = null) => PropertyChanged?.Invoke(this, new(propertyName)); } diff --git a/src/tests/ReactiveUI.Binding.Tests/TestModels/ObjChain2.cs b/src/tests/ReactiveUI.Binding.Tests/TestModels/ObjChain2.cs index fedafb23..365fcb60 100644 --- a/src/tests/ReactiveUI.Binding.Tests/TestModels/ObjChain2.cs +++ b/src/tests/ReactiveUI.Binding.Tests/TestModels/ObjChain2.cs @@ -31,6 +31,7 @@ public ObjChain3? Chain3 /// Raises the PropertyChanged event. /// The property name. + [MethodImpl(MethodImplOptions.AggressiveInlining)] protected void OnPropertyChanged([CallerMemberName] string? propertyName = null) => PropertyChanged?.Invoke(this, new(propertyName)); } diff --git a/src/tests/ReactiveUI.Binding.Tests/TestModels/ObjChain3.cs b/src/tests/ReactiveUI.Binding.Tests/TestModels/ObjChain3.cs index c8297ed8..cd854270 100644 --- a/src/tests/ReactiveUI.Binding.Tests/TestModels/ObjChain3.cs +++ b/src/tests/ReactiveUI.Binding.Tests/TestModels/ObjChain3.cs @@ -31,6 +31,7 @@ public HostTestFixture? Host /// Raises the PropertyChanged event. /// The property name. + [MethodImpl(MethodImplOptions.AggressiveInlining)] protected void OnPropertyChanged([CallerMemberName] string? propertyName = null) => PropertyChanged?.Invoke(this, new(propertyName)); } diff --git a/src/tests/ReactiveUI.Binding.Tests/TestModels/ObservedValueFixture.cs b/src/tests/ReactiveUI.Binding.Tests/TestModels/ObservedValueFixture.cs index 263383f3..4de30309 100644 --- a/src/tests/ReactiveUI.Binding.Tests/TestModels/ObservedValueFixture.cs +++ b/src/tests/ReactiveUI.Binding.Tests/TestModels/ObservedValueFixture.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System.ComponentModel; +using System.Runtime.CompilerServices; namespace ReactiveUI.Binding.Tests.TestModels; @@ -35,5 +36,6 @@ public string Value = string.Empty; /// Raises a change notification for without altering it. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void RaiseValueChanged() => PropertyChanged?.Invoke(this, new(nameof(Value))); } diff --git a/src/tests/ReactiveUI.Binding.Tests/TestModels/OwnerClass.cs b/src/tests/ReactiveUI.Binding.Tests/TestModels/OwnerClass.cs index 58b2eaee..6ea1a443 100644 --- a/src/tests/ReactiveUI.Binding.Tests/TestModels/OwnerClass.cs +++ b/src/tests/ReactiveUI.Binding.Tests/TestModels/OwnerClass.cs @@ -31,6 +31,7 @@ public string Name /// Raises the PropertyChanged event. /// The property name. + [MethodImpl(MethodImplOptions.AggressiveInlining)] protected void OnPropertyChanged([CallerMemberName] string? propertyName = null) => PropertyChanged?.Invoke(this, new(propertyName)); } diff --git a/src/tests/ReactiveUI.Binding.Tests/TestModels/StubBindingTypeConverter.cs b/src/tests/ReactiveUI.Binding.Tests/TestModels/StubBindingTypeConverter.cs index 1b8d4eb3..ea87db8b 100644 --- a/src/tests/ReactiveUI.Binding.Tests/TestModels/StubBindingTypeConverter.cs +++ b/src/tests/ReactiveUI.Binding.Tests/TestModels/StubBindingTypeConverter.cs @@ -2,6 +2,8 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; + namespace ReactiveUI.Binding.Tests.TestModels; /// A stub implementation of for testing. @@ -11,7 +13,7 @@ public class StubBindingTypeConverter : IBindingTypeConverter private const int StubAffinity = 10; /// The conversion logic. - private readonly Func _tryConvert; + private readonly Func _tryConvert; /// Initializes a new instance of the class. /// The source type. @@ -20,7 +22,7 @@ public class StubBindingTypeConverter : IBindingTypeConverter public StubBindingTypeConverter( Type fromType, Type toType, - Func tryConvert) + Func tryConvert) { FromType = fromType; ToType = toType; @@ -34,6 +36,7 @@ public StubBindingTypeConverter( public Type ToType { get; } /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public int GetAffinityForObjects() => StubAffinity; /// diff --git a/src/tests/ReactiveUI.Binding.Tests/TestModels/StubFallbackConverter.cs b/src/tests/ReactiveUI.Binding.Tests/TestModels/StubFallbackConverter.cs index 49353e24..45999d25 100644 --- a/src/tests/ReactiveUI.Binding.Tests/TestModels/StubFallbackConverter.cs +++ b/src/tests/ReactiveUI.Binding.Tests/TestModels/StubFallbackConverter.cs @@ -2,6 +2,8 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; + namespace ReactiveUI.Binding.Tests.TestModels; /// A stub implementation of for testing. @@ -11,14 +13,15 @@ public class StubFallbackConverter : IBindingFallbackConverter private const int StubAffinity = 5; /// The conversion logic. - private readonly Func _tryConvert; + private readonly Func _tryConvert; /// Initializes a new instance of the class. /// The conversion logic. - public StubFallbackConverter(Func tryConvert) => + public StubFallbackConverter(Func tryConvert) => _tryConvert = tryConvert; /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public int GetAffinityForObjects(Type fromType, Type toType) => StubAffinity; /// diff --git a/src/tests/ReactiveUI.Binding.Tests/TestModels/StubSetMethodBindingConverter.cs b/src/tests/ReactiveUI.Binding.Tests/TestModels/StubSetMethodBindingConverter.cs index 21d37efc..b3588a26 100644 --- a/src/tests/ReactiveUI.Binding.Tests/TestModels/StubSetMethodBindingConverter.cs +++ b/src/tests/ReactiveUI.Binding.Tests/TestModels/StubSetMethodBindingConverter.cs @@ -2,6 +2,8 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; + namespace ReactiveUI.Binding.Tests.TestModels; /// A stub implementation of for testing. @@ -24,8 +26,10 @@ public StubSetMethodBindingConverter() public StubSetMethodBindingConverter(int affinity) => _affinity = affinity; /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public int GetAffinityForObjects(Type? fromType, Type? toType) => _affinity; /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public object? PerformSet(object? toTarget, object? newValue, object?[]? arguments) => newValue; } diff --git a/src/tests/ReactiveUI.Binding.Tests/TestModels/TestFixture.cs b/src/tests/ReactiveUI.Binding.Tests/TestModels/TestFixture.cs index 3d8697d2..632f5f35 100644 --- a/src/tests/ReactiveUI.Binding.Tests/TestModels/TestFixture.cs +++ b/src/tests/ReactiveUI.Binding.Tests/TestModels/TestFixture.cs @@ -106,11 +106,13 @@ public string UsesExprRaiseSet /// Raises the PropertyChanging event. /// The property name. + [MethodImpl(MethodImplOptions.AggressiveInlining)] protected void OnPropertyChanging([CallerMemberName] string? propertyName = null) => PropertyChanging?.Invoke(this, new(propertyName)); /// Raises the PropertyChanged event. /// The property name. + [MethodImpl(MethodImplOptions.AggressiveInlining)] protected void OnPropertyChanged([CallerMemberName] string? propertyName = null) => PropertyChanged?.Invoke(this, new(propertyName)); } diff --git a/src/tests/ReactiveUI.Binding.Tests/TestModels/TestViewModel.cs b/src/tests/ReactiveUI.Binding.Tests/TestModels/TestViewModel.cs index 07d18c57..41d33c7f 100644 --- a/src/tests/ReactiveUI.Binding.Tests/TestModels/TestViewModel.cs +++ b/src/tests/ReactiveUI.Binding.Tests/TestModels/TestViewModel.cs @@ -69,11 +69,13 @@ public TestAddress? Address /// Raises the PropertyChanging event. /// The property name. + [MethodImpl(MethodImplOptions.AggressiveInlining)] protected void OnPropertyChanging([CallerMemberName] string? propertyName = null) => PropertyChanging?.Invoke(this, new(propertyName)); /// Raises the PropertyChanged event. /// The property name. + [MethodImpl(MethodImplOptions.AggressiveInlining)] protected void OnPropertyChanged([CallerMemberName] string? propertyName = null) => PropertyChanged?.Invoke(this, new(propertyName)); } diff --git a/src/tests/ReactiveUI.Binding.Tests/TestModels/TestWhenAnyObsViewModel.cs b/src/tests/ReactiveUI.Binding.Tests/TestModels/TestWhenAnyObsViewModel.cs index 3916051f..2946ad44 100644 --- a/src/tests/ReactiveUI.Binding.Tests/TestModels/TestWhenAnyObsViewModel.cs +++ b/src/tests/ReactiveUI.Binding.Tests/TestModels/TestWhenAnyObsViewModel.cs @@ -79,6 +79,7 @@ public IObservable? Changes /// Raises the PropertyChanged event. /// The property name. + [MethodImpl(MethodImplOptions.AggressiveInlining)] protected void OnPropertyChanged([CallerMemberName] string? propertyName = null) => PropertyChanged?.Invoke(this, new(propertyName)); } diff --git a/src/tests/ReactiveUI.Binding.Tests/TestModels/WhenAnyTestFixture.cs b/src/tests/ReactiveUI.Binding.Tests/TestModels/WhenAnyTestFixture.cs index 7dff382e..7dd00894 100644 --- a/src/tests/ReactiveUI.Binding.Tests/TestModels/WhenAnyTestFixture.cs +++ b/src/tests/ReactiveUI.Binding.Tests/TestModels/WhenAnyTestFixture.cs @@ -207,6 +207,7 @@ public string Value12 /// Raises the PropertyChanged event. /// The property name. + [MethodImpl(MethodImplOptions.AggressiveInlining)] protected void OnPropertyChanged([CallerMemberName] string? propertyName = null) => PropertyChanged?.Invoke(this, new(propertyName)); } diff --git a/src/tests/ReactiveUI.Binding.Tests/View/ViewLocatorTests.cs b/src/tests/ReactiveUI.Binding.Tests/View/ViewLocatorTests.cs index 2282f060..f4f8f7cb 100644 --- a/src/tests/ReactiveUI.Binding.Tests/View/ViewLocatorTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/View/ViewLocatorTests.cs @@ -33,8 +33,6 @@ public async Task GetCurrent_NotRegistered_ThrowsViewLocatorNotFoundException() // Reset without rebuilding to ensure no IViewLocator is registered RxBindingBuilder.ResetForTesting(); - var action = ViewLocator.GetCurrent; - - await Assert.That(action).ThrowsException(); + await Assert.That(ViewLocator.GetCurrent).ThrowsException(); } } diff --git a/src/tests/ReactiveUI.Binding.Tests/WhenAny/ExpressionChainNotificationTests.cs b/src/tests/ReactiveUI.Binding.Tests/WhenAny/ExpressionChainNotificationTests.cs index a3bf92b1..f65ec719 100644 --- a/src/tests/ReactiveUI.Binding.Tests/WhenAny/ExpressionChainNotificationTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/WhenAny/ExpressionChainNotificationTests.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Builder; using ReactiveUI.Binding.ObservableForProperty; using ReactiveUI.Binding.Tests.TestModels; @@ -127,6 +128,7 @@ private sealed class ChainRecorder : IObserver + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnNext(IObservedChange value) => Values.Add(value); /// @@ -156,6 +158,7 @@ public int GetAffinityForObject(Type type, string propertyName, bool beforeChang type == typeof(ObservedValueFixture) ? WinningAffinity : 0; /// Forgets the previous test's subscribers so each starts from an empty stream. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Reset() => _observers.Clear(); /// @@ -239,6 +242,7 @@ private sealed record ChainContext( IDisposable Subscription) : IDisposable { /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Dispose() => Subscription.Dispose(); } } diff --git a/src/tests/ReactiveUI.Binding.Tests/WhenAny/ExpressionChainTests.cs b/src/tests/ReactiveUI.Binding.Tests/WhenAny/ExpressionChainTests.cs index 34ea05f2..c60ce724 100644 --- a/src/tests/ReactiveUI.Binding.Tests/WhenAny/ExpressionChainTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/WhenAny/ExpressionChainTests.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using ReactiveUI.Binding.Builder; using ReactiveUI.Binding.ObservableForProperty; using ReactiveUI.Binding.Tests.TestModels; @@ -233,6 +234,7 @@ private sealed class Recorder : IObserver + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnNext(IObservedChange value) => Values.Add(value); /// diff --git a/src/tests/ReactiveUI.Binding.Tests/WhenAny/WhenAnyValueMultiPropertyTests.cs b/src/tests/ReactiveUI.Binding.Tests/WhenAny/WhenAnyValueMultiPropertyTests.cs index 5520be4a..d5ded3ab 100644 --- a/src/tests/ReactiveUI.Binding.Tests/WhenAny/WhenAnyValueMultiPropertyTests.cs +++ b/src/tests/ReactiveUI.Binding.Tests/WhenAny/WhenAnyValueMultiPropertyTests.cs @@ -44,14 +44,14 @@ public async Task WhenAnyValue_2Properties() EnsureInitialized(); var fixture = new WhenAnyTestFixture { Value1 = "A", Value2 = "B" }; - var values = new List<(string property1, string property2)>(); + var values = new List<(string Property1, string Property2)>(); using var sub = fixture.WhenAnyValue(x => x.Value1, x => x.Value2) .Subscribe(values.Add); await Assert.That(values.Count).IsGreaterThanOrEqualTo(1); - await Assert.That(values[0].property1).IsEqualTo("A"); - await Assert.That(values[0].property2).IsEqualTo("B"); + await Assert.That(values[0].Property1).IsEqualTo("A"); + await Assert.That(values[0].Property2).IsEqualTo("B"); } /// Verifies that WhenAnyValue with 3 properties emits tuples. @@ -62,15 +62,15 @@ public async Task WhenAnyValue_3Properties() EnsureInitialized(); var fixture = new WhenAnyTestFixture { Value1 = "A", Value2 = "B", Value3 = "C" }; - var values = new List<(string property1, string property2, string property3)>(); + var values = new List<(string Property1, string Property2, string Property3)>(); using var sub = fixture.WhenAnyValue(x => x.Value1, x => x.Value2, x => x.Value3) .Subscribe(values.Add); await Assert.That(values.Count).IsGreaterThanOrEqualTo(1); - await Assert.That(values[0].property1).IsEqualTo("A"); - await Assert.That(values[0].property2).IsEqualTo("B"); - await Assert.That(values[0].property3).IsEqualTo("C"); + await Assert.That(values[0].Property1).IsEqualTo("A"); + await Assert.That(values[0].Property2).IsEqualTo("B"); + await Assert.That(values[0].Property3).IsEqualTo("C"); } /// Verifies that WhenAnyValue with 4 properties emits tuples. @@ -81,7 +81,7 @@ public async Task WhenAnyValue_4Properties() EnsureInitialized(); var fixture = new WhenAnyTestFixture { Value1 = "A", Value2 = "B", Value3 = "C", Value4 = "D" }; - var values = new List<(string property1, string property2, string property3, string property4)>(); + var values = new List<(string Property1, string Property2, string Property3, string Property4)>(); using var sub = fixture.WhenAnyValue( x => x.Value1, @@ -91,8 +91,8 @@ public async Task WhenAnyValue_4Properties() .Subscribe(values.Add); await Assert.That(values.Count).IsGreaterThanOrEqualTo(1); - await Assert.That(values[0].property1).IsEqualTo("A"); - await Assert.That(values[0].property4).IsEqualTo("D"); + await Assert.That(values[0].Property1).IsEqualTo("A"); + await Assert.That(values[0].Property4).IsEqualTo("D"); } /// Verifies that WhenAnyValue with 5 properties emits tuples. @@ -104,7 +104,7 @@ public async Task WhenAnyValue_5Properties() var fixture = new WhenAnyTestFixture { Value1 = "A", Value2 = "B", Value3 = "C", Value4 = "D", Value5 = "E" }; var values = - new List<(string property1, string property2, string property3, string property4, string property5)>(); + new List<(string Property1, string Property2, string Property3, string Property4, string Property5)>(); using var sub = fixture.WhenAnyValue( x => x.Value1, @@ -115,8 +115,8 @@ public async Task WhenAnyValue_5Properties() .Subscribe(values.Add); await Assert.That(values.Count).IsGreaterThanOrEqualTo(1); - await Assert.That(values[0].property1).IsEqualTo("A"); - await Assert.That(values[0].property5).IsEqualTo("E"); + await Assert.That(values[0].Property1).IsEqualTo("A"); + await Assert.That(values[0].Property5).IsEqualTo("E"); } /// Verifies that WhenAnyValue with 6 properties emits tuples. @@ -128,8 +128,8 @@ public async Task WhenAnyValue_6Properties() var fixture = new WhenAnyTestFixture { Value1 = "A", Value2 = "B", Value3 = "C", Value4 = "D", Value5 = "E", Value6 = "F" }; var values = - new List<(string property1, string property2, string property3, string property4, string property5, string - property6)>(); + new List<(string Property1, string Property2, string Property3, string Property4, string Property5, string + Property6)>(); using var sub = fixture.WhenAnyValue( x => x.Value1, @@ -141,8 +141,8 @@ public async Task WhenAnyValue_6Properties() .Subscribe(values.Add); await Assert.That(values.Count).IsGreaterThanOrEqualTo(1); - await Assert.That(values[0].property1).IsEqualTo("A"); - await Assert.That(values[0].property6).IsEqualTo("F"); + await Assert.That(values[0].Property1).IsEqualTo("A"); + await Assert.That(values[0].Property6).IsEqualTo("F"); } /// Verifies that WhenAnyValue with 7 properties emits tuples. @@ -154,8 +154,8 @@ public async Task WhenAnyValue_7Properties() var fixture = new WhenAnyTestFixture { Value1 = "A", Value2 = "B", Value3 = "C", Value4 = "D", Value5 = "E", Value6 = "F", Value7 = "G" }; var values = - new List<(string property1, string property2, string property3, string property4, string property5, string - property6, string property7)>(); + new List<(string Property1, string Property2, string Property3, string Property4, string Property5, string + Property6, string Property7)>(); using var sub = fixture.WhenAnyValue( x => x.Value1, @@ -168,7 +168,7 @@ public async Task WhenAnyValue_7Properties() .Subscribe(values.Add); await Assert.That(values.Count).IsGreaterThanOrEqualTo(1); - await Assert.That(values[0].property7).IsEqualTo("G"); + await Assert.That(values[0].Property7).IsEqualTo("G"); } /// Verifies that WhenAnyValue with 8 properties emits tuples. @@ -191,7 +191,7 @@ public async Task WhenAnyValue_8Properties() x => x.Value6, x => x.Value7, x => x.Value8) - .Subscribe(v => lastItem8 = v.property8); + .Subscribe(v => lastItem8 = v.Property8); await Assert.That(lastItem8).IsEqualTo("H"); } @@ -217,7 +217,7 @@ public async Task WhenAnyValue_9Properties() x => x.Value7, x => x.Value8, x => x.Value9) - .Subscribe(v => lastItem9 = v.property9); + .Subscribe(v => lastItem9 = v.Property9); await Assert.That(lastItem9).IsEqualTo("I"); } @@ -244,7 +244,7 @@ public async Task WhenAnyValue_10Properties() x => x.Value8, x => x.Value9, x => x.Value10) - .Subscribe(v => lastItem10 = v.property10); + .Subscribe(v => lastItem10 = v.Property10); await Assert.That(lastItem10).IsEqualTo("J"); } @@ -268,7 +268,7 @@ public async Task WhenAnyValue_11Properties() Value8 = "H", Value9 = "I", Value10 = "J", - Value11 = "K" + Value11 = "K", }; string? lastItem11 = null; @@ -285,7 +285,7 @@ public async Task WhenAnyValue_11Properties() x => x.Value9, x => x.Value10, x => x.Value11) - .Subscribe(v => lastItem11 = v.property11); + .Subscribe(v => lastItem11 = v.Property11); await Assert.That(lastItem11).IsEqualTo("K"); } @@ -310,7 +310,7 @@ public async Task WhenAnyValue_12Properties() Value9 = "I", Value10 = "J", Value11 = "K", - Value12 = "L" + Value12 = "L", }; string? lastItem12 = null; @@ -328,7 +328,7 @@ public async Task WhenAnyValue_12Properties() x => x.Value10, x => x.Value11, x => x.Value12) - .Subscribe(v => lastItem12 = v.property12); + .Subscribe(v => lastItem12 = v.Property12); await Assert.That(lastItem12).IsEqualTo("L"); } diff --git a/src/tests/ReactiveUI.Binding.WinForms.Tests/WinFormsCreatesObservableForPropertyTests.cs b/src/tests/ReactiveUI.Binding.WinForms.Tests/WinFormsCreatesObservableForPropertyTests.cs index 11ebb2c5..ab830bee 100644 --- a/src/tests/ReactiveUI.Binding.WinForms.Tests/WinFormsCreatesObservableForPropertyTests.cs +++ b/src/tests/ReactiveUI.Binding.WinForms.Tests/WinFormsCreatesObservableForPropertyTests.cs @@ -4,6 +4,7 @@ using System.ComponentModel; using System.Linq.Expressions; +using System.Runtime.CompilerServices; namespace ReactiveUI.Binding.WinForms.Tests; @@ -170,6 +171,7 @@ public void OnCompleted() public void OnError(Exception error) => throw error; /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void OnNext(IObservedChange value) => onNext(); } } diff --git a/src/tests/ReactiveUI.Binding.Wpf.Tests/ActionDisposableTests.cs b/src/tests/ReactiveUI.Binding.Wpf.Tests/ActionDisposableTests.cs deleted file mode 100644 index 586a2f93..00000000 --- a/src/tests/ReactiveUI.Binding.Wpf.Tests/ActionDisposableTests.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved. -// ReactiveUI Association Incorporated licenses this file to you under the MIT license. -// See the LICENSE file in the project root for full license information. - -namespace ReactiveUI.Binding.Wpf.Tests; - -/// -/// Tests for the state-carrying teardown disposable the platform observers unhook with. It is compiled -/// privately into each platform assembly rather than shared, so it is exercised through one of them. -/// -public class ActionDisposableTests -{ - /// The state value handed to the teardown action. - private const int StateValue = 42; - - /// The number of times a teardown action may run however often Dispose is called. - private const int ExpectedRuns = 1; - - /// Verifies that disposing runs the teardown action against the state it was given. - /// A task representing the asynchronous operation. - [Test] - public async Task Dispose_RunsTheActionWithItsState() - { - var seen = 0; - var disposable = new ActionDisposable(StateValue, state => seen = state); - - disposable.Dispose(); - - await Assert.That(seen).IsEqualTo(StateValue); - } - - /// Verifies that a second Dispose is a no-op, so an observer cannot unhook twice. - /// A task representing the asynchronous operation. - [Test] - public async Task Dispose_CalledTwice_RunsTheActionOnce() - { - var runs = 0; - var disposable = new ActionDisposable(StateValue, _ => runs++); - - disposable.Dispose(); - disposable.Dispose(); - - await Assert.That(runs).IsEqualTo(ExpectedRuns); - } - - /// Verifies that a null teardown action is rejected at construction, not at disposal. - /// A task representing the asynchronous operation. - [Test] - public async Task Constructor_NullAction_ThrowsArgumentNullException() => - await Assert.That(static () => new ActionDisposable(StateValue, null!)) - .ThrowsExactly(); -} diff --git a/src/tests/ReactiveUI.Binding.Wpf.Tests/DependencyObjectObservableForPropertyTests.cs b/src/tests/ReactiveUI.Binding.Wpf.Tests/DependencyObjectObservableForPropertyTests.cs new file mode 100644 index 00000000..a927360f --- /dev/null +++ b/src/tests/ReactiveUI.Binding.Wpf.Tests/DependencyObjectObservableForPropertyTests.cs @@ -0,0 +1,169 @@ +// Copyright (c) 2019-2026 ReactiveUI Association Incorporated. All rights reserved. +// ReactiveUI Association Incorporated licenses this file to you under the MIT license. +// See the LICENSE file in the project root for full license information. + +using System.Runtime.CompilerServices; +using System.Windows; + +namespace ReactiveUI.Binding.Wpf.Tests; + +/// +/// Tests for the WPF observation factory that watches a . Every +/// dependency object here is created and mutated before the first await, because a dependency object +/// has thread affinity and an await may resume the test on another thread. +/// +/// +/// Serialized: these share one static , and the value-changed +/// subscription that DependencyPropertyDescriptor.AddValueChanged installs lives in a +/// process-wide table keyed by that property. Run in parallel they race on it, which shows up as an +/// occasional failure rather than a consistent one. +/// +[NotInParallel] +public class DependencyObjectObservableForPropertyTests +{ + /// The value written to trigger the first change notification. + private const string FirstValue = "first"; + + /// The value written after the subscription has been disposed. + private const string SecondValue = "second"; + + /// Verifies that a dependency-property-backed property scores the WPF affinity. + /// A task representing the asynchronous test operation. + [Test] + public async Task GetAffinityForObject_DependencyProperty_ScoresAsWpfDependencyObject() => + await Assert.That(new DependencyObjectObservableForProperty() + .GetAffinityForObject(typeof(Fixture), nameof(Fixture.Value), false)) + .IsEqualTo(BindingAffinity.WpfDependencyObject); + + /// Verifies that a type which is not a dependency object does not match at all. + /// A task representing the asynchronous test operation. + [Test] + public async Task GetAffinityForObject_NonDependencyObject_ScoresZero() => + await Assert.That(new DependencyObjectObservableForProperty() + .GetAffinityForObject(typeof(string), nameof(string.Length), false)) + .IsEqualTo(0); + + /// Verifies that a dependency object without a matching dependency property does not match. + /// A task representing the asynchronous test operation. + [Test] + public async Task GetAffinityForObject_PropertyWithoutDependencyProperty_ScoresZero() => + await Assert.That(new DependencyObjectObservableForProperty() + .GetAffinityForObject(typeof(Fixture), nameof(Fixture.Plain), false)) + .IsEqualTo(0); + + /// Verifies that changing the dependency property notifies the subscriber. + /// A task representing the asynchronous test operation. + [Test] + public async Task GetNotificationForProperty_EmitsWhenTheDependencyPropertyChanges() + { + var target = new Fixture(); + var recorder = new Recorder(); + + using (new DependencyObjectObservableForProperty() + .GetNotificationForProperty(target, ValueExpression(), nameof(Fixture.Value), false, false) + .Subscribe(recorder)) + { + target.Value = FirstValue; + } + + await Assert.That(recorder.Count).IsEqualTo(1); + await Assert.That(recorder.Last!.Sender).IsSameReferenceAs(target); + } + + /// + /// Verifies that disposing the subscription unhooks the value-changed handler. This is the teardown + /// the observation hands back, and without it the descriptor keeps the target alive and emitting. + /// + /// A task representing the asynchronous test operation. + [Test] + public async Task GetNotificationForProperty_StopsEmittingOnceDisposed() + { + var target = new Fixture(); + var recorder = new Recorder(); + + var subscription = new DependencyObjectObservableForProperty() + .GetNotificationForProperty(target, ValueExpression(), nameof(Fixture.Value), false, false) + .Subscribe(recorder); + + target.Value = FirstValue; + subscription.Dispose(); + target.Value = SecondValue; + + await Assert.That(recorder.Count).IsEqualTo(1); + } + + /// Verifies that observing a property with no dependency property behind it is rejected. + /// A task representing the asynchronous test operation. + [Test] + public async Task GetNotificationForProperty_PropertyWithoutDependencyProperty_Throws() + { + var target = new Fixture(); + + await Assert.That(() => new DependencyObjectObservableForProperty() + .GetNotificationForProperty(target, ValueExpression(), nameof(Fixture.Plain), false, false)) + .Throws(); + } + + /// Verifies that a null sender is rejected. + /// A task representing the asynchronous test operation. + [Test] + public async Task GetNotificationForProperty_NullSender_Throws() => + await Assert.That(static () => new DependencyObjectObservableForProperty() + .GetNotificationForProperty(null!, ValueExpression(), nameof(Fixture.Value), false, false)) + .Throws(); + + /// Builds the member expression the observation carries on its observed changes. + /// The body of an expression selecting . + /// Fully qualified: System.Windows declares an Expression of its own. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static System.Linq.Expressions.Expression ValueExpression() => + ((System.Linq.Expressions.Expression>)(x => x.Value)).Body; + + /// A minimal dependency object, so the tests do not need a visual tree or an STA thread. + private sealed class Fixture : DependencyObject + { + /// Identifies the dependency property. + public static readonly DependencyProperty ValueProperty = DependencyProperty.Register( + nameof(Value), + typeof(string), + typeof(Fixture), + new(default(string))); + + /// Gets or sets the observed dependency property. + public string? Value + { + get => (string?)GetValue(ValueProperty); + set => SetValue(ValueProperty, value); + } + + /// Gets a plain property with no dependency property behind it. + public string Plain => nameof(Plain); + } + + /// Records the observed changes a subscription delivers. + private sealed class Recorder : IObserver> + { + /// Gets the number of changes observed. + public int Count { get; private set; } + + /// Gets the most recently observed change. + public IObservedChange? Last { get; private set; } + + /// + public void OnNext(IObservedChange value) + { + Count++; + Last = value; + } + + /// + public void OnError(Exception error) + { + } + + /// + public void OnCompleted() + { + } + } +} diff --git a/src/tests/SharedScenarios/Bind/MultipleBindings/Scenario.cs b/src/tests/SharedScenarios/Bind/MultipleBindings/Scenario.cs index f6f4d819..fb6e938d 100644 --- a/src/tests/SharedScenarios/Bind/MultipleBindings/Scenario.cs +++ b/src/tests/SharedScenarios/Bind/MultipleBindings/Scenario.cs @@ -13,8 +13,8 @@ public static class Scenario /// The target view. /// The source view model. /// A tuple of bindings. - public static (IReactiveBinding name, - IReactiveBinding age) Execute(MyView view, MyViewModel vm) => + public static (IReactiveBinding Name, + IReactiveBinding Age) Execute(MyView view, MyViewModel vm) => (view.Bind(vm, x => x.Name, x => x.NameText), view.Bind(vm, x => x.Age, x => x.AgeText)); } diff --git a/src/tests/SharedScenarios/Bind/SinglePropertyStringToString/Scenario.cs b/src/tests/SharedScenarios/Bind/SinglePropertyStringToString/Scenario.cs index bd3740ef..7a1afe2f 100644 --- a/src/tests/SharedScenarios/Bind/SinglePropertyStringToString/Scenario.cs +++ b/src/tests/SharedScenarios/Bind/SinglePropertyStringToString/Scenario.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.Bind.SinglePropertyStringToString; @@ -13,6 +14,7 @@ public static class Scenario /// The target view. /// The source view model. /// A reactive binding representing the binding. - public static IReactiveBinding Execute(MyView view, MyViewModel vm) => + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IReactiveBinding Execute(MyView view, MyViewModel vm) => view.Bind(vm, x => x.Name, x => x.NameText); } diff --git a/src/tests/SharedScenarios/Bind/SinglePropertyWithConverters/Scenario.cs b/src/tests/SharedScenarios/Bind/SinglePropertyWithConverters/Scenario.cs index ac169914..00f7a260 100644 --- a/src/tests/SharedScenarios/Bind/SinglePropertyWithConverters/Scenario.cs +++ b/src/tests/SharedScenarios/Bind/SinglePropertyWithConverters/Scenario.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.Bind.SinglePropertyWithConverters; @@ -13,6 +14,7 @@ public static class Scenario /// The target view. /// The source view model. /// A reactive binding representing the binding. - public static IReactiveBinding Execute(MyView view, MyViewModel vm) => + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IReactiveBinding Execute(MyView view, MyViewModel vm) => view.Bind(vm, x => x.Count, x => x.CountText, count => count.ToString(), int.Parse); } diff --git a/src/tests/SharedScenarios/Bind/SinglePropertyWithConvertersAndScheduler/Scenario.cs b/src/tests/SharedScenarios/Bind/SinglePropertyWithConvertersAndScheduler/Scenario.cs index 4777a525..ebc48e9c 100644 --- a/src/tests/SharedScenarios/Bind/SinglePropertyWithConvertersAndScheduler/Scenario.cs +++ b/src/tests/SharedScenarios/Bind/SinglePropertyWithConvertersAndScheduler/Scenario.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using ReactiveUI.Binding; using ReactiveUI.Primitives.Concurrency; @@ -15,7 +16,8 @@ public static class Scenario /// The source view model. /// The scheduler to observe on. /// A reactive binding representing the binding. - public static IReactiveBinding Execute( + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static IReactiveBinding Execute( MyView view, MyViewModel vm, ISequencer scheduler) => view.Bind(vm, x => x.Count, x => x.CountText, count => count.ToString(), int.Parse, scheduler); diff --git a/src/tests/SharedScenarios/Bind/TwoSameTypeBindings/Scenario.cs b/src/tests/SharedScenarios/Bind/TwoSameTypeBindings/Scenario.cs index 5bec42c5..6ace688b 100644 --- a/src/tests/SharedScenarios/Bind/TwoSameTypeBindings/Scenario.cs +++ b/src/tests/SharedScenarios/Bind/TwoSameTypeBindings/Scenario.cs @@ -19,8 +19,8 @@ public static class Scenario /// The target view. /// The source view model. /// A tuple of bindings. - public static (IReactiveBinding first, - IReactiveBinding last) Execute(MyView view, MyViewModel vm) => + public static (IReactiveBinding First, + IReactiveBinding Last) Execute(MyView view, MyViewModel vm) => (view.Bind(vm, x => x.FirstName, x => x.FirstNameText), view.Bind(vm, x => x.LastName, x => x.LastNameText)); } diff --git a/src/tests/SharedScenarios/BindCommand/BasicNoParam/MyButton.cs b/src/tests/SharedScenarios/BindCommand/BasicNoParam/MyButton.cs index aec31e7e..2e61bbfc 100644 --- a/src/tests/SharedScenarios/BindCommand/BasicNoParam/MyButton.cs +++ b/src/tests/SharedScenarios/BindCommand/BasicNoParam/MyButton.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; namespace SharedScenarios.BindCommand.BasicNoParam; @@ -13,5 +14,6 @@ public class MyButton public event EventHandler? Click; /// Simulates a button click. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void PerformClick() => Click?.Invoke(this, EventArgs.Empty); } diff --git a/src/tests/SharedScenarios/BindCommand/BasicNoParam/Scenario.cs b/src/tests/SharedScenarios/BindCommand/BasicNoParam/Scenario.cs index 4bac6d87..d9e69b23 100644 --- a/src/tests/SharedScenarios/BindCommand/BasicNoParam/Scenario.cs +++ b/src/tests/SharedScenarios/BindCommand/BasicNoParam/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.BindCommand.BasicNoParam; @@ -14,6 +15,7 @@ public static class Scenario /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view) => view.BindCommand(vm, x => x.Save, x => x.SaveButton); } diff --git a/src/tests/SharedScenarios/BindCommand/CommandProperty/Scenario.cs b/src/tests/SharedScenarios/BindCommand/CommandProperty/Scenario.cs index 214da44c..afad5821 100644 --- a/src/tests/SharedScenarios/BindCommand/CommandProperty/Scenario.cs +++ b/src/tests/SharedScenarios/BindCommand/CommandProperty/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.BindCommand.CommandProperty; @@ -17,6 +18,7 @@ public static class Scenario /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view) => view.BindCommand(vm, x => x.Save, x => x.SaveButton); } diff --git a/src/tests/SharedScenarios/BindCommand/CommandPropertyExprParam/Scenario.cs b/src/tests/SharedScenarios/BindCommand/CommandPropertyExprParam/Scenario.cs index 0c75d031..c7354d30 100644 --- a/src/tests/SharedScenarios/BindCommand/CommandPropertyExprParam/Scenario.cs +++ b/src/tests/SharedScenarios/BindCommand/CommandPropertyExprParam/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.BindCommand.CommandPropertyExprParam; @@ -17,6 +18,7 @@ public static class Scenario /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view) => view.BindCommand(vm, x => x.Save, x => x.SaveButton, x => x.CurrentItem); } diff --git a/src/tests/SharedScenarios/BindCommand/CommandPropertyObsParam/Scenario.cs b/src/tests/SharedScenarios/BindCommand/CommandPropertyObsParam/Scenario.cs index 4ded05b0..c5ed75f9 100644 --- a/src/tests/SharedScenarios/BindCommand/CommandPropertyObsParam/Scenario.cs +++ b/src/tests/SharedScenarios/BindCommand/CommandPropertyObsParam/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.BindCommand.CommandPropertyObsParam; @@ -18,6 +19,7 @@ public static class Scenario /// The target view. /// An observable producing command parameters. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view, IObservable parameter) => view.BindCommand(vm, x => x.Save, x => x.SaveButton, parameter); } diff --git a/src/tests/SharedScenarios/BindCommand/CustomEvent/MyButton.cs b/src/tests/SharedScenarios/BindCommand/CustomEvent/MyButton.cs index a3d1a3f8..375a443b 100644 --- a/src/tests/SharedScenarios/BindCommand/CustomEvent/MyButton.cs +++ b/src/tests/SharedScenarios/BindCommand/CustomEvent/MyButton.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; namespace SharedScenarios.BindCommand.CustomEvent; @@ -13,5 +14,6 @@ public class MyButton public event EventHandler? MouseUp; /// Simulates a mouse up event. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void PerformMouseUp() => MouseUp?.Invoke(this, EventArgs.Empty); } diff --git a/src/tests/SharedScenarios/BindCommand/CustomEvent/Scenario.cs b/src/tests/SharedScenarios/BindCommand/CustomEvent/Scenario.cs index 4aaee5ec..1b03fc0a 100644 --- a/src/tests/SharedScenarios/BindCommand/CustomEvent/Scenario.cs +++ b/src/tests/SharedScenarios/BindCommand/CustomEvent/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.BindCommand.CustomEvent; @@ -14,6 +15,7 @@ public static class Scenario /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view) => view.BindCommand(vm, x => x.Save, x => x.SaveButton, "MouseUp"); } diff --git a/src/tests/SharedScenarios/BindCommand/DeepCommandPath/MyButton.cs b/src/tests/SharedScenarios/BindCommand/DeepCommandPath/MyButton.cs index 9349a039..b38bebed 100644 --- a/src/tests/SharedScenarios/BindCommand/DeepCommandPath/MyButton.cs +++ b/src/tests/SharedScenarios/BindCommand/DeepCommandPath/MyButton.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; namespace SharedScenarios.BindCommand.DeepCommandPath; @@ -13,5 +14,6 @@ public class MyButton public event EventHandler? Click; /// Simulates a button click. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void PerformClick() => Click?.Invoke(this, EventArgs.Empty); } diff --git a/src/tests/SharedScenarios/BindCommand/DeepCommandPath/Scenario.cs b/src/tests/SharedScenarios/BindCommand/DeepCommandPath/Scenario.cs index 3dc00e9b..77c18c33 100644 --- a/src/tests/SharedScenarios/BindCommand/DeepCommandPath/Scenario.cs +++ b/src/tests/SharedScenarios/BindCommand/DeepCommandPath/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.BindCommand.DeepCommandPath; @@ -14,6 +15,7 @@ public static class Scenario /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view) => view.BindCommand(vm, x => x.Child!.SaveCommand, x => x.SaveButton); } diff --git a/src/tests/SharedScenarios/BindCommand/EventEnabled/Scenario.cs b/src/tests/SharedScenarios/BindCommand/EventEnabled/Scenario.cs index 8675527a..dfa2505c 100644 --- a/src/tests/SharedScenarios/BindCommand/EventEnabled/Scenario.cs +++ b/src/tests/SharedScenarios/BindCommand/EventEnabled/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.BindCommand.EventEnabled; @@ -17,6 +18,7 @@ public static class Scenario /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view) => view.BindCommand(vm, x => x.Save, x => x.SaveButton); } diff --git a/src/tests/SharedScenarios/BindCommand/EventEnabled/WinFormsLikeButton.cs b/src/tests/SharedScenarios/BindCommand/EventEnabled/WinFormsLikeButton.cs index 8abdbf4e..8a9acdc1 100644 --- a/src/tests/SharedScenarios/BindCommand/EventEnabled/WinFormsLikeButton.cs +++ b/src/tests/SharedScenarios/BindCommand/EventEnabled/WinFormsLikeButton.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; namespace SharedScenarios.BindCommand.EventEnabled; @@ -16,5 +17,6 @@ public class WinFormsLikeButton public bool Enabled { get; set; } /// Simulates a button click. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void PerformClick() => Click?.Invoke(this, EventArgs.Empty); } diff --git a/src/tests/SharedScenarios/BindCommand/EventEnabledExprParam/Scenario.cs b/src/tests/SharedScenarios/BindCommand/EventEnabledExprParam/Scenario.cs index 0238a1f8..7b3f6e79 100644 --- a/src/tests/SharedScenarios/BindCommand/EventEnabledExprParam/Scenario.cs +++ b/src/tests/SharedScenarios/BindCommand/EventEnabledExprParam/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.BindCommand.EventEnabledExprParam; @@ -17,6 +18,7 @@ public static class Scenario /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view) => view.BindCommand(vm, x => x.Save, x => x.SaveButton, x => x.CurrentItem); } diff --git a/src/tests/SharedScenarios/BindCommand/EventEnabledExprParam/WinFormsLikeButton.cs b/src/tests/SharedScenarios/BindCommand/EventEnabledExprParam/WinFormsLikeButton.cs index 9dfa1ac4..270149be 100644 --- a/src/tests/SharedScenarios/BindCommand/EventEnabledExprParam/WinFormsLikeButton.cs +++ b/src/tests/SharedScenarios/BindCommand/EventEnabledExprParam/WinFormsLikeButton.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; namespace SharedScenarios.BindCommand.EventEnabledExprParam; @@ -16,5 +17,6 @@ public class WinFormsLikeButton public bool Enabled { get; set; } /// Simulates a button click. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void PerformClick() => Click?.Invoke(this, EventArgs.Empty); } diff --git a/src/tests/SharedScenarios/BindCommand/EventEnabledObsParam/Scenario.cs b/src/tests/SharedScenarios/BindCommand/EventEnabledObsParam/Scenario.cs index 0a1b004b..e44e7ae5 100644 --- a/src/tests/SharedScenarios/BindCommand/EventEnabledObsParam/Scenario.cs +++ b/src/tests/SharedScenarios/BindCommand/EventEnabledObsParam/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.BindCommand.EventEnabledObsParam; @@ -18,6 +19,7 @@ public static class Scenario /// The target view. /// An observable producing command parameters. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view, IObservable parameter) => view.BindCommand(vm, x => x.Save, x => x.SaveButton, parameter); } diff --git a/src/tests/SharedScenarios/BindCommand/EventEnabledObsParam/WinFormsLikeButton.cs b/src/tests/SharedScenarios/BindCommand/EventEnabledObsParam/WinFormsLikeButton.cs index 9b9d68bc..cfa6dc63 100644 --- a/src/tests/SharedScenarios/BindCommand/EventEnabledObsParam/WinFormsLikeButton.cs +++ b/src/tests/SharedScenarios/BindCommand/EventEnabledObsParam/WinFormsLikeButton.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; namespace SharedScenarios.BindCommand.EventEnabledObsParam; @@ -16,5 +17,6 @@ public class WinFormsLikeButton public bool Enabled { get; set; } /// Simulates a button click. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void PerformClick() => Click?.Invoke(this, EventArgs.Empty); } diff --git a/src/tests/SharedScenarios/BindCommand/ExpressionParam/MyButton.cs b/src/tests/SharedScenarios/BindCommand/ExpressionParam/MyButton.cs index b0f80b67..bbc2991f 100644 --- a/src/tests/SharedScenarios/BindCommand/ExpressionParam/MyButton.cs +++ b/src/tests/SharedScenarios/BindCommand/ExpressionParam/MyButton.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; namespace SharedScenarios.BindCommand.ExpressionParam; @@ -13,5 +14,6 @@ public class MyButton public event EventHandler? Click; /// Simulates a button click. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void PerformClick() => Click?.Invoke(this, EventArgs.Empty); } diff --git a/src/tests/SharedScenarios/BindCommand/ExpressionParam/Scenario.cs b/src/tests/SharedScenarios/BindCommand/ExpressionParam/Scenario.cs index 3d1e10db..ae7f33b7 100644 --- a/src/tests/SharedScenarios/BindCommand/ExpressionParam/Scenario.cs +++ b/src/tests/SharedScenarios/BindCommand/ExpressionParam/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.BindCommand.ExpressionParam; @@ -14,6 +15,7 @@ public static class Scenario /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view) => view.BindCommand(vm, x => x.Save, x => x.SaveButton, x => x.CurrentItem); } diff --git a/src/tests/SharedScenarios/BindCommand/NoEvent/Scenario.cs b/src/tests/SharedScenarios/BindCommand/NoEvent/Scenario.cs index 89122ca4..7a22e5f6 100644 --- a/src/tests/SharedScenarios/BindCommand/NoEvent/Scenario.cs +++ b/src/tests/SharedScenarios/BindCommand/NoEvent/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.BindCommand.NoEvent; @@ -14,6 +15,7 @@ public static class Scenario /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view) => view.BindCommand(vm, x => x.Save, x => x.Label); } diff --git a/src/tests/SharedScenarios/BindCommand/ObservableParam/MyButton.cs b/src/tests/SharedScenarios/BindCommand/ObservableParam/MyButton.cs index 98cde800..4e0db305 100644 --- a/src/tests/SharedScenarios/BindCommand/ObservableParam/MyButton.cs +++ b/src/tests/SharedScenarios/BindCommand/ObservableParam/MyButton.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; namespace SharedScenarios.BindCommand.ObservableParam; @@ -13,5 +14,6 @@ public class MyButton public event EventHandler? Click; /// Simulates a button click. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public void PerformClick() => Click?.Invoke(this, EventArgs.Empty); } diff --git a/src/tests/SharedScenarios/BindCommand/ObservableParam/Scenario.cs b/src/tests/SharedScenarios/BindCommand/ObservableParam/Scenario.cs index bbda98bb..129ae239 100644 --- a/src/tests/SharedScenarios/BindCommand/ObservableParam/Scenario.cs +++ b/src/tests/SharedScenarios/BindCommand/ObservableParam/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.BindCommand.ObservableParam; @@ -15,6 +16,7 @@ public static class Scenario /// The target view. /// An observable producing command parameters. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view, IObservable parameter) => view.BindCommand(vm, x => x.Save, x => x.SaveButton, parameter); } diff --git a/src/tests/SharedScenarios/BindInteraction/DeepPropertyPath/Scenario.cs b/src/tests/SharedScenarios/BindInteraction/DeepPropertyPath/Scenario.cs index d23d1b3d..30f96f36 100644 --- a/src/tests/SharedScenarios/BindInteraction/DeepPropertyPath/Scenario.cs +++ b/src/tests/SharedScenarios/BindInteraction/DeepPropertyPath/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using System.Threading.Tasks; using ReactiveUI.Binding; @@ -15,6 +16,7 @@ public static class Scenario /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view) => view.BindInteraction(vm, x => x.Child!.Confirm, ctx => { diff --git a/src/tests/SharedScenarios/BindInteraction/NonINPCViewModel/Scenario.cs b/src/tests/SharedScenarios/BindInteraction/NonINPCViewModel/Scenario.cs index 92c43141..94df7519 100644 --- a/src/tests/SharedScenarios/BindInteraction/NonINPCViewModel/Scenario.cs +++ b/src/tests/SharedScenarios/BindInteraction/NonINPCViewModel/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using System.Threading.Tasks; using ReactiveUI.Binding; @@ -15,6 +16,7 @@ public static class Scenario /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view) => view.BindInteraction(vm, x => x.Confirm, ctx => { diff --git a/src/tests/SharedScenarios/BindInteraction/ObservableHandler/Scenario.cs b/src/tests/SharedScenarios/BindInteraction/ObservableHandler/Scenario.cs index 847f1443..d8bb2b5f 100644 --- a/src/tests/SharedScenarios/BindInteraction/ObservableHandler/Scenario.cs +++ b/src/tests/SharedScenarios/BindInteraction/ObservableHandler/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.BindInteraction.ObservableHandler; @@ -14,6 +15,7 @@ public static class Scenario /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view) => view.BindInteraction(vm, x => x.Confirm, ctx => { diff --git a/src/tests/SharedScenarios/BindInteraction/TaskHandler/Scenario.cs b/src/tests/SharedScenarios/BindInteraction/TaskHandler/Scenario.cs index 4d2abebf..daa5d03f 100644 --- a/src/tests/SharedScenarios/BindInteraction/TaskHandler/Scenario.cs +++ b/src/tests/SharedScenarios/BindInteraction/TaskHandler/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using System.Threading.Tasks; using ReactiveUI.Binding; @@ -15,6 +16,7 @@ public static class Scenario /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view) => view.BindInteraction(vm, x => x.Confirm, ctx => { diff --git a/src/tests/SharedScenarios/BindOneWay/ReactiveObjectSource/Scenario.cs b/src/tests/SharedScenarios/BindOneWay/ReactiveObjectSource/Scenario.cs index c1eacf2f..19bf88f5 100644 --- a/src/tests/SharedScenarios/BindOneWay/ReactiveObjectSource/Scenario.cs +++ b/src/tests/SharedScenarios/BindOneWay/ReactiveObjectSource/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.BindOneWay.ReactiveObjectSource; @@ -14,6 +15,7 @@ public static class Scenario /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view) => vm.BindOneWay(view, x => x.Name, x => x.NameText); } diff --git a/src/tests/SharedScenarios/BindOneWay/SinglePropertyIntToInt/Scenario.cs b/src/tests/SharedScenarios/BindOneWay/SinglePropertyIntToInt/Scenario.cs index 1eb5d5da..c363ffbb 100644 --- a/src/tests/SharedScenarios/BindOneWay/SinglePropertyIntToInt/Scenario.cs +++ b/src/tests/SharedScenarios/BindOneWay/SinglePropertyIntToInt/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.BindOneWay.SinglePropertyIntToInt; @@ -14,6 +15,7 @@ public static class Scenario /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view) => vm.BindOneWay(view, x => x.Count, x => x.DisplayCount); } diff --git a/src/tests/SharedScenarios/BindOneWay/SinglePropertyStringToString/Scenario.cs b/src/tests/SharedScenarios/BindOneWay/SinglePropertyStringToString/Scenario.cs index 18784e35..cecdc4be 100644 --- a/src/tests/SharedScenarios/BindOneWay/SinglePropertyStringToString/Scenario.cs +++ b/src/tests/SharedScenarios/BindOneWay/SinglePropertyStringToString/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.BindOneWay.SinglePropertyStringToString; @@ -14,6 +15,7 @@ public static class Scenario /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view) => vm.BindOneWay(view, x => x.Name, x => x.NameText); } diff --git a/src/tests/SharedScenarios/BindOneWay/SinglePropertyWithConverter/Scenario.cs b/src/tests/SharedScenarios/BindOneWay/SinglePropertyWithConverter/Scenario.cs index 9a0d4ff3..af3c47b7 100644 --- a/src/tests/SharedScenarios/BindOneWay/SinglePropertyWithConverter/Scenario.cs +++ b/src/tests/SharedScenarios/BindOneWay/SinglePropertyWithConverter/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.BindOneWay.SinglePropertyWithConverter; @@ -14,6 +15,7 @@ public static class Scenario /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view) => vm.BindOneWay(view, x => x.Count, x => x.CountText, count => count.ToString()); } diff --git a/src/tests/SharedScenarios/BindOneWay/SinglePropertyWithConverterAndScheduler/Scenario.cs b/src/tests/SharedScenarios/BindOneWay/SinglePropertyWithConverterAndScheduler/Scenario.cs index dfd8082b..42c66cf2 100644 --- a/src/tests/SharedScenarios/BindOneWay/SinglePropertyWithConverterAndScheduler/Scenario.cs +++ b/src/tests/SharedScenarios/BindOneWay/SinglePropertyWithConverterAndScheduler/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; using ReactiveUI.Primitives.Concurrency; @@ -16,6 +17,7 @@ public static class Scenario /// The target view. /// The scheduler to observe on. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view, ISequencer scheduler) => vm.BindOneWay(view, x => x.Count, x => x.CountText, count => count.ToString(), scheduler); } diff --git a/src/tests/SharedScenarios/BindOneWay/SinglePropertyWithScheduler/Scenario.cs b/src/tests/SharedScenarios/BindOneWay/SinglePropertyWithScheduler/Scenario.cs index ffac9e0c..0d95fc3c 100644 --- a/src/tests/SharedScenarios/BindOneWay/SinglePropertyWithScheduler/Scenario.cs +++ b/src/tests/SharedScenarios/BindOneWay/SinglePropertyWithScheduler/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; using ReactiveUI.Primitives.Concurrency; @@ -16,6 +17,7 @@ public static class Scenario /// The target view. /// The scheduler to observe on. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view, ISequencer scheduler) => vm.BindOneWay(view, x => x.Name, x => x.NameText, scheduler); } diff --git a/src/tests/SharedScenarios/BindTo/DifferingTypes/Scenario.cs b/src/tests/SharedScenarios/BindTo/DifferingTypes/Scenario.cs index 73cfb6b6..9c634de1 100644 --- a/src/tests/SharedScenarios/BindTo/DifferingTypes/Scenario.cs +++ b/src/tests/SharedScenarios/BindTo/DifferingTypes/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.BindTo.DifferingTypes; @@ -14,6 +15,7 @@ public static class Scenario /// The source observable stream. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(IObservable source, MyView view) => source.BindTo(view, x => x.Caption); } diff --git a/src/tests/SharedScenarios/BindTo/SameTypeString/Scenario.cs b/src/tests/SharedScenarios/BindTo/SameTypeString/Scenario.cs index b79d2c4b..754cfce1 100644 --- a/src/tests/SharedScenarios/BindTo/SameTypeString/Scenario.cs +++ b/src/tests/SharedScenarios/BindTo/SameTypeString/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.BindTo.SameTypeString; @@ -14,6 +15,7 @@ public static class Scenario /// The source observable stream. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(IObservable source, MyView view) => source.BindTo(view, x => x.Caption); } diff --git a/src/tests/SharedScenarios/BindTo/WithConversionHint/Scenario.cs b/src/tests/SharedScenarios/BindTo/WithConversionHint/Scenario.cs index 8f1eee76..ea4c3663 100644 --- a/src/tests/SharedScenarios/BindTo/WithConversionHint/Scenario.cs +++ b/src/tests/SharedScenarios/BindTo/WithConversionHint/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.BindTo.WithConversionHint; @@ -14,6 +15,7 @@ public static class Scenario /// The source observable stream. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(IObservable source, MyView view) => source.BindTo(view, x => x.Caption, (object)"D2"); } diff --git a/src/tests/SharedScenarios/BindTo/WithConverterOverride/Scenario.cs b/src/tests/SharedScenarios/BindTo/WithConverterOverride/Scenario.cs index 899e2f75..cbe49191 100644 --- a/src/tests/SharedScenarios/BindTo/WithConverterOverride/Scenario.cs +++ b/src/tests/SharedScenarios/BindTo/WithConverterOverride/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.BindTo.WithConverterOverride; @@ -15,6 +16,7 @@ public static class Scenario /// The target view. /// The explicit converter to use. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(IObservable source, MyView view, IBindingTypeConverter converter) => source.BindTo(view, x => x.Caption, converter); } diff --git a/src/tests/SharedScenarios/BindTwoWay/ReactiveObjectBoth/Scenario.cs b/src/tests/SharedScenarios/BindTwoWay/ReactiveObjectBoth/Scenario.cs index 0d485254..3d5d114c 100644 --- a/src/tests/SharedScenarios/BindTwoWay/ReactiveObjectBoth/Scenario.cs +++ b/src/tests/SharedScenarios/BindTwoWay/ReactiveObjectBoth/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.BindTwoWay.ReactiveObjectBoth; @@ -14,6 +15,7 @@ public static class Scenario /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view) => vm.BindTwoWay(view, x => x.Name, x => x.NameText); } diff --git a/src/tests/SharedScenarios/BindTwoWay/SinglePropertyIntToInt/Scenario.cs b/src/tests/SharedScenarios/BindTwoWay/SinglePropertyIntToInt/Scenario.cs index 9e4c4f75..5dd12e83 100644 --- a/src/tests/SharedScenarios/BindTwoWay/SinglePropertyIntToInt/Scenario.cs +++ b/src/tests/SharedScenarios/BindTwoWay/SinglePropertyIntToInt/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.BindTwoWay.SinglePropertyIntToInt; @@ -14,6 +15,7 @@ public static class Scenario /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view) => vm.BindTwoWay(view, x => x.Count, x => x.DisplayCount); } diff --git a/src/tests/SharedScenarios/BindTwoWay/SinglePropertyStringToString/Scenario.cs b/src/tests/SharedScenarios/BindTwoWay/SinglePropertyStringToString/Scenario.cs index 2ba8bcb8..41046811 100644 --- a/src/tests/SharedScenarios/BindTwoWay/SinglePropertyStringToString/Scenario.cs +++ b/src/tests/SharedScenarios/BindTwoWay/SinglePropertyStringToString/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.BindTwoWay.SinglePropertyStringToString; @@ -14,6 +15,7 @@ public static class Scenario /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view) => vm.BindTwoWay(view, x => x.Name, x => x.NameText); } diff --git a/src/tests/SharedScenarios/BindTwoWay/SinglePropertyWithConverters/Scenario.cs b/src/tests/SharedScenarios/BindTwoWay/SinglePropertyWithConverters/Scenario.cs index 77bcc5bd..4774ef9a 100644 --- a/src/tests/SharedScenarios/BindTwoWay/SinglePropertyWithConverters/Scenario.cs +++ b/src/tests/SharedScenarios/BindTwoWay/SinglePropertyWithConverters/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.BindTwoWay.SinglePropertyWithConverters; @@ -14,6 +15,7 @@ public static class Scenario /// The source view model. /// The target view. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view) => vm.BindTwoWay( view, diff --git a/src/tests/SharedScenarios/BindTwoWay/SinglePropertyWithConvertersAndScheduler/Scenario.cs b/src/tests/SharedScenarios/BindTwoWay/SinglePropertyWithConvertersAndScheduler/Scenario.cs index 8b7a78de..8fb32ba6 100644 --- a/src/tests/SharedScenarios/BindTwoWay/SinglePropertyWithConvertersAndScheduler/Scenario.cs +++ b/src/tests/SharedScenarios/BindTwoWay/SinglePropertyWithConvertersAndScheduler/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; using ReactiveUI.Primitives.Concurrency; @@ -16,6 +17,7 @@ public static class Scenario /// The target view. /// The scheduler to observe on. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view, ISequencer scheduler) => vm.BindTwoWay( view, diff --git a/src/tests/SharedScenarios/BindTwoWay/SinglePropertyWithScheduler/Scenario.cs b/src/tests/SharedScenarios/BindTwoWay/SinglePropertyWithScheduler/Scenario.cs index 329b279b..5b3b2024 100644 --- a/src/tests/SharedScenarios/BindTwoWay/SinglePropertyWithScheduler/Scenario.cs +++ b/src/tests/SharedScenarios/BindTwoWay/SinglePropertyWithScheduler/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; using ReactiveUI.Primitives.Concurrency; @@ -16,6 +17,7 @@ public static class Scenario /// The target view. /// The scheduler to observe on. /// A disposable representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IDisposable Execute(MyViewModel vm, MyView view, ISequencer scheduler) => vm.BindTwoWay(view, x => x.Name, x => x.NameText, scheduler); } diff --git a/src/tests/SharedScenarios/OneWayBind/MultipleBindings/Scenario.cs b/src/tests/SharedScenarios/OneWayBind/MultipleBindings/Scenario.cs index bf0af1e4..91c72c16 100644 --- a/src/tests/SharedScenarios/OneWayBind/MultipleBindings/Scenario.cs +++ b/src/tests/SharedScenarios/OneWayBind/MultipleBindings/Scenario.cs @@ -13,7 +13,7 @@ public static class Scenario /// The target view. /// The source view model. /// A tuple of bindings. - public static (IReactiveBinding name, IReactiveBinding age) Execute( + public static (IReactiveBinding Name, IReactiveBinding Age) Execute( MyView view, MyViewModel vm) => (view.OneWayBind(vm, x => x.Name, x => x.NameText), diff --git a/src/tests/SharedScenarios/OneWayBind/SinglePropertyIntToInt/Scenario.cs b/src/tests/SharedScenarios/OneWayBind/SinglePropertyIntToInt/Scenario.cs index 5682d776..4fd6338d 100644 --- a/src/tests/SharedScenarios/OneWayBind/SinglePropertyIntToInt/Scenario.cs +++ b/src/tests/SharedScenarios/OneWayBind/SinglePropertyIntToInt/Scenario.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.OneWayBind.SinglePropertyIntToInt; @@ -13,6 +14,7 @@ public static class Scenario /// The target view. /// The source view model. /// A reactive binding representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IReactiveBinding Execute(MyView view, MyViewModel vm) => view.OneWayBind(vm, x => x.Count, x => x.CountValue); } diff --git a/src/tests/SharedScenarios/OneWayBind/SinglePropertyStringToString/Scenario.cs b/src/tests/SharedScenarios/OneWayBind/SinglePropertyStringToString/Scenario.cs index 40616134..2c7bc9d2 100644 --- a/src/tests/SharedScenarios/OneWayBind/SinglePropertyStringToString/Scenario.cs +++ b/src/tests/SharedScenarios/OneWayBind/SinglePropertyStringToString/Scenario.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.OneWayBind.SinglePropertyStringToString; @@ -13,6 +14,7 @@ public static class Scenario /// The target view. /// The source view model. /// A reactive binding representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IReactiveBinding Execute(MyView view, MyViewModel vm) => view.OneWayBind(vm, x => x.Name, x => x.NameText); } diff --git a/src/tests/SharedScenarios/OneWayBind/SinglePropertyWithSelector/Scenario.cs b/src/tests/SharedScenarios/OneWayBind/SinglePropertyWithSelector/Scenario.cs index bbcd1ede..f93292b4 100644 --- a/src/tests/SharedScenarios/OneWayBind/SinglePropertyWithSelector/Scenario.cs +++ b/src/tests/SharedScenarios/OneWayBind/SinglePropertyWithSelector/Scenario.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.OneWayBind.SinglePropertyWithSelector; @@ -13,6 +14,7 @@ public static class Scenario /// The target view. /// The source view model. /// A reactive binding representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IReactiveBinding Execute(MyView view, MyViewModel vm) => view.OneWayBind(vm, x => x.Count, x => x.CountText, count => count.ToString()); } diff --git a/src/tests/SharedScenarios/OneWayBind/SinglePropertyWithSelectorAndScheduler/Scenario.cs b/src/tests/SharedScenarios/OneWayBind/SinglePropertyWithSelectorAndScheduler/Scenario.cs index 58dc464f..cba6bb27 100644 --- a/src/tests/SharedScenarios/OneWayBind/SinglePropertyWithSelectorAndScheduler/Scenario.cs +++ b/src/tests/SharedScenarios/OneWayBind/SinglePropertyWithSelectorAndScheduler/Scenario.cs @@ -2,6 +2,7 @@ // ReactiveUI Association Incorporated licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. +using System.Runtime.CompilerServices; using ReactiveUI.Binding; using ReactiveUI.Primitives.Concurrency; @@ -15,6 +16,7 @@ public static class Scenario /// The source view model. /// The scheduler to observe on. /// A reactive binding representing the binding. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IReactiveBinding Execute(MyView view, MyViewModel vm, ISequencer scheduler) => view.OneWayBind(vm, x => x.Count, x => x.CountText, count => count.ToString(), scheduler); } diff --git a/src/tests/SharedScenarios/OneWayBind/TwoSameTypeBindings/Scenario.cs b/src/tests/SharedScenarios/OneWayBind/TwoSameTypeBindings/Scenario.cs index 1a061141..5c6abdfb 100644 --- a/src/tests/SharedScenarios/OneWayBind/TwoSameTypeBindings/Scenario.cs +++ b/src/tests/SharedScenarios/OneWayBind/TwoSameTypeBindings/Scenario.cs @@ -19,7 +19,7 @@ public static class Scenario /// The target view. /// The source view model. /// A tuple of bindings. - public static (IReactiveBinding first, IReactiveBinding last) Execute( + public static (IReactiveBinding First, IReactiveBinding Last) Execute( MyView view, MyViewModel vm) => (view.OneWayBind(vm, x => x.FirstName, x => x.FirstNameText), diff --git a/src/tests/SharedScenarios/WhenAny/DeepPropertyChain/Scenario.cs b/src/tests/SharedScenarios/WhenAny/DeepPropertyChain/Scenario.cs index deb23726..e825b441 100644 --- a/src/tests/SharedScenarios/WhenAny/DeepPropertyChain/Scenario.cs +++ b/src/tests/SharedScenarios/WhenAny/DeepPropertyChain/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenAny.DeepPropertyChain; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenAny observable for Child.Name via IObservedChange. /// The parent view model to observe. /// An observable of name values from the child. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(ParentViewModel vm) => vm.WhenAny(x => x.Child.Name, c => c.Value); } diff --git a/src/tests/SharedScenarios/WhenAny/MultiPropertyDeepChain/Scenario.cs b/src/tests/SharedScenarios/WhenAny/MultiPropertyDeepChain/Scenario.cs index 5afdb24c..f7c78876 100644 --- a/src/tests/SharedScenarios/WhenAny/MultiPropertyDeepChain/Scenario.cs +++ b/src/tests/SharedScenarios/WhenAny/MultiPropertyDeepChain/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenAny.MultiPropertyDeepChain; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenAny observable combining a deep chain (Child.Name) and a shallow property (Title). /// The parent view model to observe. /// An observable of combined name and title strings. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(ParentViewModel vm) => vm.WhenAny(x => x.Child.Name, x => x.Title, (c1, c2) => $"{c1.Value} - {c2.Value}"); } diff --git a/src/tests/SharedScenarios/WhenAny/MultiPropertyTwoProperties/Scenario.cs b/src/tests/SharedScenarios/WhenAny/MultiPropertyTwoProperties/Scenario.cs index 531cdb3f..b5701952 100644 --- a/src/tests/SharedScenarios/WhenAny/MultiPropertyTwoProperties/Scenario.cs +++ b/src/tests/SharedScenarios/WhenAny/MultiPropertyTwoProperties/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenAny.MultiPropertyTwoProperties; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenAny observable combining FirstName and LastName via IObservedChange. /// The view model to observe. /// An observable of combined name strings. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(MyViewModel vm) => vm.WhenAny(x => x.FirstName, x => x.LastName, (c1, c2) => $"{c1.Value} {c2.Value}"); } diff --git a/src/tests/SharedScenarios/WhenAny/SinglePropertyINPC/Scenario.cs b/src/tests/SharedScenarios/WhenAny/SinglePropertyINPC/Scenario.cs index 47eeae5b..6e74295a 100644 --- a/src/tests/SharedScenarios/WhenAny/SinglePropertyINPC/Scenario.cs +++ b/src/tests/SharedScenarios/WhenAny/SinglePropertyINPC/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenAny.SinglePropertyINPC; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenAny observable for the Name property, extracting the value from IObservedChange. /// The view model to observe. /// An observable of name values. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(MyViewModel vm) => vm.WhenAny(x => x.Name, c => c.Value); } diff --git a/src/tests/SharedScenarios/WhenAnyObservable/DeepObservableCombineLatest/Scenario.cs b/src/tests/SharedScenarios/WhenAnyObservable/DeepObservableCombineLatest/Scenario.cs index 08b49518..f2362e3f 100644 --- a/src/tests/SharedScenarios/WhenAnyObservable/DeepObservableCombineLatest/Scenario.cs +++ b/src/tests/SharedScenarios/WhenAnyObservable/DeepObservableCombineLatest/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenAnyObservable.DeepObservableCombineLatest; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenAnyObservable that combines two deep observable properties using a selector. /// The parent view model to observe. /// An observable that combines values from both deep observable properties. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(ParentViewModel vm) => vm.WhenAnyObservable(x => x.Child.Count, x => x.Child.Message, (count, message) => $"{message}: {count}"); } diff --git a/src/tests/SharedScenarios/WhenAnyObservable/DeepObservableMerge/Scenario.cs b/src/tests/SharedScenarios/WhenAnyObservable/DeepObservableMerge/Scenario.cs index 5dbcf3cc..bdf9ad69 100644 --- a/src/tests/SharedScenarios/WhenAnyObservable/DeepObservableMerge/Scenario.cs +++ b/src/tests/SharedScenarios/WhenAnyObservable/DeepObservableMerge/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenAnyObservable.DeepObservableMerge; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenAnyObservable that merges two deep observable properties. /// The parent view model to observe. /// An observable that merges values from both deep observable properties. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(ParentViewModel vm) => vm.WhenAnyObservable(x => x.Child.Command1, x => x.Child.Command2); } diff --git a/src/tests/SharedScenarios/WhenAnyObservable/DeepObservableSwitch/Scenario.cs b/src/tests/SharedScenarios/WhenAnyObservable/DeepObservableSwitch/Scenario.cs index b4f5b0a5..d332fba1 100644 --- a/src/tests/SharedScenarios/WhenAnyObservable/DeepObservableSwitch/Scenario.cs +++ b/src/tests/SharedScenarios/WhenAnyObservable/DeepObservableSwitch/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenAnyObservable.DeepObservableSwitch; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenAnyObservable that switches to the latest value of Child.MyCommand. /// The parent view model to observe. /// An observable that switches to the latest Child.MyCommand observable. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(ParentViewModel vm) => vm.WhenAnyObservable(x => x.Child.MyCommand); } diff --git a/src/tests/SharedScenarios/WhenAnyObservable/SingleObservable/Scenario.cs b/src/tests/SharedScenarios/WhenAnyObservable/SingleObservable/Scenario.cs index b6b12400..13a74c7a 100644 --- a/src/tests/SharedScenarios/WhenAnyObservable/SingleObservable/Scenario.cs +++ b/src/tests/SharedScenarios/WhenAnyObservable/SingleObservable/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenAnyObservable.SingleObservable; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenAnyObservable that switches to the latest value of MyCommand. /// The view model to observe. /// An observable that switches to the latest MyCommand observable. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(MyViewModel vm) => vm.WhenAnyObservable(x => x.MyCommand); } diff --git a/src/tests/SharedScenarios/WhenAnyObservable/TwoObservablesMerge/Scenario.cs b/src/tests/SharedScenarios/WhenAnyObservable/TwoObservablesMerge/Scenario.cs index ab5bfc79..f9a24aac 100644 --- a/src/tests/SharedScenarios/WhenAnyObservable/TwoObservablesMerge/Scenario.cs +++ b/src/tests/SharedScenarios/WhenAnyObservable/TwoObservablesMerge/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenAnyObservable.TwoObservablesMerge; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenAnyObservable that merges the two command observables. /// The view model to observe. /// An observable that merges values from both command observables. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(MyViewModel vm) => vm.WhenAnyObservable(x => x.Command1, x => x.Command2); } diff --git a/src/tests/SharedScenarios/WhenAnyObservable/TwoObservablesWithSelector/Scenario.cs b/src/tests/SharedScenarios/WhenAnyObservable/TwoObservablesWithSelector/Scenario.cs index f91e5446..e8417b16 100644 --- a/src/tests/SharedScenarios/WhenAnyObservable/TwoObservablesWithSelector/Scenario.cs +++ b/src/tests/SharedScenarios/WhenAnyObservable/TwoObservablesWithSelector/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenAnyObservable.TwoObservablesWithSelector; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenAnyObservable that combines the two observable properties using a selector. /// The view model to observe. /// An observable that combines values from both observable properties. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(MyViewModel vm) => vm.WhenAnyObservable(x => x.Count, x => x.Message, (count, message) => $"{message}: {count}"); } diff --git a/src/tests/SharedScenarios/WhenAnyValue/DeepPropertyChain/Scenario.cs b/src/tests/SharedScenarios/WhenAnyValue/DeepPropertyChain/Scenario.cs index 33bd42b8..a892f27d 100644 --- a/src/tests/SharedScenarios/WhenAnyValue/DeepPropertyChain/Scenario.cs +++ b/src/tests/SharedScenarios/WhenAnyValue/DeepPropertyChain/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenAnyValue.DeepPropertyChain; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenAnyValue observable for Child.Name. /// The parent view model to observe. /// An observable of name values from the child. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(ParentViewModel vm) => vm.WhenAnyValue(x => x.Child.Name); } diff --git a/src/tests/SharedScenarios/WhenAnyValue/MultiPropertyFiveProperties/Scenario.cs b/src/tests/SharedScenarios/WhenAnyValue/MultiPropertyFiveProperties/Scenario.cs index ae5cd7b6..ef34db1c 100644 --- a/src/tests/SharedScenarios/WhenAnyValue/MultiPropertyFiveProperties/Scenario.cs +++ b/src/tests/SharedScenarios/WhenAnyValue/MultiPropertyFiveProperties/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenAnyValue.MultiPropertyFiveProperties; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenAnyValue observable for five properties. /// The view model to observe. /// An observable of five-property tuples. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable<(string Prop1, int Prop2, double Prop3, bool Prop4, string Prop5)> Execute(MyViewModel vm) => vm.WhenAnyValue(x => x.Prop1, x => x.Prop2, x => x.Prop3, x => x.Prop4, x => x.Prop5); } diff --git a/src/tests/SharedScenarios/WhenAnyValue/MultiPropertyThreeProperties/Scenario.cs b/src/tests/SharedScenarios/WhenAnyValue/MultiPropertyThreeProperties/Scenario.cs index 06b3617b..f3af1d98 100644 --- a/src/tests/SharedScenarios/WhenAnyValue/MultiPropertyThreeProperties/Scenario.cs +++ b/src/tests/SharedScenarios/WhenAnyValue/MultiPropertyThreeProperties/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenAnyValue.MultiPropertyThreeProperties; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenAnyValue observable for Name, Age, and Score. /// The view model to observe. /// An observable of (name, age, score) tuples. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable<(string Name, int Age, double Score)> Execute(MyViewModel vm) => vm.WhenAnyValue(x => x.Name, x => x.Age, x => x.Score); } diff --git a/src/tests/SharedScenarios/WhenAnyValue/MultiPropertyTwelveProperties/Scenario.cs b/src/tests/SharedScenarios/WhenAnyValue/MultiPropertyTwelveProperties/Scenario.cs index 03ef5fc2..309dbebd 100644 --- a/src/tests/SharedScenarios/WhenAnyValue/MultiPropertyTwelveProperties/Scenario.cs +++ b/src/tests/SharedScenarios/WhenAnyValue/MultiPropertyTwelveProperties/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenAnyValue.MultiPropertyTwelveProperties; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenAnyValue observable for twelve properties. /// The fixture to observe. /// An observable of twelve-property tuples. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable<(string V1, string V2, string V3, string V4, string V5, string V6, string V7, string V8, string V9, string V10, string V11, string V12)> Execute(WhenAnyFixture fixture) => diff --git a/src/tests/SharedScenarios/WhenAnyValue/MultiPropertyTwoProperties/Scenario.cs b/src/tests/SharedScenarios/WhenAnyValue/MultiPropertyTwoProperties/Scenario.cs index 24cd2c34..a8c09a57 100644 --- a/src/tests/SharedScenarios/WhenAnyValue/MultiPropertyTwoProperties/Scenario.cs +++ b/src/tests/SharedScenarios/WhenAnyValue/MultiPropertyTwoProperties/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenAnyValue.MultiPropertyTwoProperties; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenAnyValue observable for Name and Age. /// The view model to observe. /// An observable of (name, age) tuples. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable<(string Name, int Age)> Execute(MyViewModel vm) => vm.WhenAnyValue(x => x.Name, x => x.Age); } diff --git a/src/tests/SharedScenarios/WhenAnyValue/MultiPropertyWithSelector/Scenario.cs b/src/tests/SharedScenarios/WhenAnyValue/MultiPropertyWithSelector/Scenario.cs index fdf3b325..4e11802d 100644 --- a/src/tests/SharedScenarios/WhenAnyValue/MultiPropertyWithSelector/Scenario.cs +++ b/src/tests/SharedScenarios/WhenAnyValue/MultiPropertyWithSelector/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenAnyValue.MultiPropertyWithSelector; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenAnyValue observable combining FirstName and LastName. /// The view model to observe. /// An observable of combined name strings. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(MyViewModel vm) => vm.WhenAnyValue(x => x.FirstName, x => x.LastName, (f, l) => $"{f} {l}"); } diff --git a/src/tests/SharedScenarios/WhenAnyValue/SinglePropertyINPC/Scenario.cs b/src/tests/SharedScenarios/WhenAnyValue/SinglePropertyINPC/Scenario.cs index c239b05d..4cb971f3 100644 --- a/src/tests/SharedScenarios/WhenAnyValue/SinglePropertyINPC/Scenario.cs +++ b/src/tests/SharedScenarios/WhenAnyValue/SinglePropertyINPC/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenAnyValue.SinglePropertyINPC; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenAnyValue observable for the Name property. /// The view model to observe. /// An observable of name values. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(MyViewModel vm) => vm.WhenAnyValue(x => x.Name); } diff --git a/src/tests/SharedScenarios/WhenAnyValue/SinglePropertyReactiveObject/Scenario.cs b/src/tests/SharedScenarios/WhenAnyValue/SinglePropertyReactiveObject/Scenario.cs index a2e3b65c..888ff4b2 100644 --- a/src/tests/SharedScenarios/WhenAnyValue/SinglePropertyReactiveObject/Scenario.cs +++ b/src/tests/SharedScenarios/WhenAnyValue/SinglePropertyReactiveObject/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI; namespace SharedScenarios.WhenAnyValue.SinglePropertyReactiveObject; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenAnyValue observable for the Name property. /// The view model to observe. /// An observable of name values. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(MyViewModel vm) => vm.WhenAnyValue(x => x.Name); } diff --git a/src/tests/SharedScenarios/WhenChanged/DeepPropertyChain/Scenario.cs b/src/tests/SharedScenarios/WhenChanged/DeepPropertyChain/Scenario.cs index 84c00f46..35ad888e 100644 --- a/src/tests/SharedScenarios/WhenChanged/DeepPropertyChain/Scenario.cs +++ b/src/tests/SharedScenarios/WhenChanged/DeepPropertyChain/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenChanged.DeepPropertyChain; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenChanged observable for Child.Name. /// The parent view model to observe. /// An observable of name values from the child. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(ParentViewModel vm) => vm.WhenChanged(x => x.Child.Name); } diff --git a/src/tests/SharedScenarios/WhenChanged/FourLevelDeepChain/Scenario.cs b/src/tests/SharedScenarios/WhenChanged/FourLevelDeepChain/Scenario.cs index 327a7596..cb3eaf03 100644 --- a/src/tests/SharedScenarios/WhenChanged/FourLevelDeepChain/Scenario.cs +++ b/src/tests/SharedScenarios/WhenChanged/FourLevelDeepChain/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenChanged.FourLevelDeepChain; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenChanged observable for Model.Model.Model.Value. /// The top-level object in the chain. /// An observable of value strings from the leaf. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(Level1 chain) => chain.WhenChanged(x => x.Model.Model.Model.Value); } diff --git a/src/tests/SharedScenarios/WhenChanged/IntProperty/Scenario.cs b/src/tests/SharedScenarios/WhenChanged/IntProperty/Scenario.cs index 3e083e05..016d3817 100644 --- a/src/tests/SharedScenarios/WhenChanged/IntProperty/Scenario.cs +++ b/src/tests/SharedScenarios/WhenChanged/IntProperty/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenChanged.IntProperty; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenChanged observable for the Count property. /// The view model to observe. /// An observable of count values. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(MyViewModel vm) => vm.WhenChanged(x => x.Count); } diff --git a/src/tests/SharedScenarios/WhenChanged/MultiPropertyThreeProperties/Scenario.cs b/src/tests/SharedScenarios/WhenChanged/MultiPropertyThreeProperties/Scenario.cs index f65092a5..51bd2f6a 100644 --- a/src/tests/SharedScenarios/WhenChanged/MultiPropertyThreeProperties/Scenario.cs +++ b/src/tests/SharedScenarios/WhenChanged/MultiPropertyThreeProperties/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenChanged.MultiPropertyThreeProperties; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenChanged observable for Name, Age, and Score. /// The view model to observe. /// An observable of (name, age, score) tuples. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable<(string Name, int Age, double Score)> Execute(MyViewModel vm) => vm.WhenChanged(x => x.Name, x => x.Age, x => x.Score); } diff --git a/src/tests/SharedScenarios/WhenChanged/MultiPropertyTwoProperties/Scenario.cs b/src/tests/SharedScenarios/WhenChanged/MultiPropertyTwoProperties/Scenario.cs index 907487c3..b6868a14 100644 --- a/src/tests/SharedScenarios/WhenChanged/MultiPropertyTwoProperties/Scenario.cs +++ b/src/tests/SharedScenarios/WhenChanged/MultiPropertyTwoProperties/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenChanged.MultiPropertyTwoProperties; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenChanged observable for Name and Age. /// The view model to observe. /// An observable of (name, age) tuples. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable<(string Name, int Age)> Execute(MyViewModel vm) => vm.WhenChanged(x => x.Name, x => x.Age); } diff --git a/src/tests/SharedScenarios/WhenChanged/MultiPropertyWithDeepChains/Scenario.cs b/src/tests/SharedScenarios/WhenChanged/MultiPropertyWithDeepChains/Scenario.cs index c6aee8ed..87d54a05 100644 --- a/src/tests/SharedScenarios/WhenChanged/MultiPropertyWithDeepChains/Scenario.cs +++ b/src/tests/SharedScenarios/WhenChanged/MultiPropertyWithDeepChains/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenChanged.MultiPropertyWithDeepChains; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenChanged observable combining Address.City and Name with a selector. /// The view model to observe. /// An observable of combined city and name strings. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(MyViewModel vm) => vm.WhenChanged(x => x.Address.City, x => x.Name, (city, name) => $"{city}: {name}"); } diff --git a/src/tests/SharedScenarios/WhenChanged/MultiPropertyWithSelector/Scenario.cs b/src/tests/SharedScenarios/WhenChanged/MultiPropertyWithSelector/Scenario.cs index 8df3cb46..d39fcbdb 100644 --- a/src/tests/SharedScenarios/WhenChanged/MultiPropertyWithSelector/Scenario.cs +++ b/src/tests/SharedScenarios/WhenChanged/MultiPropertyWithSelector/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenChanged.MultiPropertyWithSelector; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenChanged observable combining FirstName and LastName. /// The view model to observe. /// An observable of combined name strings. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(MyViewModel vm) => vm.WhenChanged(x => x.FirstName, x => x.LastName, (f, l) => $"{f} {l}"); } diff --git a/src/tests/SharedScenarios/WhenChanged/NullForgivingDeepChain/Scenario.cs b/src/tests/SharedScenarios/WhenChanged/NullForgivingDeepChain/Scenario.cs index e7a50aaf..d610a15d 100644 --- a/src/tests/SharedScenarios/WhenChanged/NullForgivingDeepChain/Scenario.cs +++ b/src/tests/SharedScenarios/WhenChanged/NullForgivingDeepChain/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenChanged.NullForgivingDeepChain; @@ -16,6 +17,7 @@ public static class Scenario /// Creates a WhenChanged observable for Child!.Name using the null-forgiving operator. /// The parent view model to observe. /// An observable of name values from the child. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(ParentViewModel vm) => vm.WhenChanged(x => x.Child!.Name); } diff --git a/src/tests/SharedScenarios/WhenChanged/NullableProperty/Scenario.cs b/src/tests/SharedScenarios/WhenChanged/NullableProperty/Scenario.cs index df2d8ca1..9406e6f0 100644 --- a/src/tests/SharedScenarios/WhenChanged/NullableProperty/Scenario.cs +++ b/src/tests/SharedScenarios/WhenChanged/NullableProperty/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenChanged.NullableProperty; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenChanged observable for the NullableName property. /// The view model to observe. /// An observable of nullable name values. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(MyViewModel vm) => vm.WhenChanged(x => x.NullableName!); } diff --git a/src/tests/SharedScenarios/WhenChanged/SinglePropertyINPC/Scenario.cs b/src/tests/SharedScenarios/WhenChanged/SinglePropertyINPC/Scenario.cs index 1ce30694..7ffe89d7 100644 --- a/src/tests/SharedScenarios/WhenChanged/SinglePropertyINPC/Scenario.cs +++ b/src/tests/SharedScenarios/WhenChanged/SinglePropertyINPC/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenChanged.SinglePropertyINPC; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenChanged observable for the Name property. /// The view model to observe. /// An observable of name values. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(MyViewModel vm) => vm.WhenChanged(x => x.Name); } diff --git a/src/tests/SharedScenarios/WhenChanged/SinglePropertyReactiveObject/Scenario.cs b/src/tests/SharedScenarios/WhenChanged/SinglePropertyReactiveObject/Scenario.cs index f2892984..e12d0aa1 100644 --- a/src/tests/SharedScenarios/WhenChanged/SinglePropertyReactiveObject/Scenario.cs +++ b/src/tests/SharedScenarios/WhenChanged/SinglePropertyReactiveObject/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenChanged.SinglePropertyReactiveObject; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenChanged observable for the Name property. /// The view model to observe. /// An observable of name values. + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(MyViewModel vm) => vm.WhenChanged(x => x.Name); } diff --git a/src/tests/SharedScenarios/WhenChanging/DeepPropertyChain/Scenario.cs b/src/tests/SharedScenarios/WhenChanging/DeepPropertyChain/Scenario.cs index 74e0a913..c952eae7 100644 --- a/src/tests/SharedScenarios/WhenChanging/DeepPropertyChain/Scenario.cs +++ b/src/tests/SharedScenarios/WhenChanging/DeepPropertyChain/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenChanging.DeepPropertyChain; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenChanging observable for Child.Name. /// The parent view model to observe. /// An observable of name values (before change). + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(ParentViewModel vm) => vm.WhenChanging(x => x.Child.Name); } diff --git a/src/tests/SharedScenarios/WhenChanging/FourLevelDeepChain/Scenario.cs b/src/tests/SharedScenarios/WhenChanging/FourLevelDeepChain/Scenario.cs index ad64c066..33dbf543 100644 --- a/src/tests/SharedScenarios/WhenChanging/FourLevelDeepChain/Scenario.cs +++ b/src/tests/SharedScenarios/WhenChanging/FourLevelDeepChain/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenChanging.FourLevelDeepChain; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenChanging observable for Model.Model.Model.Value. /// The top-level object in the chain. /// An observable of value strings from the leaf (before change). + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(Level1 chain) => chain.WhenChanging(x => x.Model.Model.Model.Value); } diff --git a/src/tests/SharedScenarios/WhenChanging/MultiPropertyThreeProperties/Scenario.cs b/src/tests/SharedScenarios/WhenChanging/MultiPropertyThreeProperties/Scenario.cs index 0006287c..b4b61330 100644 --- a/src/tests/SharedScenarios/WhenChanging/MultiPropertyThreeProperties/Scenario.cs +++ b/src/tests/SharedScenarios/WhenChanging/MultiPropertyThreeProperties/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenChanging.MultiPropertyThreeProperties; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenChanging observable for Name, Age, and Score. /// The view model to observe. /// An observable of (name, age, score) tuples (before change). + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable<(string Name, int Age, double Score)> Execute(MyViewModel vm) => vm.WhenChanging(x => x.Name, x => x.Age, x => x.Score); } diff --git a/src/tests/SharedScenarios/WhenChanging/MultiPropertyTwoProperties/Scenario.cs b/src/tests/SharedScenarios/WhenChanging/MultiPropertyTwoProperties/Scenario.cs index 5ca07a80..a94b46f0 100644 --- a/src/tests/SharedScenarios/WhenChanging/MultiPropertyTwoProperties/Scenario.cs +++ b/src/tests/SharedScenarios/WhenChanging/MultiPropertyTwoProperties/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenChanging.MultiPropertyTwoProperties; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenChanging observable for Name and Age. /// The view model to observe. /// An observable of (name, age) tuples (before change). + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable<(string Name, int Age)> Execute(MyViewModel vm) => vm.WhenChanging(x => x.Name, x => x.Age); } diff --git a/src/tests/SharedScenarios/WhenChanging/MultiPropertyWithDeepChains/Scenario.cs b/src/tests/SharedScenarios/WhenChanging/MultiPropertyWithDeepChains/Scenario.cs index f0975619..d7255f9e 100644 --- a/src/tests/SharedScenarios/WhenChanging/MultiPropertyWithDeepChains/Scenario.cs +++ b/src/tests/SharedScenarios/WhenChanging/MultiPropertyWithDeepChains/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenChanging.MultiPropertyWithDeepChains; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenChanging observable combining Address.City and Name with a selector. /// The view model to observe. /// An observable of combined city and name strings (before change). + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(MyViewModel vm) => vm.WhenChanging(x => x.Address.City, x => x.Name, (city, name) => $"{city}: {name}"); } diff --git a/src/tests/SharedScenarios/WhenChanging/MultiPropertyWithSelector/Scenario.cs b/src/tests/SharedScenarios/WhenChanging/MultiPropertyWithSelector/Scenario.cs index f885321f..b2077fcb 100644 --- a/src/tests/SharedScenarios/WhenChanging/MultiPropertyWithSelector/Scenario.cs +++ b/src/tests/SharedScenarios/WhenChanging/MultiPropertyWithSelector/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenChanging.MultiPropertyWithSelector; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenChanging observable combining FirstName and LastName. /// The view model to observe. /// An observable of combined name strings (before change). + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(MyViewModel vm) => vm.WhenChanging(x => x.FirstName, x => x.LastName, (f, l) => $"{f} {l}"); } diff --git a/src/tests/SharedScenarios/WhenChanging/SinglePropertyINPC/Scenario.cs b/src/tests/SharedScenarios/WhenChanging/SinglePropertyINPC/Scenario.cs index d464f550..9d9b4e90 100644 --- a/src/tests/SharedScenarios/WhenChanging/SinglePropertyINPC/Scenario.cs +++ b/src/tests/SharedScenarios/WhenChanging/SinglePropertyINPC/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenChanging.SinglePropertyINPC; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenChanging observable for the Name property. /// The view model to observe. /// An observable of name values (before change). + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(MyViewModel vm) => vm.WhenChanging(x => x.Name); } diff --git a/src/tests/SharedScenarios/WhenChanging/SinglePropertyReactiveObject/Scenario.cs b/src/tests/SharedScenarios/WhenChanging/SinglePropertyReactiveObject/Scenario.cs index 9f03adf7..5b726539 100644 --- a/src/tests/SharedScenarios/WhenChanging/SinglePropertyReactiveObject/Scenario.cs +++ b/src/tests/SharedScenarios/WhenChanging/SinglePropertyReactiveObject/Scenario.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for full license information. using System; +using System.Runtime.CompilerServices; using ReactiveUI.Binding; namespace SharedScenarios.WhenChanging.SinglePropertyReactiveObject; @@ -13,6 +14,7 @@ public static class Scenario /// Creates a WhenChanging observable for the Name property. /// The view model to observe. /// An observable of name values (before change). + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static IObservable Execute(MyViewModel vm) => vm.WhenChanging(x => x.Name); }