Skip to content

Conversation

@Venkad000
Copy link
Contributor

@Venkad000 Venkad000 commented Aug 19, 2025

Modify Attribute_TypedParamsConstant_EnumArray_ConstructorArgument test to work on Mono. The test fails with a System.InvalidCastExpception due to the difference in the way the constructorArguments are structured in Mono and CoreCLR which allows (IEnumerable)arg.Value).Cast() to be done in CoreCLR but not on Mono.

Venkad000 and others added 2 commits August 19, 2025 07:56
This is due to the difference in the way the constructorArguments are
structured in Mono and CoreCLR which allows (IEnumerable)arg.Value).Cast<CustomAttributeTypedArgument>()
to be done in CoreCLR but not on Mono. This throws a "System.InvalidCastException: Specified cast is not valid" on Mono.
@Venkad000 Venkad000 requested a review from a team as a code owner August 19, 2025 09:29
@dotnet-policy-service dotnet-policy-service bot added the Community The pull request was submitted by a contributor who is not a Microsoft employee. label Aug 19, 2025
}

[Theory, CombinatorialData, WorkItem(65594, "https://github.com/dotnet/roslyn/issues/65594")]
[ConditionalTheory(typeof(NotOnAnyMono), Reason = "https://github.com/dotnet/runtime/issues/118568")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider instead changing the test so it works on Mono (this would also catch when the Mono behavior changes, e.g., if the runtime issue is fixed). I would keep the link to the runtime issue in a WorkItem attribute on this test though.

The Console.WriteLine line in the test could be conditional and this alternative should work on Mono if my experiments are correct:

Console.WriteLine(((IEnumerable)arg.Value).Cast<object>().SingleOrDefault() ?? "null");

Copy link
Contributor Author

@Venkad000 Venkad000 Aug 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep! Thank you! I have accommodated the changes.

}

[Theory, CombinatorialData, WorkItem(65594, "https://github.com/dotnet/roslyn/issues/65594")]
[ConditionalTheory(typeof(NotOnAnyMono), Reason = "https://github.com/dotnet/runtime/issues/118568")]
Copy link
Member

@jjonescz jjonescz Aug 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, your PR description says "closes: dotnet/runtime#118568" which would close the runtime issue when this PR is merged. Is that intended? That way the issue might not get triaged.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry. That wasn't intended. I have removed it from the description.

@Venkad000 Venkad000 changed the title Skip Attribute_TypedParamsConstant_EnumArray_ConstructorArgument test on Mono Modify Attribute_TypedParamsConstant_EnumArray_ConstructorArgument test to work on Mono Aug 19, 2025
@jjonescz jjonescz enabled auto-merge (squash) August 20, 2025 07:46
@jjonescz jjonescz disabled auto-merge August 20, 2025 07:46
@jjonescz jjonescz enabled auto-merge (squash) August 20, 2025 07:46
@jjonescz jjonescz merged commit 528decf into dotnet:main Aug 20, 2025
23 of 24 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Aug 20, 2025
@jjonescz
Copy link
Member

Thanks @Venkad000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Compilers Community The pull request was submitted by a contributor who is not a Microsoft employee.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants