-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Add test for EventHandlerType Invoke method reflection #117219
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
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.
Pull Request Overview
Adds a new test for invoking EventHandlerType.Invoke via reflection and updates attribute naming from Tool to By.
- Renames attribute parameters and property bindings from
TooltoByacross tests and utilities - Adds
EventHanderTypeUsedViaReflectiontest case and removes the oldEventHanderTypeGetInvokeMethodfile - Updates Roslyn analyzer test to invoke the new test name
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs | Changed GetPropertyValue("Tool") to GetPropertyValue("By") |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/EventHanderTypeUsedViaReflection.cs | Added new reflection test for EventHandlerType.Invoke |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/EventHanderTypeGetInvokeMethod.cs | Removed obsolete test file |
| src/tools/illink/test/Mono.Linker.Tests.Cases/LinkXml/EmbeddedLinkXmlFromCopyAssemblyIsProcessed.cs | Switched Tool = to By = in [KeptTypeInAssembly] attributes |
| src/tools/illink/test/Mono.Linker.Tests.Cases/LinkXml/CanPreserveExportedTypesUsingRegex.cs | Switched Tool = to By = in link XML attribute |
| src/tools/illink/test/Mono.Linker.Tests.Cases/LinkXml/CanPreserveAnExportedType.cs | Switched Tool = to By = in link XML attribute |
| src/tools/illink/test/Mono.Linker.Tests.Cases.Expectations/Assertions/BaseInAssemblyAttribute.cs | Renamed Tool property to By |
| src/tools/illink/test/ILLink.RoslynAnalyzer.Tests/ReflectionTests.cs | Renamed test method to match new test class |
Comments suppressed due to low confidence (2)
src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/EventHanderTypeUsedViaReflection.cs:21
- Typo in class name: "EventHanderTypeUsedViaReflection" should be renamed to "EventHandlerTypeUsedViaReflection" for consistency and clarity.
public class EventHanderTypeUsedViaReflection
src/tools/illink/test/ILLink.RoslynAnalyzer.Tests/ReflectionTests.cs:38
- Typo in test method name: "EventHanderTypeUsedViaReflection" should be "EventHandlerTypeUsedViaReflection" to match corrected class name and filename.
public Task EventHanderTypeUsedViaReflection()
|
Tagging subscribers to this area: @dotnet/illink |
Reproducing means the |
Yeah, I think this is running into the "What do you mean when you say the method/type is kept?" In IL terms, it's easy. When we keep the IL metadata we say it was kept. In native terms, it's not so easy. We can have the method body instruction, but not the metadata (name of the method, parameter list). We can have metadata for the method, but no method body. We can have a reflection-invisible The AOT bug here is that just having a delegate type in method signature doesn't mean we keep it to the extent of giving it a usable |
Adds testcase for #117200
@MichalStrehovsky I am not sure why this testcase doesn't reproduce the issue for ILC. But from debugging I see that:
EETypeNode, not aConstructedEETypeNodeCreationAllowedreturns trueMetadataManager.GetDependenciesDueToEETypePresenceIt looks like #117194 will fix this, but I want to make sure I understand the intention. What's supposed to be the difference between
CreationAllowedandConstructedEETypeNode? Should we callGetDependenciesDueToEETypePresencefor nodes whereCreationAllowedis true but there's noConstructedEETypeNode?