Skip to content

Commit 528decf

Browse files
authored
Modify Attribute_TypedParamsConstant_EnumArray_ConstructorArgument test to work on Mono (#79955)
1 parent 47cf834 commit 528decf

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenFunctionPointersTests.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12325,20 +12325,24 @@ unsafe class C { }
1232512325
verifier.VerifyDiagnostics();
1232612326
}
1232712327

12328-
[Theory, CombinatorialData, WorkItem(65594, "https://github.com/dotnet/roslyn/issues/65594")]
12328+
[Theory, CombinatorialData, WorkItem(65594, "https://github.com/dotnet/roslyn/issues/65594"), WorkItem("https://github.com/dotnet/runtime/issues/118568")]
1232912329
public void Attribute_TypedParamsConstant_EnumArray_ConstructorArgument(
1233012330
[CombinatorialValues("class", "struct")] string kind,
1233112331
[CombinatorialValues("[]{}", "()")] string initializer)
1233212332
{
12333+
var evalString = ExecutionConditionUtil.IsMonoCore
12334+
? "Console.WriteLine(((((IEnumerable)arg.Value).Cast<object>().SingleOrDefault())) ?? \"null\");"
12335+
: "Console.WriteLine(((IEnumerable)arg.Value).Cast<CustomAttributeTypedArgument>().SingleOrDefault().Value ?? \"null\");";
12336+
var includeString = ExecutionConditionUtil.IsMonoCore ? "" : "using System.Reflection;";
1233312337
var source = $$"""
1233412338
using System;
1233512339
using System.Collections;
1233612340
using System.Linq;
12337-
using System.Reflection;
12341+
{{includeString}}
1233812342
1233912343
var attr = typeof(C).CustomAttributes.Single(d => d.AttributeType == typeof(A));
1234012344
var arg = attr.ConstructorArguments.Single();
12341-
Console.WriteLine(((IEnumerable)arg.Value).Cast<CustomAttributeTypedArgument>().SingleOrDefault().Value ?? "null");
12345+
{{evalString}}
1234212346
1234312347
class A : Attribute
1234412348
{

0 commit comments

Comments
 (0)