-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Modify Attribute_TypedParamsConstant_EnumArray_ConstructorArgument test to work on Mono #79955
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
| } | ||
|
|
||
| [Theory, CombinatorialData, WorkItem(65594, "https://github.com/dotnet/roslyn/issues/65594")] | ||
| [ConditionalTheory(typeof(NotOnAnyMono), Reason = "https://github.com/dotnet/runtime/issues/118568")] |
There was a problem hiding this comment.
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");There was a problem hiding this comment.
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")] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
Thanks @Venkad000 |
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.