Skip to content

Commit 0140528

Browse files
authored
Fix failing test case BindingAsyncTasklikeMoreTests.Dynamic on Mono (#79878)
* Fix failing test case Microsoft.CodeAnalysis.CSharp.UnitTests.Semantics.BindingAsyncTasklikeMoreTests.Dynamic on Mono The BindingAsyncTasklikeMoreTests.Dynamic test was failing on Mono because the type of ConstructorArguments differs between Mono and CoreCLR. The existing test expectation was aligned with CoreCLR behavior, which caused mismatches when running under Mono. This change updates the test to set the expected value based on the current runtime. * Put the condition down in one parameter
1 parent a59d20f commit 0140528

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

src/Compilers/CSharp/Test/Semantic/Semantics/BindingAsyncTasklikeMoreTests.cs

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -647,9 +647,23 @@ public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter
647647
namespace System.Runtime.CompilerServices { class AsyncMethodBuilderAttribute : System.Attribute { public AsyncMethodBuilderAttribute(System.Type t) { } } }
648648
";
649649
var compilation = CreateCompilationWithMscorlib461(source, references: new MetadataReference[] { CSharpRef, SystemCoreRef });
650-
var verifier = CompileAndVerify(
651-
compilation,
652-
expectedSignatures: new[]
650+
var expectedSignatures = ExecutionConditionUtil.IsMonoCore
651+
? new[]
652+
{
653+
Signature(
654+
"C+<>c__DisplayClass2_0",
655+
"<M>b__0",
656+
".method [System.Runtime.CompilerServices.AsyncStateMachineAttribute(C+<>c__DisplayClass2_0+<<M>b__0>d)] assembly hidebysig instance [System.Runtime.CompilerServices.DynamicAttribute(System.Boolean[])] MyTask`1[System.Object] <M>b__0() cil managed"),
657+
Signature(
658+
"C+<>c__DisplayClass2_0",
659+
"<M>b__1",
660+
".method [System.Runtime.CompilerServices.AsyncStateMachineAttribute(C+<>c__DisplayClass2_0+<<M>b__1>d)] assembly hidebysig instance [System.Runtime.CompilerServices.DynamicAttribute(System.Boolean[])] MyTask`1[System.Object[]] <M>b__1() cil managed"),
661+
Signature(
662+
"C+<>c__DisplayClass2_0",
663+
"<M>b__2",
664+
".method [System.Runtime.CompilerServices.AsyncStateMachineAttribute(C+<>c__DisplayClass2_0+<<M>b__2>d)] assembly hidebysig instance [System.Runtime.CompilerServices.DynamicAttribute(System.Boolean[])] MyTask`1[System.Object] <M>b__2() cil managed"),
665+
}
666+
: new[]
653667
{
654668
Signature(
655669
"C+<>c__DisplayClass2_0",
@@ -663,7 +677,12 @@ namespace System.Runtime.CompilerServices { class AsyncMethodBuilderAttribute :
663677
"C+<>c__DisplayClass2_0",
664678
"<M>b__2",
665679
".method [System.Runtime.CompilerServices.AsyncStateMachineAttribute(C+<>c__DisplayClass2_0+<<M>b__2>d)] assembly hidebysig instance [System.Runtime.CompilerServices.DynamicAttribute(System.Collections.ObjectModel.ReadOnlyCollection`1[System.Reflection.CustomAttributeTypedArgument])] MyTask`1[System.Object] <M>b__2() cil managed"),
666-
});
680+
};
681+
682+
var verifier = CompileAndVerify(
683+
compilation,
684+
expectedSignatures: expectedSignatures);
685+
667686
verifier.VerifyDiagnostics();
668687
}
669688

0 commit comments

Comments
 (0)