diff --git a/src/rgen/Microsoft.Macios.Generator/Availability/PlatformAvailability.cs b/src/rgen/Microsoft.Macios.Generator/Availability/PlatformAvailability.cs index 075951107a33..0da6b22b4016 100644 --- a/src/rgen/Microsoft.Macios.Generator/Availability/PlatformAvailability.cs +++ b/src/rgen/Microsoft.Macios.Generator/Availability/PlatformAvailability.cs @@ -150,7 +150,6 @@ public bool Equals (PlatformAvailability other) var obsoleteComparer = new DictionaryComparer (); var unsupportedComparer = new DictionaryComparer (); - var x = Equals (SupportedVersion, other.SupportedVersion); return Platform == other.Platform && Equals (SupportedVersion, other.SupportedVersion) && unsupportedComparer.Equals (unsupported, other.unsupported) && diff --git a/src/rgen/Microsoft.Macios.Generator/Availability/SymbolAvailability.cs b/src/rgen/Microsoft.Macios.Generator/Availability/SymbolAvailability.cs index da7983a06f52..48aabacfb1b7 100644 --- a/src/rgen/Microsoft.Macios.Generator/Availability/SymbolAvailability.cs +++ b/src/rgen/Microsoft.Macios.Generator/Availability/SymbolAvailability.cs @@ -12,7 +12,7 @@ namespace Microsoft.Macios.Generator.Availability; /// Readonly structure that describes the availability of a symbol in the supported platforms of the SDK. /// readonly partial struct SymbolAvailability : IEquatable { - static readonly HashSet supportedPlatforms = + public static readonly HashSet SupportedPlatforms = [ApplePlatform.iOS, ApplePlatform.TVOS, ApplePlatform.MacOSX, ApplePlatform.MacCatalyst]; readonly SortedDictionary availabilities = new (); @@ -122,7 +122,7 @@ public SymbolAvailability MergeWithParent (SymbolAvailability? parent) // create the key value pairs for the supported platforms var merged = new List> (); - foreach (var platform in supportedPlatforms) { + foreach (var platform in SupportedPlatforms) { merged.Add (new (platform, Merge (this [platform], parent.Value [platform]))); } @@ -134,7 +134,7 @@ public bool Equals (SymbolAvailability other) { // loop over the supported platforms and ensure that the availabilities are the // same - foreach (var platform in supportedPlatforms) { + foreach (var platform in SupportedPlatforms) { if (this [platform] != other [platform]) { return false; } @@ -153,7 +153,7 @@ public override bool Equals (object? obj) public override int GetHashCode () { var hashCode = new HashCode (); - foreach (var platform in supportedPlatforms) { + foreach (var platform in SupportedPlatforms) { hashCode.Add (this [platform]); } diff --git a/src/rgen/Microsoft.Macios.Generator/Availability/SymbolAvailabilityBuilder.cs b/src/rgen/Microsoft.Macios.Generator/Availability/SymbolAvailabilityBuilder.cs index e350ee801b48..6f60d86c02b9 100644 --- a/src/rgen/Microsoft.Macios.Generator/Availability/SymbolAvailabilityBuilder.cs +++ b/src/rgen/Microsoft.Macios.Generator/Availability/SymbolAvailabilityBuilder.cs @@ -59,7 +59,7 @@ PlatformAvailability.Builder GetBuilder (ApplePlatform platform) /// Optional documentation url. internal void AddObsoletedVersion (ApplePlatform platform, Version version, string? message, string? url) { - if (!supportedPlatforms.Contains (platform)) + if (!SupportedPlatforms.Contains (platform)) return; var builder = GetBuilder (platform); @@ -72,7 +72,7 @@ internal void AddObsoletedVersion (ApplePlatform platform, Version version, stri /// The data of a ObsoleteOSPlatformAttribute. public void Add (ObsoletedOSPlatformData obsoletedOsPlatform) { - if (!supportedPlatforms.Contains (obsoletedOsPlatform.Platform)) + if (!SupportedPlatforms.Contains (obsoletedOsPlatform.Platform)) return; var builder = GetBuilder (obsoletedOsPlatform.Platform); @@ -87,7 +87,7 @@ public void Add (ObsoletedOSPlatformData obsoletedOsPlatform) /// The supported versions to add. internal void AddSupportedVersion (ApplePlatform platform, Version version) { - if (!supportedPlatforms.Contains (platform)) + if (!SupportedPlatforms.Contains (platform)) return; var builder = GetBuilder (platform); builder.AddSupportedVersion (new (version, SupportKind.Explicit)); @@ -99,7 +99,7 @@ internal void AddSupportedVersion (ApplePlatform platform, Version version) /// The data of a SupportedOSPlatformAttribute. public void Add (SupportedOSPlatformData supportedPlatform) { - if (!supportedPlatforms.Contains (supportedPlatform.Platform)) + if (!SupportedPlatforms.Contains (supportedPlatform.Platform)) return; var builder = GetBuilder (supportedPlatform.Platform); @@ -114,7 +114,7 @@ public void Add (SupportedOSPlatformData supportedPlatform) /// The optional message of the unsupported version. internal void AddUnsupportedVersion (ApplePlatform platform, Version version, string? message) { - if (!supportedPlatforms.Contains (platform)) + if (!SupportedPlatforms.Contains (platform)) return; var builder = GetBuilder (platform); @@ -127,7 +127,7 @@ internal void AddUnsupportedVersion (ApplePlatform platform, Version version, st /// The data of a UnsupportedOSPlatformAttribute. public void Add (UnsupportedOSPlatformData unsupportedPlatform) { - if (!supportedPlatforms.Contains (unsupportedPlatform.Platform)) + if (!SupportedPlatforms.Contains (unsupportedPlatform.Platform)) return; var builder = GetBuilder (unsupportedPlatform.Platform); @@ -146,7 +146,7 @@ public void Add (UnsupportedOSPlatformData unsupportedPlatform) public SymbolAvailability ToImmutable () { var dict = new Dictionary (); - foreach (var platform in supportedPlatforms) { + foreach (var platform in SupportedPlatforms) { dict [platform] = platforms.ContainsKey (platform) ? platforms [platform].ToImmutable () : null; diff --git a/src/rgen/Microsoft.Macios.Generator/DictionaryComparer.cs b/src/rgen/Microsoft.Macios.Generator/DictionaryComparer.cs index 2c81566d4b9e..51269c6db9e5 100644 --- a/src/rgen/Microsoft.Macios.Generator/DictionaryComparer.cs +++ b/src/rgen/Microsoft.Macios.Generator/DictionaryComparer.cs @@ -7,12 +7,12 @@ namespace Microsoft.Macios.Generator; public class DictionaryComparer (IEqualityComparer? valueComparer = null) - : EqualityComparer> + : EqualityComparer> where TKey : notnull { readonly IEqualityComparer valueComparer = valueComparer ?? EqualityComparer.Default; /// - public override bool Equals (IDictionary? x, IDictionary? y) + public override bool Equals (IReadOnlyDictionary? x, IReadOnlyDictionary? y) { if (x is null && y is null) return true; @@ -28,7 +28,7 @@ public override bool Equals (IDictionary? x, IDictionary - public override int GetHashCode (IDictionary obj) + public override int GetHashCode (IReadOnlyDictionary obj) { var hash = new HashCode (); foreach (var (key, value) in obj) { diff --git a/src/rsp/dotnet/ios-defines-dotnet.rsp b/src/rsp/dotnet/ios-defines-dotnet.rsp index 3e057b6fee73..a7773543f285 100644 --- a/src/rsp/dotnet/ios-defines-dotnet.rsp +++ b/src/rsp/dotnet/ios-defines-dotnet.rsp @@ -19,6 +19,7 @@ -d:HAS_AVROUTING -d:HAS_BACKGROUNDASSETS -d:HAS_BACKGROUNDTASKS +-d:HAS_BROWSERENGINECORE -d:HAS_BROWSERENGINEKIT -d:HAS_BUSINESSCHAT -d:HAS_CALLKIT @@ -64,6 +65,7 @@ -d:HAS_GAMECONTROLLER -d:HAS_GAMEKIT -d:HAS_GAMEPLAYKIT +-d:HAS_GAMESAVE -d:HAS_GLKIT -d:HAS_HEALTHKIT -d:HAS_HEALTHKITUI @@ -132,6 +134,7 @@ -d:HAS_SYMBOLS -d:HAS_SYSTEMCONFIGURATION -d:HAS_THREADNETWORK +-d:HAS_TOUCHCONTROLLER -d:HAS_TWITTER -d:HAS_UIKIT -d:HAS_UNIFORMTYPEIDENTIFIERS diff --git a/src/rsp/dotnet/maccatalyst-defines-dotnet.rsp b/src/rsp/dotnet/maccatalyst-defines-dotnet.rsp index 50cd57669cde..34f25c02fb2f 100644 --- a/src/rsp/dotnet/maccatalyst-defines-dotnet.rsp +++ b/src/rsp/dotnet/maccatalyst-defines-dotnet.rsp @@ -59,6 +59,7 @@ -d:HAS_GAMECONTROLLER -d:HAS_GAMEKIT -d:HAS_GAMEPLAYKIT +-d:HAS_GAMESAVE -d:HAS_HEALTHKIT -d:HAS_HEALTHKITUI -d:HAS_HOMEKIT diff --git a/src/rsp/dotnet/macos-defines-dotnet.rsp b/src/rsp/dotnet/macos-defines-dotnet.rsp index dbdfd46bdb74..17b1bd296208 100644 --- a/src/rsp/dotnet/macos-defines-dotnet.rsp +++ b/src/rsp/dotnet/macos-defines-dotnet.rsp @@ -58,6 +58,7 @@ -d:HAS_GAMECONTROLLER -d:HAS_GAMEKIT -d:HAS_GAMEPLAYKIT +-d:HAS_GAMESAVE -d:HAS_GLKIT -d:HAS_HEALTHKIT -d:HAS_IMAGECAPTURECORE diff --git a/tests/common/ConfigurationXUnit.cs b/tests/common/ConfigurationXUnit.cs index 0b965efca8f9..3cce031e4b0f 100644 --- a/tests/common/ConfigurationXUnit.cs +++ b/tests/common/ConfigurationXUnit.cs @@ -1,19 +1,26 @@ using System; +using System.Collections; using System.Collections.Generic; using System.Linq; +using System.Globalization; using System.Reflection; +using System.Reflection.Emit; +using System.Threading.Tasks; using Xamarin.Utils; +using Xunit; +using Xunit.Internal; using Xunit.Sdk; +using Xunit.v3; namespace Xamarin.Tests { - [AttributeUsage (AttributeTargets.Method, AllowMultiple = true, Inherited = true)] + [AttributeUsage (AttributeTargets.Method, AllowMultiple = true)] public sealed class PlatformInlineDataAttribute : DataAttribute { - readonly object [] dataValues; + readonly object [] data; public PlatformInlineDataAttribute (ApplePlatform platform, params object [] parameters) { // data values are the join of the platform and all other values passed to the attr - dataValues = parameters.Prepend (platform).ToArray (); + data = parameters.Prepend (platform).ToArray (); // based on the passed platform and the configuration, decide if we skip the test switch (platform) { case ApplePlatform.iOS: @@ -37,17 +44,32 @@ public PlatformInlineDataAttribute (ApplePlatform platform, params object [] par } } - public object [] DataValues { - get { return dataValues; } + public override bool SupportsDiscoveryEnumeration () => true; + + public object [] Data { + get { return data; } } - public override IEnumerable GetData (MethodInfo testMethod) + public override ValueTask> GetData (MethodInfo testMethod, DisposalTracker disposalTracker) { - yield return dataValues; + var traits = new Dictionary> (StringComparer.OrdinalIgnoreCase); + TestIntrospectionHelper.MergeTraitsInto (traits, Traits); + return new ([ + new TheoryDataRow (Data) { + Explicit = ExplicitAsNullable, + Label = Label, + Skip = Skip, + TestDisplayName = TestDisplayName, + Timeout = TimeoutAsNullable, + Traits = traits, + } + ]); + } + } - [AttributeUsage (AttributeTargets.Method, AllowMultiple = true, Inherited = true)] + [AttributeUsage (AttributeTargets.Method, AllowMultiple = true)] public sealed class AllSupportedPlatformsAttribute : DataAttribute { readonly object [] dataValues; @@ -57,15 +79,24 @@ public AllSupportedPlatformsAttribute (params object [] parameters) dataValues = parameters; } - public override IEnumerable GetData (MethodInfo testMethod) + public override bool SupportsDiscoveryEnumeration () => true; + + public override ValueTask> GetData ( + MethodInfo testMethod, + DisposalTracker disposalTracker) { - return Configuration. - GetIncludedPlatforms (). - Select (platform => dataValues.Prepend (platform).ToArray ()); + var result = new List (); + + foreach (var platform in Configuration.GetIncludedPlatforms ()) { + var row = dataValues.Prepend (platform).ToArray (); + result.Add (ConvertDataRow (row)); + } + + return ValueTask.FromResult (result.CastOrToReadOnlyCollection ()); } } - [AttributeUsage (AttributeTargets.Method, AllowMultiple = true, Inherited = true)] + [AttributeUsage (AttributeTargets.Method, AllowMultiple = true)] public sealed class AllSupportedPlatformsClassDataAttribute : DataAttribute where T : IEnumerable { readonly Type dataAttributeType; @@ -74,22 +105,64 @@ public AllSupportedPlatformsClassDataAttribute () dataAttributeType = typeof (T); } - public override IEnumerable GetData (MethodInfo testMethod) + public override bool SupportsDiscoveryEnumeration () => + !typeof (IDisposable).IsAssignableFrom (dataAttributeType) && !typeof (IAsyncDisposable).IsAssignableFrom (dataAttributeType); + + /// + protected override ITheoryDataRow ConvertDataRow (object dataRow) { - // we are going to get the instance of the IEnumerable, loop through it and yield the parameters - // per platform - var enumerable = Activator.CreateInstance (dataAttributeType) as IEnumerable; - if (enumerable is null) - yield break; - foreach (var platform in Configuration.GetIncludedPlatforms ()) { - foreach (var parameters in enumerable) { - yield return parameters.Prepend (platform).ToArray (); + Guard.ArgumentNotNull (dataRow); + + try { + return base.ConvertDataRow (dataRow); + } catch (ArgumentException) { + throw new ArgumentException ( + string.Format ( + CultureInfo.CurrentCulture, + "Class '{0}' yielded an item of type '{1}' which is not an 'object?[]', 'Xunit.ITheoryDataRow' or 'System.Runtime.CompilerServices.ITuple'", + dataAttributeType.FullName, + dataRow?.GetType ().SafeName () + ), + nameof (dataRow) + ); + } + } + + public override async ValueTask> GetData ( + MethodInfo testMethod, + DisposalTracker disposalTracker) + { + var classInstance = Activator.CreateInstance (dataAttributeType); + disposalTracker.Add (classInstance); + + if (classInstance is IAsyncLifetime classLifetime) + await classLifetime.InitializeAsync (); + + if (classInstance is IEnumerable dataItems) { + var result = new List (); + + foreach (var platform in Configuration.GetIncludedPlatforms ()) { + foreach (var row in dataItems) { + + var platformRow = row.Prepend (platform).ToArray (); + result.Add (ConvertDataRow (platformRow)); + } } + + return result.CastOrToReadOnlyCollection (); } + + throw new ArgumentException ( + string.Format ( + CultureInfo.CurrentCulture, + "'{0}' must implement one of the following interfaces to be used as ClassData:{1}- IEnumerable{1}", + dataAttributeType.FullName, + Environment.NewLine + ) + ); } } - public partial class Configuration { static string TestAssemblyDirectory { get { diff --git a/tests/rgen/Directory.Build.props b/tests/rgen/Directory.Build.props new file mode 100644 index 000000000000..8146e7d7a3e9 --- /dev/null +++ b/tests/rgen/Directory.Build.props @@ -0,0 +1,21 @@ + + + + + 17.13.0 + 3.1.1 + 1.23.0-pre.3 + 3.0.0-pre.25 + + + + 13.0 + enable + true + + + + + + + diff --git a/tests/rgen/Microsoft.Macios.Bindings.Analyzer.Tests/Microsoft.Macios.Bindings.Analyzer.Tests.csproj b/tests/rgen/Microsoft.Macios.Bindings.Analyzer.Tests/Microsoft.Macios.Bindings.Analyzer.Tests.csproj index 3679cb19bb65..95ac3c967762 100644 --- a/tests/rgen/Microsoft.Macios.Bindings.Analyzer.Tests/Microsoft.Macios.Bindings.Analyzer.Tests.csproj +++ b/tests/rgen/Microsoft.Macios.Bindings.Analyzer.Tests/Microsoft.Macios.Bindings.Analyzer.Tests.csproj @@ -9,13 +9,9 @@ - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - + + diff --git a/tests/rgen/Microsoft.Macios.Bindings.CodeFixers.Tests/Microsoft.Macios.Bindings.CodeFixers.Tests.csproj b/tests/rgen/Microsoft.Macios.Bindings.CodeFixers.Tests/Microsoft.Macios.Bindings.CodeFixers.Tests.csproj index 1dac34ff1738..3a9a128e59b4 100644 --- a/tests/rgen/Microsoft.Macios.Bindings.CodeFixers.Tests/Microsoft.Macios.Bindings.CodeFixers.Tests.csproj +++ b/tests/rgen/Microsoft.Macios.Bindings.CodeFixers.Tests/Microsoft.Macios.Bindings.CodeFixers.Tests.csproj @@ -15,11 +15,8 @@ - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - + + diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/AssertEx.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/AssertEx.cs new file mode 100644 index 000000000000..f436ef3fc840 --- /dev/null +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/AssertEx.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using Microsoft.Macios.Generator.Availability; +using Xunit; +using Xunit.Sdk; + +namespace Microsoft.Macios.Generator.Tests; + +/// +/// Provides a set of custom assertion methods that can be used with xUnit, including support for multiple assertion scopes. +/// +public class AssertEx { + + /// + /// Verifies that two instances are equal by comparing their properties within a multiple assertion scope. + /// + /// The expected platform availability. + /// The actual platform availability. + internal static void Equal (PlatformAvailability? expected, PlatformAvailability? actual) + { + var obsoleteComparer = new DictionaryComparer (); + var unsupportedComparer = new DictionaryComparer (); + Assert.Multiple ( + () => Assert.Equal (expected?.Platform, actual?.Platform), + () => Assert.Equal (expected?.SupportedVersion, actual?.SupportedVersion), + () => Assert.True (unsupportedComparer.Equals (expected?.UnsupportedVersions, actual?.UnsupportedVersions)), + () => Assert.True (obsoleteComparer.Equals (expected?.ObsoletedVersions, actual?.ObsoletedVersions)) + ); + } + + /// + /// Verifies that two instances are equal by comparing the availability for each supported platform within a multiple assertion scope. + /// + /// The expected symbol availability. + /// The actual symbol availability. + internal static void Equal (SymbolAvailability expected, SymbolAvailability actual) + { + var platformActions = new List (); + // compare each of the platforms individually + foreach (var platform in SymbolAvailability.SupportedPlatforms) { + platformActions.Add (() => Equal (expected [platform], actual [platform])); + } + + Assert.Multiple (platformActions.ToArray ()); + } +} diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Attributes/ProtocolMemberDataTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/Attributes/ProtocolMemberDataTests.cs index 0fc0420f26e9..1d2a77698679 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/Attributes/ProtocolMemberDataTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Attributes/ProtocolMemberDataTests.cs @@ -282,7 +282,7 @@ void FromPropertyDeclaration (ApplePlatform platform, string inputText, Protocol var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -611,7 +611,7 @@ void FromMethodDeclaration (ApplePlatform platform, string inputText, ProtocolMe var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/BindingSourceGeneratorGeneratorTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/BindingSourceGeneratorGeneratorTests.cs index 7260272b04f7..9f9f87114cf9 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/BindingSourceGeneratorGeneratorTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/BindingSourceGeneratorGeneratorTests.cs @@ -128,12 +128,12 @@ public void CorrectUsingImports (ApplePlatform platform, string input, string ex // Run generators and retrieve all results. var driver = CSharpGeneratorDriver.Create (new BindingSourceGeneratorGenerator ()); - var runResult = driver.RunGenerators (compilation).GetRunResult (); + var runResult = driver.RunGenerators (compilation, TestContext.Current.CancellationToken).GetRunResult (); Assert.Empty (runResult.Diagnostics); // ensure that we do have all the needed attributes present var generatedFile = runResult.GeneratedTrees.SingleOrDefault (t => t.FilePath.EndsWith ("AVAudioPcmBuffer.g.cs")); Assert.NotNull (generatedFile); - Assert.Equal (expectedOutput, generatedFile.GetText ().ToString ()); + Assert.Equal (expectedOutput, generatedFile.GetText (TestContext.Current.CancellationToken).ToString ()); } } diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/BindingTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/BindingTests.cs index bc302a8fbe56..126201409f15 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/BindingTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/BindingTests.cs @@ -76,7 +76,7 @@ public void SkipEnumValueDeclaration (ApplePlatform platform, string inputText, var (compilation, sourceTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (sourceTrees); // get the declarations we want to work with and the semantic model - var node = sourceTrees [0].GetRoot () + var node = sourceTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); @@ -185,7 +185,7 @@ public void SkipPropertyDeclaration (ApplePlatform platform, string inputText, b var (compilation, sourceTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (sourceTrees); // get the declarations we want to work with and the semantic model - var node = sourceTrees [0].GetRoot () + var node = sourceTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); @@ -251,7 +251,7 @@ public void SkipMethodDeclaration (ApplePlatform platform, string inputText, boo CreateCompilation (platform, sources: inputText); Assert.Single (sourceTrees); // get the declarations we want to work with and the semantic model - var node = sourceTrees [0].GetRoot () + var node = sourceTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/ClassBindingTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/ClassBindingTests.cs index 2c53941ee002..b616a1e061ca 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/ClassBindingTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/ClassBindingTests.cs @@ -1448,7 +1448,7 @@ void CodeChangesFromClassDeclaration (ApplePlatform platform, string inputText, var (compilation, sourceTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (sourceTrees); // get the declarations we want to work with and the semantic model - var node = sourceTrees [0].GetRoot () + var node = sourceTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/ConstructorTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/ConstructorTests.cs index 59222130c9f8..1750656a9b61 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/ConstructorTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/ConstructorTests.cs @@ -553,7 +553,7 @@ void FromConstructorDeclaration (ApplePlatform platform, string inputText, Const var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/DelegateInfoTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/DelegateInfoTests.cs index 2299dca3dcdb..2a24042aea69 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/DelegateInfoTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/DelegateInfoTests.cs @@ -668,7 +668,7 @@ void FromMethodDeclaration (ApplePlatform platform, string inputText, Method exp var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/EventTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/EventTests.cs index dc5075d0c760..fdfac7e57164 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/EventTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/EventTests.cs @@ -291,7 +291,7 @@ void FromEventDeclaration (ApplePlatform platform, string inputText, Event expec var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/InterfaceCodeChangesTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/InterfaceCodeChangesTests.cs index f6b70a925932..535e0264c5e9 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/InterfaceCodeChangesTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/InterfaceCodeChangesTests.cs @@ -1248,7 +1248,7 @@ void CodeChangesFromInterfaceDeclaration (ApplePlatform platform, string inputTe CreateCompilation (platform, sources: inputText); Assert.Single (sourceTrees); // get the declarations we want to work with and the semantic model - var node = sourceTrees [0].GetRoot () + var node = sourceTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .LastOrDefault (); // always get the last one so that inherirance tests are correct diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/MethodTests/FromDeclarationTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/MethodTests/FromDeclarationTests.cs index 3e00147d1c76..7ccd3dc0882d 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/MethodTests/FromDeclarationTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/MethodTests/FromDeclarationTests.cs @@ -870,7 +870,7 @@ void FromMethodDeclaration (ApplePlatform platform, string inputText, Method exp var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -944,7 +944,7 @@ void FromMethodDeclarationToAsync (ApplePlatform platform, string inputText) var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -1009,7 +1009,7 @@ void FromMethodDeclarationIsOptional (ApplePlatform platform, string inputText, var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -1065,7 +1065,7 @@ void FromMethodDeclarationIsVariadic (ApplePlatform platform, string inputText, var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -1102,7 +1102,7 @@ interface IAVAudioMixing { var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -1142,7 +1142,7 @@ interface IAVAudioMixing { var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -1182,7 +1182,7 @@ interface IAVAudioMixing { var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -1289,7 +1289,7 @@ void FromMethodDeclarationToConstructor (ApplePlatform platform, string inputTex var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/PropertyTests/FromDeclarationTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/PropertyTests/FromDeclarationTests.cs index 2f92e7d7ed6c..5519b34dd6fd 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/PropertyTests/FromDeclarationTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/PropertyTests/FromDeclarationTests.cs @@ -1104,7 +1104,7 @@ void FromPropertyDeclaration (ApplePlatform platform, string inputText, Property var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -1338,7 +1338,7 @@ void ToExtensionMethods (ApplePlatform platform, string inputText, TypeInfo prot var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -1390,7 +1390,7 @@ interface IAVAudioMixing { var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/TypeInfoTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/TypeInfoTests.cs index 803c19ac0e88..e8557e0b59a4 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/TypeInfoTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/TypeInfoTests.cs @@ -424,7 +424,7 @@ void FromMethodDeclaration (ApplePlatform platform, string inputText, Method exp var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -460,7 +460,7 @@ public unsafe void ProcessPointer (int* pointer) var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -499,7 +499,7 @@ public int ProcessPointer (List pointer) var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -543,7 +543,7 @@ public int ProcessPointer (ExampleClass[] pointer) var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -580,7 +580,7 @@ public int ProcessPointer (int pointer) var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -617,7 +617,7 @@ public int ProcessPointer (string[] pointer) var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -660,7 +660,7 @@ public int ProcessPointer (ExampleClass pointer) var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -705,7 +705,7 @@ public int ProcessPointer (ExampleClass pointer) var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -762,7 +762,7 @@ public void ProcessPointer ({action} myTask) var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -802,7 +802,7 @@ public void ProcessPointer (Callback myTask) var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -886,7 +886,7 @@ public partial class EventTests { var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .LastOrDefault (); Assert.NotNull (declaration); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/TypeInfoToMarshallTypeTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/TypeInfoToMarshallTypeTests.cs index 3d79f7613f44..9676c489c390 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/TypeInfoToMarshallTypeTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/TypeInfoToMarshallTypeTests.cs @@ -199,7 +199,7 @@ void ToMarshallType (ApplePlatform platform, string inputText, string expectedTy var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryArgumentsTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryArgumentsTests.cs index 5db19a12512f..b02501498d8f 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryArgumentsTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryArgumentsTests.cs @@ -569,7 +569,7 @@ void GetTrampolinePostNativeInvokeArgumentConversionsTests (ApplePlatform platfo var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -1218,7 +1218,7 @@ void GetTrampolinePreNativeInvokeArgumentConversionsTests (ApplePlatform platfor var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -1871,7 +1871,7 @@ void GetTrampolineValidationsArgumentConversionsTests (ApplePlatform platform, s var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -1976,7 +1976,7 @@ void GetTrampolineInvokeArgumentNativeInitializationsTests (ApplePlatform platfo var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -2062,7 +2062,7 @@ void GetTrampolineInvokeArgumentInitializationsTests (ApplePlatform platform, st var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryConstructorTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryConstructorTests.cs index 3281362238c8..3480b3498f0a 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryConstructorTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryConstructorTests.cs @@ -120,7 +120,7 @@ void GetInvocationsTests (ApplePlatform platform, string inputText, string expec var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryFieldAccessorsTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryFieldAccessorsTests.cs index 0a2da4ac8010..3650af9eef1c 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryFieldAccessorsTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryFieldAccessorsTests.cs @@ -825,7 +825,7 @@ void FieldConstantGetterTests (ApplePlatform platform, string inputText, string CreateCompilation (platform, sources: inputText); Assert.Single (sourceTrees); // get the declarations we want to work with and the semantic model - var node = sourceTrees [0].GetRoot () + var node = sourceTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); @@ -1682,7 +1682,7 @@ void FieldConstantSetterTests (ApplePlatform platform, string inputText, string CreateCompilation (platform, sources: inputText); Assert.Single (sourceTrees); // get the declarations we want to work with and the semantic model - var node = sourceTrees [0].GetRoot () + var node = sourceTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryFieldBackingVariableTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryFieldBackingVariableTests.cs index 79148a8a941f..141bd2ed4e85 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryFieldBackingVariableTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryFieldBackingVariableTests.cs @@ -636,7 +636,7 @@ void FieldConstantGetterTests (ApplePlatform platform, string inputText, string CreateCompilation (platform, sources: inputText); Assert.Single (sourceTrees); // get the declarations we want to work with and the semantic model - var node = sourceTrees [0].GetRoot () + var node = sourceTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryMethodTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryMethodTests.cs index cc893aed64a0..5b6e4e3dfabb 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryMethodTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryMethodTests.cs @@ -347,7 +347,7 @@ void GetInvocationsTests (ApplePlatform platform, string inputText, string expec var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -462,7 +462,7 @@ void GetCallbackDeclarationTests (ApplePlatform platform, string inputText, stri var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryStrongDictionaryTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryStrongDictionaryTests.cs index bf3b91cf162b..2aa6c8f50ea4 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryStrongDictionaryTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryStrongDictionaryTests.cs @@ -716,7 +716,7 @@ void GetInvocationsTests (ApplePlatform platform, string inputText, string expec var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .LastOrDefault (); Assert.NotNull (declaration); @@ -758,7 +758,7 @@ public static class Keys { var (compilation, syntaxTrees) = CreateCompilation (platform, sources: uiEdgeInsetsGetter); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .LastOrDefault (); Assert.NotNull (declaration); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryTrampolineTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryTrampolineTests.cs index ec2375054f3a..396a70c53319 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryTrampolineTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryTrampolineTests.cs @@ -372,7 +372,7 @@ void GetTrampolineInvokeReturnTypeTests (ApplePlatform platform, string inputTex var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -799,7 +799,7 @@ void GetTrampolineNativeInvokeReturnTypeTests (ApplePlatform platform, string in var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -1366,7 +1366,7 @@ void GetTrampolineInvokeArgumentTests (ApplePlatform platform, string trampoline var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -1765,7 +1765,7 @@ void GetTrampolinePreInvokeArgumentConversionsTests (ApplePlatform platform, str var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -2187,7 +2187,7 @@ void GetTrampolinePostInvokeArgumentConversionsTests (ApplePlatform platform, st var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -2583,7 +2583,7 @@ void GetTrampolineDelegateDeclarationTests (ApplePlatform platform, string input var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -2831,7 +2831,7 @@ void CallTrampolineDelegateTests (ApplePlatform platform, string trampolineName, var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -3233,7 +3233,7 @@ void GetTrampolineInvokeParameterTests (ApplePlatform platform, string inputText var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -3608,7 +3608,7 @@ void GetTrampolineInvokeDeclarationTests (ApplePlatform platform, string inputTe var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -3926,7 +3926,7 @@ void GetTrampolineDelegatePointerTests (ApplePlatform platform, string inputText var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -4246,7 +4246,7 @@ void GetTrampolineNativeInvokeSignatureTests (ApplePlatform platform, string inp var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -4528,7 +4528,7 @@ void CallNativeInvokerDelegateTests (ApplePlatform platform, string inputText, s var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -4638,7 +4638,7 @@ void TrampolioneNativeNativeInvocationClassCreateTests (ApplePlatform platform, var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/GetObjCMessageSendMethodNameTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/GetObjCMessageSendMethodNameTests.cs index a2bd744cbd82..80f8e648eb25 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/GetObjCMessageSendMethodNameTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/GetObjCMessageSendMethodNameTests.cs @@ -385,7 +385,7 @@ void GetObjCMessageSendMethodNamePropertiesTests (ApplePlatform platform, string var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/FieldSymbolExtensionsTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/FieldSymbolExtensionsTests.cs index fe5ca9ec4e01..415b73c1fc9d 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/FieldSymbolExtensionsTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/FieldSymbolExtensionsTests.cs @@ -35,13 +35,13 @@ public enum MyEnum { var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputString); Assert.Single (syntaxTrees); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); Assert.NotNull (declaration); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); var enumValue = symbol.GetMembers ().FirstOrDefault () as IFieldSymbol; Assert.NotNull (enumValue); @@ -65,13 +65,13 @@ public enum MyEnum { "; var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputString); Assert.Single (syntaxTrees); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); Assert.NotNull (declaration); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); var enumValue = symbol.GetMembers ().FirstOrDefault () as IFieldSymbol; Assert.NotNull (enumValue); @@ -97,13 +97,13 @@ public enum MyEnum { "; var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputString); Assert.Single (syntaxTrees); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); Assert.NotNull (declaration); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); var enumValue = symbol.GetMembers ().FirstOrDefault () as IFieldSymbol; Assert.NotNull (enumValue); @@ -182,13 +182,13 @@ public void GetFieldDataPresentAttributeNotValid (ApplePlatform platform, string { var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputString); Assert.Single (syntaxTrees); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); Assert.NotNull (declaration); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); var enumValue = symbol.GetMembers ().FirstOrDefault () as IFieldSymbol; Assert.NotNull (enumValue); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/MemberDeclarationSyntaxExtensionsTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/MemberDeclarationSyntaxExtensionsTests.cs index 55cd78ba4b30..dbdc2353b75f 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/MemberDeclarationSyntaxExtensionsTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/MemberDeclarationSyntaxExtensionsTests.cs @@ -61,7 +61,7 @@ public interface IInterface { CreateCompilation (platform, sources: [attrsText, inputText]); Assert.Equal (2, sourceTrees.Length); // get the declarations we want to work with and the semantic model - var nodes = sourceTrees [1].GetRoot ().DescendantNodes ().ToArray (); + var nodes = sourceTrees [1].GetRoot (TestContext.Current.CancellationToken).DescendantNodes ().ToArray (); var classDeclaration = nodes .OfType () .FirstOrDefault (); @@ -127,7 +127,7 @@ public void SayGoodbye () { CreateCompilation (platform, sources: inputText); Assert.Single (sourceTrees); // get the declarations we want to work with and the semantic model - var declarations = sourceTrees [0].GetRoot () + var declarations = sourceTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .ToArray (); @@ -178,7 +178,7 @@ public void SayHello () { CreateCompilation (platform, sources: [attrsText, inputText]); Assert.Equal (2, sourceTrees.Length); // get the declarations we want to work with and the semantic model - var nodes = sourceTrees [1].GetRoot ().DescendantNodes ().ToArray (); + var nodes = sourceTrees [1].GetRoot (TestContext.Current.CancellationToken).DescendantNodes ().ToArray (); var methodDeclarationSyntax = nodes .OfType () .FirstOrDefault (); @@ -240,7 +240,7 @@ void GetBindingType (ApplePlatform platform, string input, BindingType expectedB { var (compilation, sourceTrees) = CreateCompilation (platform, sources: [input]); Assert.Single (sourceTrees); - var classDeclaration = sourceTrees [0].GetRoot () + var classDeclaration = sourceTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/NamedTypeSymbolExtensionsTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/NamedTypeSymbolExtensionsTests.cs index d3aa0a818cc4..431907a15dcb 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/NamedTypeSymbolExtensionsTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/NamedTypeSymbolExtensionsTests.cs @@ -24,13 +24,13 @@ public class NotEnum { "; var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputString); Assert.Single (syntaxTrees); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); Assert.NotNull (declaration); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); Assert.False (symbol.TryGetEnumFields (out var fields, out var diagnostics)); Assert.Null (fields); @@ -70,13 +70,13 @@ public void TryGetEnumFieldsNoFields (ApplePlatform platform, string inputString { var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputString); Assert.Single (syntaxTrees); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); Assert.NotNull (declaration); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); Assert.True (symbol.TryGetEnumFields (out var fields, out var diagnostics)); Assert.NotNull (fields); @@ -154,13 +154,13 @@ public void TryGetEnumFieldsInvalidFields (ApplePlatform platform, string inputS { var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputString); Assert.Single (syntaxTrees); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); Assert.NotNull (declaration); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); Assert.True (symbol.TryGetEnumFields (out var fields, out var diagnostics)); Assert.NotNull (fields); @@ -187,13 +187,13 @@ public enum MyEnum { "; var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputString); Assert.Single (syntaxTrees); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); Assert.NotNull (declaration); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); Assert.True (symbol.TryGetEnumFields (out var fields, out var diagnostics)); // we should get no fields because there are no attributes diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/SemanticModelExtensionsTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/SemanticModelExtensionsTests.cs index 1514afafc2a4..8febbf5d2a28 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/SemanticModelExtensionsTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/SemanticModelExtensionsTests.cs @@ -711,7 +711,7 @@ internal void GetNameAndNamespaceTests (ApplePlatform platform, BindingType bind var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .LastOrDefault (); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/SyntaxTreeExtensionsTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/SyntaxTreeExtensionsTests.cs index c40457499911..ad9579969c2f 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/SyntaxTreeExtensionsTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/SyntaxTreeExtensionsTests.cs @@ -57,7 +57,7 @@ public void CollectUsingStatementsTest (ApplePlatform platform, string inputText { var (_, sourceTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (sourceTrees); - var tree = sourceTrees [0].GetRoot ().SyntaxTree; + var tree = sourceTrees [0].GetRoot (TestContext.Current.CancellationToken).SyntaxTree; Assert.NotNull (tree); Assert.Equal (expectedUsingStatements, tree.CollectUsingStatements (), comparer); } diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/TypeSymbolExtensionsInheritanceTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/TypeSymbolExtensionsInheritanceTests.cs index 3b73ef02c7ed..44c162bcbd71 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/TypeSymbolExtensionsInheritanceTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/TypeSymbolExtensionsInheritanceTests.cs @@ -302,14 +302,14 @@ void GetInheritance (ApplePlatform platform, string inputText, { var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .LastOrDefault (); // always grab the last one, you might get into failures if you are not careful with this Assert.NotNull (declaration); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); Assert.NotNull (semanticModel); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); symbol.GetInheritance ( isNSObject: out var isNsObject, @@ -369,14 +369,14 @@ void NSObjectTests (ApplePlatform platform, string inputText) { var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .LastOrDefault (); // always grab the last one, you might get into failures if you are not careful with this Assert.NotNull (declaration); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); Assert.NotNull (semanticModel); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); Assert.True (Property.TryCreate (declaration, semanticModel, out var propertyData)); Assert.NotNull (propertyData); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/TypeSymbolExtensionsSizeTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/TypeSymbolExtensionsSizeTests.cs index 83371b2b6f3d..5306a247eda0 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/TypeSymbolExtensionsSizeTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/TypeSymbolExtensionsSizeTests.cs @@ -240,11 +240,11 @@ public void TryGetBuiltInTypeSizeTests (ApplePlatform platform, string inputText var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); var expectedResult = Stret.IsBuiltInType (type, out var expectedTypeSize); @@ -431,11 +431,11 @@ public void GetValueTypeSizeTests (ApplePlatform platform, string inputText, int var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); var x = symbol.GetValueTypeSize (new ()); Assert.Equal (expectedSize, symbol.GetValueTypeSize (new ())); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/TypeSymbolExtensionsTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/TypeSymbolExtensionsTests.cs index b867729fdcb2..1e124b1fd6b6 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/TypeSymbolExtensionsTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/TypeSymbolExtensionsTests.cs @@ -86,12 +86,12 @@ public void GetAttributeDataPresent (ApplePlatform platform, string inputText, s var (compilation, syntaxTrees) = CreateCompilation (platform, sources: [inputText, attributesText]); Assert.Equal (2, syntaxTrees.Length); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); Assert.NotNull (declaration); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); var attrs = symbol.GetAttributeData (); Assert.Equal (expectedAttributes.Count, attrs.Keys.Count); @@ -202,9 +202,9 @@ public void GetParentTests (ApplePlatform platform, string inputText, var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = getNode (syntaxTrees [0].GetRoot ()); + var declaration = getNode (syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken)); Assert.NotNull (declaration); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); var parents = symbol.GetParents ().Select (p => p.Name).ToArray (); Assert.Equal (expectedParents, parents); @@ -332,9 +332,9 @@ void GetSupportedPlatforms (ApplePlatform platform, string inputText, var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = getNode (syntaxTrees [0].GetRoot ()); + var declaration = getNode (syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken)); Assert.NotNull (declaration); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); var availability = symbol.GetSupportedPlatforms (); Assert.Equal (availability, expectedAvailability); @@ -367,12 +367,12 @@ void HasAttributeTests (ApplePlatform platform, string inputText, string attrNam var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .LastOrDefault (); Assert.NotNull (declaration); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); Assert.Equal (expected, symbol.HasAttribute (attrName)); } @@ -429,12 +429,12 @@ void IsSmartEnumTests (ApplePlatform platform, string inputText, bool expected) var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .LastOrDefault (); Assert.NotNull (declaration); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); Assert.Equal (expected, symbol.IsSmartEnum ()); } @@ -496,14 +496,14 @@ void GetExportData (ApplePlatform platform, string inputText, T @enum, Export Assert.NotNull (@enum); var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); Assert.NotNull (declaration); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); Assert.NotNull (semanticModel); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); var exportData = symbol.GetExportData (new (semanticModel)); Assert.Equal (expectedData, exportData); @@ -537,14 +537,14 @@ void GetFieldData (ApplePlatform platform, string inputText, T @enum, FieldDa Assert.NotNull (@enum); var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); Assert.NotNull (declaration); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); Assert.NotNull (semanticModel); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); var fieldData = symbol.GetFieldData (); Assert.Equal (expectedData, fieldData); @@ -1691,14 +1691,14 @@ void IsBlittable (ApplePlatform platform, string inputText, bool expectedResult) { var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); Assert.NotNull (declaration); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); Assert.NotNull (semanticModel); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); Assert.Equal (expectedResult, symbol.Type.IsBlittable ()); } @@ -1848,14 +1848,14 @@ void IsWrapped (ApplePlatform platform, string inputText, bool expectedResult) { var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); Assert.NotNull (declaration); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); Assert.NotNull (semanticModel); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); Assert.Equal (expectedResult, symbol.Type.IsWrapped ()); } @@ -2005,14 +2005,14 @@ void IsINativeObjectTests (ApplePlatform platform, string inputText, bool expect { var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); Assert.NotNull (declaration); var semanticModel = compilation.GetSemanticModel (syntaxTrees [0]); Assert.NotNull (semanticModel); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); Assert.Equal (expectedResult, symbol.Type.IsINativeObject ()); } diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Formatters/ConstructorFormatterTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/Formatters/ConstructorFormatterTests.cs index 66e87e9bcd22..6ead16a327c9 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/Formatters/ConstructorFormatterTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Formatters/ConstructorFormatterTests.cs @@ -343,7 +343,7 @@ public void ToDeclarationTests (ApplePlatform platform, string inputText, string { var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Formatters/MethodFormatterTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/Formatters/MethodFormatterTests.cs index 6601229621b8..cff960c5509b 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/Formatters/MethodFormatterTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Formatters/MethodFormatterTests.cs @@ -576,7 +576,7 @@ public void ToDeclarationTests (ApplePlatform platform, string inputText, string { var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Formatters/PropertyFormatterTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/Formatters/PropertyFormatterTests.cs index a1d269fbd279..a9158a6320e6 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/Formatters/PropertyFormatterTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Formatters/PropertyFormatterTests.cs @@ -88,7 +88,7 @@ public void ToDeclarationTests (ApplePlatform platform, string inputText, string { var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Formatters/SmartEnumFormatterTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/Formatters/SmartEnumFormatterTests.cs index a75616cfc6e1..20d4db7007b1 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/Formatters/SmartEnumFormatterTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Formatters/SmartEnumFormatterTests.cs @@ -66,7 +66,7 @@ public void ToDeclarationTests (ApplePlatform platform, string inputText, string { var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Microsoft.Macios.Generator.Tests.csproj b/tests/rgen/Microsoft.Macios.Generator.Tests/Microsoft.Macios.Generator.Tests.csproj index f7795989d054..c4bb51ac932f 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/Microsoft.Macios.Generator.Tests.csproj +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Microsoft.Macios.Generator.Tests.csproj @@ -17,13 +17,9 @@ - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - + + diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/NomenclatorTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/NomenclatorTests.cs index f0beaf962390..a9700019d781 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/NomenclatorTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/NomenclatorTests.cs @@ -45,7 +45,7 @@ public class Example { var (compilation, syntaxTrees) = CreateCompilation (platform, sources: code); Assert.Single (syntaxTrees); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); @@ -88,7 +88,7 @@ public class GenericTrampoline where T : class { var (compilation, syntaxTrees) = CreateCompilation (platform, sources: code); Assert.Single (syntaxTrees); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); @@ -130,7 +130,7 @@ public class Example { var (compilation, syntaxTrees) = CreateCompilation (platform, sources: code); Assert.Single (syntaxTrees); - var declaration = syntaxTrees [0].GetRoot () + var declaration = syntaxTrees [0].GetRoot (TestContext.Current.CancellationToken) .DescendantNodes () .OfType () .FirstOrDefault (); diff --git a/tests/rgen/Microsoft.Macios.Transformer.Tests/Attributes/AvailabilityTests.cs b/tests/rgen/Microsoft.Macios.Transformer.Tests/Attributes/AvailabilityTests.cs index ec7d680fc4fd..a63ce641cc61 100644 --- a/tests/rgen/Microsoft.Macios.Transformer.Tests/Attributes/AvailabilityTests.cs +++ b/tests/rgen/Microsoft.Macios.Transformer.Tests/Attributes/AvailabilityTests.cs @@ -125,10 +125,10 @@ interface UIFeedbackGenerator : UIInteraction { void TryCreateTests (ApplePlatform platform, (string Source, string Path) source, SymbolAvailability expectedData) { var compilation = CreateCompilation (platform, sources: source); - var x = compilation.GetDiagnostics (); + var x = compilation.GetDiagnostics (TestContext.Current.CancellationToken); var syntaxTree = compilation.SyntaxTrees.FirstOrDefault (t => t.FilePath == source.Path); Assert.NotNull (syntaxTree); - var declaration = syntaxTree.GetRoot () + var declaration = syntaxTree.GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); @@ -136,7 +136,7 @@ void TryCreateTests (ApplePlatform platform, (string Source, string Path) source var semanticModel = compilation.GetSemanticModel (syntaxTree); Assert.NotNull (semanticModel); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); // the transformation does not care about the parents, we want the exact same as was added by diff --git a/tests/rgen/Microsoft.Macios.Transformer.Tests/Attributes/BindAsDataTests.cs b/tests/rgen/Microsoft.Macios.Transformer.Tests/Attributes/BindAsDataTests.cs index 86b88aef4301..8db3a414b572 100644 --- a/tests/rgen/Microsoft.Macios.Transformer.Tests/Attributes/BindAsDataTests.cs +++ b/tests/rgen/Microsoft.Macios.Transformer.Tests/Attributes/BindAsDataTests.cs @@ -117,13 +117,13 @@ void TryCreateTests (ApplePlatform platform, T _, (string Source, string Path var semanticModel = compilation.GetSemanticModel (syntaxTree); Assert.NotNull (semanticModel); - var declaration = syntaxTree.GetRoot () + var declaration = syntaxTree.GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .LastOrDefault (); Assert.NotNull (declaration); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); var attribute = symbol.GetAttribute (AttributesNames.BindAsAttribute, BindAsData.TryParse); Assert.NotNull (attribute); diff --git a/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/BindingMethodTests.cs b/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/BindingMethodTests.cs index 32ba1dba5798..c4b01021eba3 100644 --- a/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/BindingMethodTests.cs +++ b/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/BindingMethodTests.cs @@ -376,12 +376,12 @@ void TryCreateTests (ApplePlatform platform, (string Source, string Path) source var semanticModel = compilation.GetSemanticModel (syntaxTree); Assert.NotNull (semanticModel); - var declaration = syntaxTree.GetRoot () + var declaration = syntaxTree.GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .LastOrDefault (); Assert.NotNull (declaration); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); var binding = new Binding (declaration, symbol, new (semanticModel)); diff --git a/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/BindingPropertyTests.cs b/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/BindingPropertyTests.cs index bfce904b5e7b..b9a15c472be5 100644 --- a/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/BindingPropertyTests.cs +++ b/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/BindingPropertyTests.cs @@ -324,12 +324,12 @@ void TryCreateTests (ApplePlatform platform, (string Source, string Path) source var semanticModel = compilation.GetSemanticModel (syntaxTree); Assert.NotNull (semanticModel); - var declaration = syntaxTree.GetRoot () + var declaration = syntaxTree.GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .LastOrDefault (); Assert.NotNull (declaration); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); var binding = new Binding (declaration, symbol, new (semanticModel)); diff --git a/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/BindingTests.cs b/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/BindingTests.cs index ec86fb729834..71356f3589bb 100644 --- a/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/BindingTests.cs +++ b/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/BindingTests.cs @@ -468,12 +468,12 @@ void TryCreateTests (ApplePlatform platform, (string Source, string Path) source var semanticModel = compilation.GetSemanticModel (syntaxTree); Assert.NotNull (semanticModel); - var declaration = syntaxTree.GetRoot () + var declaration = syntaxTree.GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .LastOrDefault (); Assert.NotNull (declaration); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); var binding = new Binding (declaration, symbol, new (semanticModel)); diff --git a/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/GeneralTests.cs b/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/GeneralTests.cs index afb2ecc13ec4..52b9dcd1dad1 100644 --- a/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/GeneralTests.cs +++ b/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/GeneralTests.cs @@ -359,7 +359,7 @@ void TryCreateTests (ApplePlatform platform, (string Source, string Path) source var semanticModel = compilation.GetSemanticModel (syntaxTree); Assert.NotNull (semanticModel); - var declaration = syntaxTree.GetRoot () + var declaration = syntaxTree.GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .LastOrDefault (); Assert.NotNull (declaration); diff --git a/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/ParameterTests.cs b/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/ParameterTests.cs index 1e7e1afeb194..bff5dbf5b4da 100644 --- a/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/ParameterTests.cs +++ b/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/ParameterTests.cs @@ -325,13 +325,13 @@ void TryCreateTests (ApplePlatform platform, (string Source, string Path) source var semanticModel = compilation.GetSemanticModel (syntaxTree); Assert.NotNull (semanticModel); - var declaration = syntaxTree.GetRoot () + var declaration = syntaxTree.GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .LastOrDefault (); Assert.NotNull (declaration); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); Assert.True (Parameter.TryCreate (symbol, declaration, semanticModel, out var parameter)); Assert.Equal (expectedData, parameter); diff --git a/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/PropertyTests.cs b/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/PropertyTests.cs index 3ae1ec3ce27a..e7bdd2b8c90c 100644 --- a/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/PropertyTests.cs +++ b/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/PropertyTests.cs @@ -309,7 +309,7 @@ void TryCreateTests (ApplePlatform platform, (string Source, string Path) source var semanticModel = compilation.GetSemanticModel (syntaxTree); Assert.NotNull (semanticModel); - var declaration = syntaxTree.GetRoot () + var declaration = syntaxTree.GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .LastOrDefault (); Assert.NotNull (declaration); diff --git a/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/SmartEnumTests.cs b/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/SmartEnumTests.cs index b2ff37e3de23..4ffbac968713 100644 --- a/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/SmartEnumTests.cs +++ b/tests/rgen/Microsoft.Macios.Transformer.Tests/DataModel/SmartEnumTests.cs @@ -153,12 +153,12 @@ void TryCreateTests (ApplePlatform platform, (string Source, string Path) source var semanticModel = compilation.GetSemanticModel (syntaxTree); Assert.NotNull (semanticModel); - var declaration = syntaxTree.GetRoot () + var declaration = syntaxTree.GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .LastOrDefault (); Assert.NotNull (declaration); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); var binding = new Binding (declaration, symbol, new (semanticModel)); diff --git a/tests/rgen/Microsoft.Macios.Transformer.Tests/Extensions/TypeSymbolExtensionsTests.cs b/tests/rgen/Microsoft.Macios.Transformer.Tests/Extensions/TypeSymbolExtensionsTests.cs index dd8dc1b2ceee..e1d0c10aeffc 100644 --- a/tests/rgen/Microsoft.Macios.Transformer.Tests/Extensions/TypeSymbolExtensionsTests.cs +++ b/tests/rgen/Microsoft.Macios.Transformer.Tests/Extensions/TypeSymbolExtensionsTests.cs @@ -84,13 +84,13 @@ void IsSmartEnumTests (ApplePlatform platform, (string Source, string Path) sour var semanticModel = compilation.GetSemanticModel (syntaxTree); Assert.NotNull (semanticModel); - var declaration = syntaxTree.GetRoot () + var declaration = syntaxTree.GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .LastOrDefault (); Assert.NotNull (declaration); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); var isSmartEnum = symbol.IsSmartEnum (); Assert.Equal (expectedResult, symbol.IsSmartEnum ()); diff --git a/tests/rgen/Microsoft.Macios.Transformer.Tests/Microsoft.Macios.Transformer.Tests.csproj b/tests/rgen/Microsoft.Macios.Transformer.Tests/Microsoft.Macios.Transformer.Tests.csproj index efba1360375b..46bdf24c9285 100644 --- a/tests/rgen/Microsoft.Macios.Transformer.Tests/Microsoft.Macios.Transformer.Tests.csproj +++ b/tests/rgen/Microsoft.Macios.Transformer.Tests/Microsoft.Macios.Transformer.Tests.csproj @@ -23,8 +23,8 @@ - - + + diff --git a/tests/rgen/Microsoft.Macios.Transformer.Tests/TransformerTests.cs b/tests/rgen/Microsoft.Macios.Transformer.Tests/TransformerTests.cs index ce8c3e305d6b..7567add779f6 100644 --- a/tests/rgen/Microsoft.Macios.Transformer.Tests/TransformerTests.cs +++ b/tests/rgen/Microsoft.Macios.Transformer.Tests/TransformerTests.cs @@ -74,12 +74,12 @@ public void SkipTests (ApplePlatform platform, (string Source, string Path) sour var semanticModel = compilation.GetSemanticModel (syntaxTree); Assert.NotNull (semanticModel); - var declaration = syntaxTree.GetRoot () + var declaration = syntaxTree.GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); var transformer = new Transformer (targetDirectory, [(platform, compilation)], targetNamespaces); @@ -247,12 +247,12 @@ public void SelectTopicTests (ApplePlatform platform, (string Source, string Pat var semanticModel = compilation.GetSemanticModel (syntaxTree); Assert.NotNull (semanticModel); - var declaration = syntaxTree.GetRoot () + var declaration = syntaxTree.GetRoot (TestContext.Current.CancellationToken) .DescendantNodes ().OfType () .FirstOrDefault (); Assert.NotNull (declaration); - var symbol = semanticModel.GetDeclaredSymbol (declaration); + var symbol = semanticModel.GetDeclaredSymbol (declaration, TestContext.Current.CancellationToken); Assert.NotNull (symbol); var binding = Binding.FromDeclaration (declaration, symbol, new (semanticModel)); Assert.NotNull (binding); diff --git a/tests/rgen/xunit.runner.json b/tests/rgen/xunit.runner.json new file mode 100644 index 000000000000..a623cc994c61 --- /dev/null +++ b/tests/rgen/xunit.runner.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://xunit.net/schema/current/xunit.runner.schema.json", + "diagnosticMessages": true, + "preEnumerateTheories": true +}